diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2020-10-10 12:02:05 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2020-10-10 12:02:05 +0100 |
commit | fd2749e3eeb4ca8e0bc118ec28022a921f411997 (patch) | |
tree | 610f4d89ff5b2d19f2c5fcb733b09f55a753f58e /numpy/compat | |
parent | 4afd82d8dd2c1ef48c62bdf875a194e407f2d2d3 (diff) | |
download | numpy-fd2749e3eeb4ca8e0bc118ec28022a921f411997.tar.gz |
MAINT: Cleanup compatibility code for pathlib
`Path` can now never be none, and `PurePath` is not used and not in `__all__`.
Diffstat (limited to 'numpy/compat')
-rw-r--r-- | numpy/compat/py3k.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/numpy/compat/py3k.py b/numpy/compat/py3k.py index 5e742bf6c..f36aaca17 100644 --- a/numpy/compat/py3k.py +++ b/numpy/compat/py3k.py @@ -18,7 +18,7 @@ __all__ = ['bytes', 'asbytes', 'isfileobj', 'getexception', 'strchar', import sys import os -from pathlib import Path, PurePath +from pathlib import Path import io import abc @@ -78,11 +78,11 @@ def asunicode_nested(x): def is_pathlib_path(obj): """ - Check whether obj is a pathlib.Path object. + Check whether obj is a `pathlib.Path` object. - Prefer using `isinstance(obj, os_PathLike)` instead of this function. + Prefer using ``isinstance(obj, os.PathLike)`` instead of this function. """ - return Path is not None and isinstance(obj, Path) + return isinstance(obj, Path) # from Python 3.7 class contextlib_nullcontext: @@ -132,6 +132,5 @@ def npy_load_module(name, fn, info=None): return SourceFileLoader(name, fn).load_module() -# Backport os.fs_path, os.PathLike, and PurePath.__fspath__ os_fspath = os.fspath os_PathLike = os.PathLike |