Skip to content

Commit

Permalink
Merge branch 'main-fsspec' into handler-argument
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis authored Nov 15, 2023
2 parents 4c1c8a5 + 57c0a3b commit 41cdb5d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies = [
"awkward>=2.4.6",
"importlib-metadata;python_version<\"3.8\"",
"numpy",
"fsspec",
"packaging",
"typing_extensions>=4.1.0; python_version < \"3.11\""
]
Expand Down
11 changes: 2 additions & 9 deletions src/uproot/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from typing import IO
from urllib.parse import unquote, urlparse

import fsspec
import numpy
import packaging.version

Expand Down Expand Up @@ -295,15 +296,7 @@ def regularize_path(path):
_windows_absolute_path_pattern_slash = re.compile(r"^[\\/][A-Za-z]:[\\/]")

_remote_schemes = ["root", "s3", "http", "https"]
_schemes = ["file", *_remote_schemes]

try:
# TODO: remove this try/except when fsspec becomes a required dependency
import fsspec

_schemes = list({*_schemes, *fsspec.available_protocols()})
except ImportError:
pass
_schemes = list({*_remote_schemes, *fsspec.available_protocols()})

_uri_scheme = re.compile("^(" + "|".join([re.escape(x) for x in _schemes]) + ")://")

Expand Down
7 changes: 3 additions & 4 deletions src/uproot/source/fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import concurrent.futures
import queue

import fsspec
import fsspec.asyn

import uproot
import uproot.source.chunk
import uproot.source.futures
Expand All @@ -24,8 +27,6 @@ class FSSpecSource(uproot.source.chunk.Source):
"""

def __init__(self, file_path: str, **options):
import fsspec.core

default_options = uproot.reading.open.defaults

exclude_keys = set(default_options.keys())
Expand Down Expand Up @@ -191,8 +192,6 @@ def closed(self) -> bool:
class FSSpecLoopExecutor(uproot.source.futures.Executor):
@property
def loop(self) -> asyncio.AbstractEventLoop:
import fsspec.asyn

return fsspec.asyn.get_loop()

def submit(self, coroutine) -> concurrent.futures.Future:
Expand Down

0 comments on commit 41cdb5d

Please sign in to comment.