Skip to content

Commit 71262d1

Browse files
fix the incorrect list of ends for _cat_ranges (#1402)
Co-authored-by: Martin Durant <[email protected]>
1 parent e20f626 commit 71262d1

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

fsspec/asyn.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,16 @@ async def _cat_ranges(
467467
on_error="return",
468468
**kwargs,
469469
):
470+
"""Get the contents of byte ranges from one or more files
471+
472+
Parameters
473+
----------
474+
paths: list
475+
A list of of filepaths on this filesystems
476+
starts, ends: int or list
477+
Bytes limits of the read. If using a single int, the same value will be
478+
used to read all the specified files.
479+
"""
470480
# TODO: on_error
471481
if max_gap is not None:
472482
# use utils.merge_offset_ranges
@@ -476,7 +486,7 @@ async def _cat_ranges(
476486
if not isinstance(starts, Iterable):
477487
starts = [starts] * len(paths)
478488
if not isinstance(ends, Iterable):
479-
ends = [starts] * len(paths)
489+
ends = [ends] * len(paths)
480490
if len(starts) != len(paths) or len(ends) != len(paths):
481491
raise ValueError
482492
coros = [

fsspec/spec.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,14 +828,24 @@ def pipe(self, path, value=None, **kwargs):
828828
def cat_ranges(
829829
self, paths, starts, ends, max_gap=None, on_error="return", **kwargs
830830
):
831+
"""Get the contents of byte ranges from one or more files
832+
833+
Parameters
834+
----------
835+
paths: list
836+
A list of of filepaths on this filesystems
837+
starts, ends: int or list
838+
Bytes limits of the read. If using a single int, the same value will be
839+
used to read all the specified files.
840+
"""
831841
if max_gap is not None:
832842
raise NotImplementedError
833843
if not isinstance(paths, list):
834844
raise TypeError
835845
if not isinstance(starts, list):
836846
starts = [starts] * len(paths)
837847
if not isinstance(ends, list):
838-
ends = [starts] * len(paths)
848+
ends = [ends] * len(paths)
839849
if len(starts) != len(paths) or len(ends) != len(paths):
840850
raise ValueError
841851
out = []

0 commit comments

Comments
 (0)