File: __init__.py

package info (click to toggle)
universal-pathlib 0.3.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,656 kB
  • sloc: python: 20,552; makefile: 5
file content (31 lines) | stat: -rw-r--r-- 792 bytes parent folder | download
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}")