class documentation

class SourceFinder: (source)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method crawl​_up Given a .py[i] filename, return module and base directory.
Method crawl​_up​_dir Undocumented
Method find​_sources​_in​_dir Undocumented
Method get​_init​_file Check whether a directory contains a file named __init__.py[i].
Method is​_explicit​_package​_base Undocumented
Instance Variable exclude Undocumented
Instance Variable explicit​_package​_bases Undocumented
Instance Variable fscache Undocumented
Instance Variable namespace​_packages Undocumented
Instance Variable verbosity Undocumented
Method _crawl​_up​_helper Given a directory, maybe returns module and base directory.
def __init__(self, fscache, options): (source)

Undocumented

Parameters
fscache:FileSystemCacheUndocumented
options:OptionsUndocumented
def crawl_up(self, path): (source)

Given a .py[i] filename, return module and base directory.

For example, given "xxx/yyy/foo/bar.py", we might return something like: ("foo.bar", "xxx/yyy")

If namespace packages is off, we crawl upwards until we find a directory without an __init__.py

If namespace packages is on, we crawl upwards until the nearest explicit base directory. Failing that, we return one past the highest directory containing an __init__.py

We won't crawl past directories with invalid package names. The base directory returned is an absolute path.

Parameters
path:strUndocumented
Returns
Tuple[str, str]Undocumented
def crawl_up_dir(self, dir): (source)

Undocumented

Parameters
dir:strUndocumented
Returns
Tuple[str, str]Undocumented
def find_sources_in_dir(self, path): (source)

Undocumented

Parameters
path:strUndocumented
Returns
List[BuildSource]Undocumented
def get_init_file(self, dir): (source)

Check whether a directory contains a file named __init__.py[i].

If so, return the file's name (with dir prefixed). If not, return None.

This prefers .pyi over .py (because of the ordering of PY_EXTENSIONS).

Parameters
dir:strUndocumented
Returns
Optional[str]Undocumented
def is_explicit_package_base(self, path): (source)

Undocumented

Parameters
path:strUndocumented
Returns
boolUndocumented
exclude = (source)

Undocumented

explicit_package_bases = (source)

Undocumented

fscache = (source)

Undocumented

namespace_packages = (source)

Undocumented

verbosity = (source)

Undocumented

@functools.lru_cache()
def _crawl_up_helper(self, dir): (source)

Given a directory, maybe returns module and base directory.

We return a non-None value if we were able to find something clearly intended as a base directory (as adjudicated by being an explicit base directory or by containing a package with __init__.py).

This distinction is necessary for namespace packages, so that we know when to treat ourselves as a subpackage.

Parameters
dir:strUndocumented
Returns
Optional[Tuple[str, str]]Undocumented