Skip to content

Commit 41cdb5d

Browse files
authored
Merge branch 'main-fsspec' into handler-argument
2 parents 4c1c8a5 + 57c0a3b commit 41cdb5d

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ dependencies = [
3636
"awkward>=2.4.6",
3737
"importlib-metadata;python_version<\"3.8\"",
3838
"numpy",
39+
"fsspec",
3940
"packaging",
4041
"typing_extensions>=4.1.0; python_version < \"3.11\""
4142
]

src/uproot/_util.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from typing import IO
2121
from urllib.parse import unquote, urlparse
2222

23+
import fsspec
2324
import numpy
2425
import packaging.version
2526

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

297298
_remote_schemes = ["root", "s3", "http", "https"]
298-
_schemes = ["file", *_remote_schemes]
299-
300-
try:
301-
# TODO: remove this try/except when fsspec becomes a required dependency
302-
import fsspec
303-
304-
_schemes = list({*_schemes, *fsspec.available_protocols()})
305-
except ImportError:
306-
pass
299+
_schemes = list({*_remote_schemes, *fsspec.available_protocols()})
307300

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

src/uproot/source/fsspec.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import concurrent.futures
77
import queue
88

9+
import fsspec
10+
import fsspec.asyn
11+
912
import uproot
1013
import uproot.source.chunk
1114
import uproot.source.futures
@@ -24,8 +27,6 @@ class FSSpecSource(uproot.source.chunk.Source):
2427
"""
2528

2629
def __init__(self, file_path: str, **options):
27-
import fsspec.core
28-
2930
default_options = uproot.reading.open.defaults
3031

3132
exclude_keys = set(default_options.keys())
@@ -191,8 +192,6 @@ def closed(self) -> bool:
191192
class FSSpecLoopExecutor(uproot.source.futures.Executor):
192193
@property
193194
def loop(self) -> asyncio.AbstractEventLoop:
194-
import fsspec.asyn
195-
196195
return fsspec.asyn.get_loop()
197196

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

0 commit comments

Comments
 (0)