Skip to content

Commit bb486d7

Browse files
committed
style: fix ruff linting issues in Python code
- Add missing imports to `__all__` in `iris/__init__.py.`
1 parent c40bfcc commit bb486d7

7 files changed

Lines changed: 383 additions & 122 deletions

File tree

iris/__init__.py

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
set_quantum_cooldown,
1717
get_quantum_cooldown,
1818
)
19+
1920
try:
2021
from .iris import (
2122
PyRuntime,
@@ -42,7 +43,12 @@ class Runtime:
4243
def __init__(self):
4344
self._inner = PyRuntime()
4445

45-
def call(self, pid: int, data: Union[bytes, bytearray, memoryview], timeout: Optional[float] = None) -> Awaitable[bytes]:
46+
def call(
47+
self,
48+
pid: int,
49+
data: Union[bytes, bytearray, memoryview],
50+
timeout: Optional[float] = None,
51+
) -> Awaitable[bytes]:
4652
"""
4753
Send a request to an actor and await a response.
4854
@@ -75,15 +81,21 @@ def spawn(self, handler, budget: int = 100, release_gil: bool = False) -> int:
7581
"""
7682
return self._inner.spawn_py_handler(handler, budget, release_gil)
7783

78-
def spawn_py_handler_bounded(self, handler, budget: int, capacity: int, release_gil: bool = False) -> int:
84+
def spawn_py_handler_bounded(
85+
self, handler, budget: int, capacity: int, release_gil: bool = False
86+
) -> int:
7987
"""
8088
Spawn a Python handler with a bounded mailbox capacity.
8189
8290
Returns the PID. Sending beyond capacity will fail (drop-new policy).
8391
"""
84-
return self._inner.spawn_py_handler_bounded(handler, budget, capacity, release_gil)
92+
return self._inner.spawn_py_handler_bounded(
93+
handler, budget, capacity, release_gil
94+
)
8595

86-
def spawn_virtual(self, handler, budget: int = 100, idle_timeout_ms: Optional[int] = None) -> int:
96+
def spawn_virtual(
97+
self, handler, budget: int = 100, idle_timeout_ms: Optional[int] = None
98+
) -> int:
8799
"""
88100
Reserve a lazy/virtual actor PID and activate it on first message.
89101
@@ -112,7 +124,9 @@ def spawn_with_mailbox(self, handler, budget: int = 100) -> int:
112124
"""
113125
return self._inner.spawn_with_mailbox(handler, budget)
114126

115-
def spawn_child(self, parent: int, handler, budget: int = 100, release_gil: bool = False) -> int:
127+
def spawn_child(
128+
self, parent: int, handler, budget: int = 100, release_gil: bool = False
129+
) -> int:
116130
"""
117131
Spawn a new actor whose lifetime is tied to `parent`.
118132
@@ -141,7 +155,9 @@ def spawn_child_pool(
141155
Useful for pipeline workloads to avoid repeated spawn/teardown costs.
142156
Returns a list of worker PIDs.
143157
"""
144-
return self._inner.spawn_child_pool(parent, handler, workers, budget, release_gil)
158+
return self._inner.spawn_child_pool(
159+
parent, handler, workers, budget, release_gil
160+
)
145161

146162
def spawn_child_with_mailbox(self, parent: int, handler, budget: int = 100) -> int:
147163
"""
@@ -154,7 +170,9 @@ def send(self, pid: int, data: Union[bytes, bytearray, memoryview]) -> bool:
154170
"""Send bytes-like data to a specific local PID."""
155171
return self._inner.send(pid, data)
156172

157-
def send_many(self, pid: int, payloads: Iterable[Union[bytes, bytearray, memoryview]]) -> int:
173+
def send_many(
174+
self, pid: int, payloads: Iterable[Union[bytes, bytearray, memoryview]]
175+
) -> int:
158176
"""Batch-send bytes-like payloads to a PID.
159177
160178
Returns the number of payloads accepted by the mailbox.
@@ -168,14 +186,18 @@ def send_named(self, name: str, data: Union[bytes, bytearray, memoryview]) -> bo
168186
return self._inner.send(pid, data)
169187
return False
170188

171-
def send_after(self, pid: int, delay_ms: int, data: Union[bytes, bytearray, memoryview]) -> int:
189+
def send_after(
190+
self, pid: int, delay_ms: int, data: Union[bytes, bytearray, memoryview]
191+
) -> int:
172192
"""
173193
Schedule a one-shot message to be sent after `delay_ms` milliseconds.
174194
Returns a timer ID.
175195
"""
176196
return self._inner.send_after(pid, delay_ms, data)
177197

178-
def send_interval(self, pid: int, interval_ms: int, data: Union[bytes, bytearray, memoryview]) -> int:
198+
def send_interval(
199+
self, pid: int, interval_ms: int, data: Union[bytes, bytearray, memoryview]
200+
) -> int:
179201
"""
180202
Schedule a repeating message to be sent every `interval_ms` milliseconds.
181203
Returns a timer ID.
@@ -350,7 +372,9 @@ def is_load_shedding_active(self) -> bool:
350372
"""Check if load shedding is currently active (system at capacity)."""
351373
return self._inner.is_load_shedding_active()
352374

353-
def selective_recv(self, pid: int, matcher: Callable, timeout: Optional[float] = None) -> Awaitable[Optional[Union[bytes, PySystemMessage]]]:
375+
def selective_recv(
376+
self, pid: int, matcher: Callable, timeout: Optional[float] = None
377+
) -> Awaitable[Optional[Union[bytes, PySystemMessage]]]:
354378
"""
355379
Return an awaitable that resolves when `matcher(msg)` is True.
356380
@@ -369,7 +393,9 @@ def selective_recv(self, pid: int, matcher: Callable, timeout: Optional[float] =
369393
"""
370394
return self._inner.selective_recv_observed_py(pid, matcher, timeout)
371395

372-
def selective_recv_blocking(self, pid: int, matcher: Callable, timeout: Optional[float] = None) -> Optional[Union[bytes, PySystemMessage]]:
396+
def selective_recv_blocking(
397+
self, pid: int, matcher: Callable, timeout: Optional[float] = None
398+
) -> Optional[Union[bytes, PySystemMessage]]:
373399
"""
374400
Blocking convenience wrapper around `selective_recv` for sync code.
375401
Runs a new asyncio event loop to await the result.
@@ -407,7 +433,9 @@ def set_release_gil_strict(self, strict: bool):
407433
"""When True, spawning with `release_gil=True` returns an error if limits are exceeded."""
408434
self._inner.set_release_gil_strict(strict)
409435

410-
def send_remote(self, addr: str, pid: int, data: Union[bytes, bytearray, memoryview]):
436+
def send_remote(
437+
self, addr: str, pid: int, data: Union[bytes, bytearray, memoryview]
438+
):
411439
"""Send bytes-like data to a PID on a remote node.
412440
413441
This helper will internally create or reuse a proxy actor, so users
@@ -446,23 +474,42 @@ def mailbox_backpressure(self, pid: int) -> Optional[str]:
446474
"""Return inferred backpressure status (NORMAL, HIGH, CRITICAL) for the actor."""
447475
return self._inner.mailbox_backpressure(pid)
448476

449-
def send_with_backpressure(self, pid: int, data: bytes) -> tuple[bool, Optional[str]]:
477+
def send_with_backpressure(
478+
self, pid: int, data: bytes
479+
) -> tuple[bool, Optional[str]]:
450480
"""Send data and get instant backpressure feedback (Python wrapper)."""
451481
success = self.send(pid, data)
452482
level = self.mailbox_backpressure(pid)
453483
return success, level
454484

455-
def send_user_with_backpressure(self, pid: int, data: bytes) -> tuple[bool, Optional[str]]:
485+
def send_user_with_backpressure(
486+
self, pid: int, data: bytes
487+
) -> tuple[bool, Optional[str]]:
456488
"""Send data and get instant backpressure feedback using send_user path."""
457489
success = self.send(pid, data)
458490
level = self.mailbox_backpressure(pid)
459491
return success, level
460492

493+
461494
__all__ = [
462495
"Runtime",
463496
"PySystemMessage",
464497
"PyRequest",
465498
"version",
466499
"allocate_buffer",
467500
"PyMailbox",
501+
"register_offload",
502+
"offload",
503+
"set_jit_logging",
504+
"get_jit_logging",
505+
"set_quantum_speculation",
506+
"get_quantum_speculation",
507+
"set_quantum_speculation_threshold",
508+
"get_quantum_speculation_threshold",
509+
"set_quantum_log_threshold",
510+
"get_quantum_log_threshold",
511+
"set_quantum_compile_budget",
512+
"get_quantum_compile_budget",
513+
"set_quantum_cooldown",
514+
"get_quantum_cooldown",
468515
]

0 commit comments

Comments
 (0)