37
37
from collections import defaultdict
38
38
from functools import lru_cache
39
39
from pathlib import Path
40
- from typing import TYPE_CHECKING , Any , Literal , Unpack , overload
40
+ from typing import TYPE_CHECKING , Literal , overload
41
41
from urllib .parse import urlparse
42
42
43
43
import fsspec .asyn
48
48
from obstore .store import from_url
49
49
50
50
if TYPE_CHECKING :
51
+ import sys
51
52
from collections .abc import Coroutine , Iterable
53
+ from typing import Any
52
54
53
55
from obstore import Attributes , Bytes , ReadableFile , WritableFile
54
56
from obstore .store import (
60
62
S3Config ,
61
63
)
62
64
65
+ if sys .version_info >= (3 , 11 ):
66
+ from typing import Unpack
67
+ else :
68
+ from typing_extensions import Unpack
69
+
70
+
63
71
__all__ = [
64
72
"BufferedFile" ,
65
73
"FsspecStore" ,
@@ -391,9 +399,8 @@ async def _cat_ranges( # noqa: PLR0913
391
399
raise ValueError
392
400
393
401
per_file_requests : dict [str , list [tuple [int , int , int ]]] = defaultdict (list )
394
- for idx , (path , start , end ) in enumerate (
395
- zip (paths , starts , ends , strict = False ),
396
- ):
402
+ # When upgrading to Python 3.10, use strict=True
403
+ for idx , (path , start , end ) in enumerate (zip (paths , starts , ends )):
397
404
per_file_requests [path ].append ((start , end , idx ))
398
405
399
406
futs : list [Coroutine [Any , Any , list [Bytes ]]] = []
@@ -409,13 +416,11 @@ async def _cat_ranges( # noqa: PLR0913
409
416
result = await asyncio .gather (* futs )
410
417
411
418
output_buffers : list [bytes ] = [b"" ] * len (paths )
412
- for per_file_request , buffers in zip (
413
- per_file_requests .items (),
414
- result ,
415
- strict = True ,
416
- ):
419
+ # When upgrading to Python 3.10, use strict=True
420
+ for per_file_request , buffers in zip (per_file_requests .items (), result ):
417
421
path , ranges = per_file_request
418
- for buffer , ranges_ in zip (buffers , ranges , strict = True ):
422
+ # When upgrading to Python 3.10, use strict=True
423
+ for buffer , ranges_ in zip (buffers , ranges ):
419
424
initial_index = ranges_ [2 ]
420
425
output_buffers [initial_index ] = buffer .to_bytes ()
421
426
0 commit comments