Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4 backport] Set ReadOnlyDirectory attributes when fSeekKeys == 0 #661

Merged
merged 6 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/uproot/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def regularize_rename(rename):
def applyrules(x):
for matcher, trans in rules:
if matcher.search(x) is not None:
return matcher.sub(trans, x)
return matcher.sub(trans, x) # noqa: B023
else:
return x

Expand Down
28 changes: 14 additions & 14 deletions src/uproot/behaviors/TBranch.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def lazy(
is_self.append(True)

def real_filter_branch(branch):
return branch is original and filter_branch(branch)
return branch is original and filter_branch(branch) # noqa: B023

else:
is_self.append(False)
Expand Down Expand Up @@ -614,17 +614,17 @@ def real_filter_branch(branch):
)

def foreach(start):
stop = min(start + entry_step, entry_stop)
stop = min(start + entry_step, entry_stop) # noqa: B023
length = stop - start

fields = []
names = []
for key in common_keys:
branch = obj[key]
branch = obj[key] # noqa: B023

interpretation = branchid_interpretation[branch.cache_key]
interpretation = branchid_interpretation[branch.cache_key] # noqa: B023
form = interpretation.awkward_form(
obj.file,
obj.file, # noqa: B023
{
"index_format": "i64",
"header": False,
Expand All @@ -637,7 +637,7 @@ def foreach(start):
)

generator = awkward.layout.ArrayGenerator(
branch.array,
branch.array, # noqa: B023
(
None,
start,
Expand All @@ -654,7 +654,7 @@ def foreach(start):
length,
)
cache_key = "{}:{}:{}-{}:{}".format(
branch.cache_key,
branch.cache_key, # noqa: B023
interpretation.cache_key,
start,
stop,
Expand All @@ -665,7 +665,7 @@ def foreach(start):
generator, cache=array_cache, cache_key=cache_key
)
fields.append(virtualarray)
names.append(key)
names.append(key) # noqa: B023

recordarray = awkward.layout.RecordArray(fields, names, length)
partitions.append(recordarray)
Expand Down Expand Up @@ -3594,7 +3594,7 @@ def _get_dask_array(
is_self.append(True)

def real_filter_branch(branch):
return branch is original and filter_branch(branch)
return branch is original and filter_branch(branch) # noqa: B023

else:
is_self.append(False)
Expand Down Expand Up @@ -3671,13 +3671,13 @@ def delayed_get_array(ttree, key, start, stop):
dt, inner_shape = dt.subdtype

def foreach(start):
stop = min(start + entry_step, entry_stop)
stop = min(start + entry_step, entry_stop) # noqa: B023
length = stop - start

delayed_array = delayed_get_array(ttree, key, start, stop)
shape = (length,) + inner_shape
dask_arrays.append(
da.from_delayed(delayed_array, shape=shape, dtype=dt)
delayed_array = delayed_get_array(ttree, key, start, stop) # noqa: B023
shape = (length,) + inner_shape # noqa: B023
dask_arrays.append( # noqa: B023
da.from_delayed(delayed_array, shape=shape, dtype=dt) # noqa: B023
)

for start in range(entry_start, entry_stop, entry_step):
Expand Down
3 changes: 2 additions & 1 deletion src/uproot/reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,8 @@ def __init__(self, path, cursor, context, file, parent):
if self._fSeekKeys == 0:
self._header_key = None
self._keys = []

self._keys_lookup = {}
self._len = None
else:
keys_start = self._fSeekKeys
keys_stop = min(keys_start + self._fNbytesKeys + 8, file.fEND)
Expand Down