-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: Add support for PEP 519 #13823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
See this section for guidance relevant to pandas:
|
so we add to def fspath(path):
if isinstance(path, (str, bytes)):
return path
if _PATHLIB_INTSTALLED and isinstance(path, pathlib.Path):
path = text_type(path) # 3.4/3.5 compat
if _PYPATH_INSTALLED and isinstance(path, LocalPath):
path = path.strpath
else:
path_type = type(path)
try:
path = path_type.__fspath__(path)
except AttributeError:
if hasattr(path_type, '__fspath__'):
raise
raise TypeError("expected str, bytes, py.path.LocalPath or os.PathLike object, not " + path_type.__name__) from None
if isinstance(path, (str, bytes)):
return path
else:
raise TypeError("expected __fspath__() to return str or bytes, not " + type(path).__name__) |
there are already routines in io/common.py to handle pathlike things - they just need some updating |
File System Path Protocol has been accepted and implemented into Python 3.6, a backwards compatibility layer to support the introduced PEP 519 for python version < 3.6.
The text was updated successfully, but these errors were encountered: