chore(guardrails): use PEP 604 union for event_hook param

The strict gate's UP007 ceiling dropped on the new base; convert the event_hook
Union[...] annotation to X | Y and drop the now-unused Union import.
This commit is contained in:
lior-k 2026-07-05 16:43:53 +03:00
parent 13f889555d
commit 73dfe12839
No known key found for this signature in database

View file

@ -3,7 +3,7 @@
import logging
import os
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
from typing import TYPE_CHECKING, Any, Literal, Optional
from fastapi import HTTPException
@ -77,7 +77,7 @@ class WonderFenceGuardrail(CustomGuardrail):
max_cached_clients: int | None = None,
connection_pool_limit: int | None = None,
allow_request_metadata_override: bool = False,
event_hook: (Union[GuardrailEventHooks, list[GuardrailEventHooks], Mode] | None) = None,
event_hook: (GuardrailEventHooks | list[GuardrailEventHooks] | Mode | None) = None,
default_on: bool = True,
**kwargs: Any,
) -> None: