fix(rust): satisfy strict lint budget

This commit is contained in:
Yujong Lee 2026-09-08 09:20:04 -07:00
parent 27bf5d9364
commit 6fd590e247
5 changed files with 16 additions and 16 deletions

View file

@ -251,5 +251,5 @@ class FakeAnthropicMessagesStreamIterator:
def __del__(self) -> None:
try:
self.close()
except Exception:
except Exception: # noqa: BLE001 # destructors cannot safely propagate cleanup failures
pass

View file

@ -61,7 +61,7 @@ class MutableLifecycleHost(LifecycleHost, Protocol):
def advance_host(host: MutableLifecycleHost, outcome: NativeOutcome, error: BaseException | None) -> None:
if error is not None and host.end is None:
host.end = datetime.now()
host.end = datetime.now() # noqa: DTZ005 # lifecycle timestamps preserve Logging's naive timestamp contract
if host.logger is None:
host.logger = host.arguments.get(LOGGING_OBJECT_KEY)
replace: Final = host.machine.advance(
@ -103,7 +103,7 @@ async def deployment_failure(arguments: dict[str, object], error: BaseException
from litellm import utils
if not isinstance(error, Exception):
raise RuntimeError("native lifecycle failure did not retain an exception")
raise TypeError("native lifecycle failure did not retain an exception")
await utils.async_post_call_failure_deployment_hook(arguments, error, call_type)
@ -130,9 +130,9 @@ def drive_sync(host: LifecycleHost) -> object:
while host.machine.complete() is None:
try:
_invoke_sync(host)
except Exception as error:
except Exception as error: # noqa: BLE001 # lifecycle converts every ordinary host failure into a machine outcome
host.advance(NativeOutcome.FAILURE, error)
except BaseException as error:
except BaseException as error: # noqa: BLE001 # cancellation and interrupts must advance the machine as aborts
host.advance(NativeOutcome.ABORT, error)
else:
host.advance(NativeOutcome.SUCCESS)
@ -143,9 +143,9 @@ async def drive_async(host: LifecycleHost) -> object:
while host.machine.complete() is None:
try:
await _invoke_async(host)
except Exception as error:
except Exception as error: # noqa: BLE001 # lifecycle converts every ordinary host failure into a machine outcome
host.advance(NativeOutcome.FAILURE, error)
except BaseException as error:
except BaseException as error: # noqa: BLE001 # cancellation and interrupts must advance the machine as aborts
host.advance(NativeOutcome.ABORT, error)
else:
host.advance(NativeOutcome.SUCCESS)

View file

@ -624,7 +624,7 @@ class _ChatCompletionsHost:
self.state: object | None = None
self.response: object = None
self.error: BaseException | None = None
self.start: datetime = datetime.now()
self.start: datetime = datetime.now() # noqa: DTZ005 # Logging preserves the legacy naive timestamp contract
self.end: datetime | None = None
def invoke(self) -> tuple[bool, object]:
@ -648,14 +648,14 @@ class _ChatCompletionsHost:
if not isinstance(model_response, ModelResponse):
raise TypeError("chat completions model_response must be a ModelResponse")
self.response = build_model_response(self.bindings.send_sync(self.state), model_response)
self.end = datetime.now()
self.end = datetime.now() # noqa: DTZ005 # Logging preserves the legacy naive timestamp contract
async def send(self) -> None:
model_response: Final = self.arguments["model_response"]
if not isinstance(model_response, ModelResponse):
raise TypeError("chat completions model_response must be a ModelResponse")
self.response = build_model_response(await self.bindings.send(self.state), model_response)
self.end = datetime.now()
self.end = datetime.now() # noqa: DTZ005 # Logging preserves the legacy naive timestamp contract
async def deployment_success(self) -> None:
from litellm.types.utils import CallTypes

View file

@ -247,7 +247,7 @@ class _MessagesHost:
self.state: object | None = None
self.response: object = None
self.error: BaseException | None = None
self.start: datetime = datetime.now()
self.start: datetime = datetime.now() # noqa: DTZ005 # Logging preserves the legacy naive timestamp contract
self.end: datetime | None = None
self.streaming: bool = False
@ -272,11 +272,11 @@ class _MessagesHost:
def send_sync(self) -> None:
self.response = self.bindings.send_sync(self.state)
self.end = datetime.now()
self.end = datetime.now() # noqa: DTZ005 # Logging preserves the legacy naive timestamp contract
async def send(self) -> None:
self.response = await self.bindings.send(self.state)
self.end = datetime.now()
self.end = datetime.now() # noqa: DTZ005 # Logging preserves the legacy naive timestamp contract
async def deployment_success(self) -> None:
from litellm.types.utils import CallTypes

View file

@ -301,7 +301,7 @@ class _OcrHost:
self.state: object | None = None
self.response: object = None
self.error: BaseException | None = None
self.start: datetime = datetime.now()
self.start: datetime = datetime.now() # noqa: DTZ005 # Logging preserves the legacy naive timestamp contract
self.end: datetime | None = None
def invoke(self) -> tuple[bool, object]:
@ -331,11 +331,11 @@ class _OcrHost:
def send_sync(self) -> None:
self.response = self.bindings.send_sync(self.state)
self.end = datetime.now()
self.end = datetime.now() # noqa: DTZ005 # Logging preserves the legacy naive timestamp contract
async def send(self) -> None:
self.response = self.bindings.finish(await self.bindings.send(self.state))
self.end = datetime.now()
self.end = datetime.now() # noqa: DTZ005 # Logging preserves the legacy naive timestamp contract
async def deployment_success(self) -> None:
from litellm.types.utils import CallTypes