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