1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
"""Pathlib API extended to use fsspec backends."""
from __future__ import annotations
from typing import TYPE_CHECKING
try:
from upath._version import __version__
except ImportError:
__version__ = "not-installed"
if TYPE_CHECKING:
from upath.core import UnsupportedOperation
from upath.core import UPath
__all__ = ["UPath", "UnsupportedOperation"]
def __getattr__(name):
if name == "UPath":
from upath.core import UPath
globals()["UPath"] = UPath
return UPath
elif name == "UnsupportedOperation":
from upath.core import UnsupportedOperation
globals()["UnsupportedOperation"] = UnsupportedOperation
return UnsupportedOperation
else:
raise AttributeError(f"module {__name__} has no attribute {name}")
|