Return Python path relative to the containing module.
(self, stopatmodule: bool = True, includemodule: bool = False)
| 312 | return getattr(obj, self.name) |
| 313 | |
| 314 | def getmodpath(self, stopatmodule: bool = True, includemodule: bool = False) -> str: |
| 315 | """Return Python path relative to the containing module.""" |
| 316 | chain = self.listchain() |
| 317 | chain.reverse() |
| 318 | parts = [] |
| 319 | for node in chain: |
| 320 | name = node.name |
| 321 | if isinstance(node, Module): |
| 322 | name = os.path.splitext(name)[0] |
| 323 | if stopatmodule: |
| 324 | if includemodule: |
| 325 | parts.append(name) |
| 326 | break |
| 327 | parts.append(name) |
| 328 | parts.reverse() |
| 329 | return ".".join(parts) |
| 330 | |
| 331 | def reportinfo(self) -> Tuple[Union["os.PathLike[str]", str], Optional[int], str]: |
| 332 | # XXX caching? |