class SourceFinder: (source)
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. |
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:str | Undocumented |
| Returns | |
Tuple[ | Undocumented |
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:str | Undocumented |
| Returns | |
Optional[ | Undocumented |
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:str | Undocumented |
| Returns | |
Optional[ | Undocumented |