def path_globs(self): """Creates a `PathGlobs` object for the files held by these Sources. This field may be projected to request the content of the files for this Sources object. """ return PathGlobs.create(Files, self.spec_path, files=self.files, globs=self.globs, rglobs=self.rglobs, zglobs=self.zglobs) @abstractproperty def extensions(self): """A collection of file extensions collected by this Sources instance. An empty collection indicates that any extension will be accepted. """ @property def excludes(self): """The sources to exclude. :rtype: :class:`Sources` """ # Since Sources.excludes is recursive on the Sources type, we need to post-class-definition # re-define excludes in this way. Sources.excludes = addressable(Exactly(Sources))(Sources.excludes)
def _accept_file(self, f): """Returns true if the given file's extension matches this Sources type.""" _, ext = os.path.splitext(f) return ext in self.extensions @property def path_globs(self): """Creates a `PathGlobs` object for the paths matched by these Sources. This field may be projected to request the content of the files for this Sources object. """ return PathGlobs.create(self.spec_path, include=self.filespecs, exclude=(self.excludes or [])) @abstractproperty def extensions(self): """A collection of file extensions collected by this Sources instance. An empty collection indicates that any extension will be accepted. """ @property def excludes(self): """The sources to exclude. :rtype: :class:`Sources` """ # Since Sources.excludes is recursive on the Sources type, we need to post-class-definition # re-define excludes in this way. Sources.excludes = addressable(Exactly(Sources))(Sources.excludes)