Return a path object pointing to source code, or an ``str`` in case of ``OSError`` / non-existing file.
(self)
| 83 | |
| 84 | @property |
| 85 | def path(self) -> Path | str: |
| 86 | """Return a path object pointing to source code, or an ``str`` in |
| 87 | case of ``OSError`` / non-existing file.""" |
| 88 | filename = inspect.getfile(self.raw) |
| 89 | if not filename: |
| 90 | return "" |
| 91 | try: |
| 92 | p = absolutepath(filename) |
| 93 | # maybe don't try this checking |
| 94 | if not p.exists(): |
| 95 | raise OSError("path check failed.") |
| 96 | return p |
| 97 | except OSError: |
| 98 | # XXX maybe try harder like the weird logic |
| 99 | # in the standard lib [linecache.updatecache] does? |
| 100 | return filename |
| 101 | |
| 102 | @property |
| 103 | def fullsource(self) -> Source | None: |
nothing calls this directly
no test coverage detected