Aluode/PerceptionLabPortable
0
1from . import caching2from ._version import __version__ # noqa: F4013from .callbacks import Callback4from .compression import available_compressions5from .core import get_fs_token_paths, open, open_files, open_local, url_to_fs6from .exceptions import FSTimeoutError7from .mapping import FSMap, get_mapper8from .registry import (9 available_protocols,10 filesystem,11 get_filesystem_class,12 register_implementation,13 registry,14)15from .spec import AbstractFileSystem16 17__all__ = [18 "AbstractFileSystem",19 "FSTimeoutError",20 "FSMap",21 "filesystem",22 "register_implementation",23 "get_filesystem_class",24 "get_fs_token_paths",25 "get_mapper",26 "open",27 "open_files",28 "open_local",29 "registry",30 "caching",31 "Callback",32 "available_protocols",33 "available_compressions",34 "url_to_fs",35]36 37 38def process_entries():39 try:40 from importlib.metadata import entry_points41 except ImportError:42 return43 if entry_points is not None:44 try:45 eps = entry_points()46 except TypeError:47 pass # importlib-metadata < 0.848 else:49 if hasattr(eps, "select"): # Python 3.10+ / importlib_metadata >= 3.9.050 specs = eps.select(group="fsspec.specs")51 else:52 specs = eps.get("fsspec.specs", [])53 registered_names = {}54 for spec in specs:55 err_msg = f"Unable to load filesystem from {spec}"56 name = spec.name57 if name in registered_names:58 continue59 registered_names[name] = True60 register_implementation(61 name,62 spec.value.replace(":", "."),63 errtxt=err_msg,64 # We take our implementations as the ones to overload with if65 # for some reason we encounter some, may be the same, already66 # registered67 clobber=True,68 )69 70 71process_entries()72 