(s: str | bytes | os.PathLike[str] | os.PathLike[bytes])
| 81 | |
| 82 | |
| 83 | def to_str(s: str | bytes | os.PathLike[str] | os.PathLike[bytes]) -> str: |
| 84 | if hasattr(s, '__fspath__'): |
| 85 | s = os.fspath(s) |
| 86 | |
| 87 | if type(s) is str: |
| 88 | return s |
| 89 | |
| 90 | if type(s) is bytes: |
| 91 | return s.decode() |
| 92 | |
| 93 | raise TypeError(f'unexpected type "{repr(s)}"') |
| 94 | |
| 95 | |
| 96 | def ptr_to_bytes(ptr_cdata) -> bytes: |
no outgoing calls
no test coverage detected
searching dependent graphs…