A single source file.
| 121 | |
| 122 | |
| 123 | class BuildSource: |
| 124 | """A single source file.""" |
| 125 | |
| 126 | def __init__( |
| 127 | self, |
| 128 | path: str | None, |
| 129 | module: str | None, |
| 130 | text: str | None = None, |
| 131 | base_dir: str | None = None, |
| 132 | followed: bool = False, |
| 133 | ) -> None: |
| 134 | self.path = path # File where it's found (e.g. 'xxx/yyy/foo/bar.py') |
| 135 | self.module = module or "__main__" # Module name (e.g. 'foo.bar') |
| 136 | self.text = text # Source code, if initially supplied, else None |
| 137 | self.base_dir = base_dir # Directory where the package is rooted (e.g. 'xxx/yyy') |
| 138 | self.followed = followed # Was this found by following imports? |
| 139 | |
| 140 | def __repr__(self) -> str: |
| 141 | return ( |
| 142 | "BuildSource(path={!r}, module={!r}, has_text={}, base_dir={!r}, followed={})".format( |
| 143 | self.path, self.module, self.text is not None, self.base_dir, self.followed |
| 144 | ) |
| 145 | ) |
| 146 | |
| 147 | |
| 148 | class BuildSourceSet: |
no outgoing calls
searching dependent graphs…