Convert *path* to a string or unicode path if possible.
(path)
| 32 | |
| 33 | |
| 34 | def _stringify_path(path): |
| 35 | """ |
| 36 | Convert *path* to a string or unicode path if possible. |
| 37 | """ |
| 38 | if isinstance(path, str): |
| 39 | return path |
| 40 | |
| 41 | # checking whether path implements the filesystem protocol |
| 42 | try: |
| 43 | return path.__fspath__() |
| 44 | except AttributeError: |
| 45 | pass |
| 46 | |
| 47 | raise TypeError("not a path-like object") |
| 48 | |
| 49 | |
| 50 | def _import_pandas(): |
no test coverage detected