Skip to content
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.10
rev: v0.11.0
hooks:
- id: ruff
args: [--fix, --show-fixes]
Expand Down
12 changes: 4 additions & 8 deletions src/uproot/_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,7 @@ def real_filter_branch(branch):
assert steps_per_file is not unset # either assigned or assumed to be 1
total_files = len(ttrees)
total_entries = sum(ttree.num_entries for ttree in ttrees)
step_size = max(
1, int(math.ceil(total_entries / (total_files * steps_per_file)))
)
step_size = max(1, math.ceil(total_entries / (total_files * steps_per_file)))

if count == 0:
raise ValueError(
Expand Down Expand Up @@ -672,7 +670,7 @@ def real_filter_branch(branch):
)
step_sum += int(ttree_step)

entry_step = int(round(step_sum / len(ttrees)))
entry_step = round(step_sum / len(ttrees))
assert entry_step >= 1

for key in common_keys:
Expand Down Expand Up @@ -1490,9 +1488,7 @@ def real_filter_branch(branch):
assert steps_per_file is not unset # either assigned or assumed to be 1
total_files = len(ttrees)
total_entries = sum(ttree.num_entries for ttree in ttrees)
step_size = max(
1, int(math.ceil(total_entries / (total_files * steps_per_file)))
)
step_size = max(1, math.ceil(total_entries / (total_files * steps_per_file)))

if count == 0:
raise ValueError(
Expand Down Expand Up @@ -1528,7 +1524,7 @@ def real_filter_branch(branch):
)
step_sum += int(ttree_step)

entry_step = int(round(step_sum / len(ttrees)))
entry_step = round(step_sum / len(ttrees))

divisions = [0]
partition_args = []
Expand Down
2 changes: 1 addition & 1 deletion src/uproot/behaviors/TBranch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3242,7 +3242,7 @@ def _hasbranches_num_entries_for(
if total_bytes == 0:
num_entries = 0
else:
num_entries = int(round(target_num_bytes * total_entries / total_bytes))
num_entries = round(target_num_bytes * total_entries / total_bytes)
if num_entries <= 0:
return 1
else:
Expand Down
2 changes: 1 addition & 1 deletion src/uproot/models/RNTuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _num_entries_for(in_ntuple, target_num_bytes, filter_name):
if total_bytes == 0:
num_entries = 0
else:
num_entries = int(round(target_num_bytes * total_entries / total_bytes))
num_entries = round(target_num_bytes * total_entries / total_bytes)
if num_entries <= 0:
return 1
else:
Expand Down
10 changes: 5 additions & 5 deletions src/uproot/writing/_cascade.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,8 +1581,8 @@ def add_object(
if replaces is None:
next_key = key.copy_to(self._data.next_location)
if self._data.num_bytes + next_key.num_bytes > self._data.allocation:
requested_num_bytes = int(
math.ceil(1.5 * (self._data.allocation + next_key.num_bytes + 8))
requested_num_bytes = math.ceil(
1.5 * (self._data.allocation + next_key.num_bytes + 8)
)
self._reallocate_data(requested_num_bytes)
next_key = key.copy_to(self._data.next_location)
Expand All @@ -1597,8 +1597,8 @@ def add_object(
self._data.num_bytes + new_key.num_bytes - original_key.num_bytes
> self._data.allocation
):
requested_num_bytes = int(
math.ceil(1.5 * (self._data.allocation + new_key.num_bytes + 8))
requested_num_bytes = math.ceil(
1.5 * (self._data.allocation + new_key.num_bytes + 8)
)
self._reallocate_data(requested_num_bytes)
original_key = self._data.get_key(replaces.name.string, replaces.cycle)
Expand Down Expand Up @@ -1685,7 +1685,7 @@ def add_directory(self, sink, name, initial_directory_bytes, uuid, flush=True):
next_key = subdirectory_key.copy_to(self._data.next_location)
if self._data.num_bytes + next_key.num_bytes > self._data.allocation:
self._reallocate_data(
int(math.ceil(1.5 * (self._data.allocation + next_key.num_bytes + 8)))
math.ceil(1.5 * (self._data.allocation + next_key.num_bytes + 8))
)
next_key = subdirectory_key.copy_to(self._data.next_location)
next_key._location = self._data.next_location
Expand Down
2 changes: 1 addition & 1 deletion src/uproot/writing/_cascadetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def extend(self, file, sink, data):
if self._num_baskets >= self._basket_capacity - 1:
self._basket_capacity = max(
self._basket_capacity + 1,
int(math.ceil(self._basket_capacity * self._resize_factor)),
math.ceil(self._basket_capacity * self._resize_factor),
)

for datum in self._branch_data:
Expand Down