Simple implementation of the path protocol.
| 634 | |
| 635 | |
| 636 | class FakePath: |
| 637 | """Simple implementation of the path protocol. |
| 638 | """ |
| 639 | def __init__(self, path): |
| 640 | self.path = path |
| 641 | |
| 642 | def __repr__(self): |
| 643 | return f'<FakePath {self.path!r}>' |
| 644 | |
| 645 | def __fspath__(self): |
| 646 | if (isinstance(self.path, BaseException) or |
| 647 | isinstance(self.path, type) and |
| 648 | issubclass(self.path, BaseException)): |
| 649 | raise self.path |
| 650 | else: |
| 651 | return self.path |
| 652 | |
| 653 | |
| 654 | def fd_count(): |
no outgoing calls