Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/upath/__init__.py: 52%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

21 statements  

1"""Pathlib API extended to use fsspec backends.""" 

2 

3from __future__ import annotations 

4 

5from typing import TYPE_CHECKING 

6 

7try: 

8 from upath._version import __version__ 

9except ImportError: 

10 __version__ = "not-installed" 

11 

12if TYPE_CHECKING: 

13 from upath.core import UnsupportedOperation 

14 from upath.core import UPath 

15 

16__all__ = ["UPath", "UnsupportedOperation"] 

17 

18 

19def __getattr__(name): 

20 if name == "UPath": 

21 from upath.core import UPath 

22 

23 globals()["UPath"] = UPath 

24 return UPath 

25 elif name == "UnsupportedOperation": 

26 from upath.core import UnsupportedOperation 

27 

28 globals()["UnsupportedOperation"] = UnsupportedOperation 

29 return UnsupportedOperation 

30 else: 

31 raise AttributeError(f"module {__name__} has no attribute {name}")