Skip to content

Commit 1ebf3ec

Browse files
Apply ruff rule RUF046
RUF046 Value being cast to `int` is already an integer
1 parent 0011a85 commit 1ebf3ec

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

distributed/deploy/local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def __init__(
211211
n_workers = max(1, CPU_COUNT // threads_per_worker) if processes else 1
212212
if n_workers and threads_per_worker is None:
213213
# Overcommit threads per worker, rather than undercommit
214-
threads_per_worker = max(1, int(math.ceil(CPU_COUNT / n_workers)))
214+
threads_per_worker = max(1, math.ceil(CPU_COUNT / n_workers))
215215
if n_workers and "memory_limit" not in worker_kwargs:
216216
worker_kwargs["memory_limit"] = parse_memory_limit(
217217
"auto", 1, n_workers, logger=logger

distributed/deploy/spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,10 @@ def _memory_per_worker(self) -> int:
514514

515515
def scale(self, n=0, memory=None, cores=None):
516516
if memory is not None:
517-
n = max(n, int(math.ceil(parse_bytes(memory) / self._memory_per_worker())))
517+
n = max(n, math.ceil(parse_bytes(memory) / self._memory_per_worker()))
518518

519519
if cores is not None:
520-
n = max(n, int(math.ceil(cores / self._threads_per_worker())))
520+
n = max(n, math.ceil(cores / self._threads_per_worker()))
521521

522522
if len(self.worker_spec) > n:
523523
not_yet_launched = set(self.worker_spec) - {

distributed/deploy/subprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def SubprocessCluster(
241241
n_workers = max(1, CPU_COUNT // threads_per_worker)
242242
if n_workers and threads_per_worker is None:
243243
# Overcommit threads per worker, rather than undercommit
244-
threads_per_worker = max(1, int(math.ceil(CPU_COUNT / n_workers)))
244+
threads_per_worker = max(1, math.ceil(CPU_COUNT / n_workers))
245245
if n_workers and "memory_limit" not in worker_kwargs:
246246
worker_kwargs["memory_limit"] = parse_memory_limit(
247247
"auto", 1, n_workers, logger=logger

distributed/protocol/tests/test_serialize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ def test_serialize_bytes(kwargs):
284284
1,
285285
"abc",
286286
b"ab" * int(40e6),
287-
int(2**26) * b"ab",
288-
(int(2**25) * b"ab", int(2**25) * b"ab"),
287+
(2**26) * b"ab",
288+
((2**25) * b"ab", (2**25) * b"ab"),
289289
]:
290290
b = serialize_bytes(x, **kwargs)
291291
assert isinstance(b, bytes)

distributed/shuffle/tests/test_buffer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
def gen_bytes(percentage: float, limit: int) -> bytes:
18-
num_bytes = int(math.floor(percentage * limit))
18+
num_bytes = math.floor(percentage * limit)
1919
return b"0" * num_bytes
2020

2121

distributed/shuffle/tests/test_comm_buffer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async def send(address, shards):
9494

9595

9696
def gen_bytes(percentage: float, memory_limit: int) -> bytes:
97-
num_bytes = int(math.floor(percentage * memory_limit))
97+
num_bytes = math.floor(percentage * memory_limit)
9898
return b"0" * num_bytes
9999

100100

distributed/stealing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def steal_time_ratio(self, ts: TaskState) -> tuple[float, int] | tuple[None, Non
293293
transfer_time = nbytes / self.scheduler.bandwidth + LATENCY
294294
cost_multiplier = transfer_time / compute_time
295295

296-
level = int(round(log2(cost_multiplier) + 6))
296+
level = round(log2(cost_multiplier) + 6)
297297

298298
if level < 1:
299299
level = 1

0 commit comments

Comments
 (0)