Skip to content

Commit 540012a

Browse files
committed
Run ast-grep rule
1 parent 9bcdc1c commit 540012a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+219
-219
lines changed

sentry_sdk/_log_batcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(
2121
capture_func: "Callable[[Envelope], None]",
2222
record_lost_func: "Callable[..., None]",
2323
) -> None:
24-
self._log_buffer: List[Log] = []
24+
self._log_buffer: "List[Log]" = []
2525
self._capture_func = capture_func
2626
self._record_lost_func = record_lost_func
2727
self._running = True
@@ -115,7 +115,7 @@ def flush(self) -> None:
115115

116116
@staticmethod
117117
def _log_to_transport_format(log: "Log") -> "Any":
118-
def format_attribute(val: int | float | str | bool) -> Any:
118+
def format_attribute(val: int | float | str | bool) -> "Any":
119119
if isinstance(val, bool):
120120
return {"value": val, "type": "boolean"}
121121
if isinstance(val, int):

sentry_sdk/_metrics_batcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(
2121
capture_func: "Callable[[Envelope], None]",
2222
record_lost_func: "Callable[..., None]",
2323
) -> None:
24-
self._metric_buffer: List[Metric] = []
24+
self._metric_buffer: "List[Metric]" = []
2525
self._capture_func = capture_func
2626
self._record_lost_func = record_lost_func
2727
self._running = True
@@ -96,7 +96,7 @@ def flush(self) -> None:
9696

9797
@staticmethod
9898
def _metric_to_transport_format(metric: "Metric") -> "Any":
99-
def format_attribute(val: Union[int, float, str, bool]) -> Any:
99+
def format_attribute(val: "Union[int, float, str, bool]") -> "Any":
100100
if isinstance(val, bool):
101101
return {"value": val, "type": "boolean"}
102102
if isinstance(val, int):

sentry_sdk/_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def substituted_because_contains_sensitive_data(cls) -> "AnnotatedValue":
109109
class SDKInfo(TypedDict):
110110
name: str
111111
version: str
112-
packages: Sequence[Mapping[str, str]]
112+
packages: "Sequence[Mapping[str, str]]"
113113

114114
# "critical" is an alias of "fatal" recognized by Relay
115115
LogLevelStr = Literal["fatal", "critical", "error", "warning", "info", "debug"]

sentry_sdk/ai/monitoring.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def get_ai_pipeline_name() -> "Optional[str]":
2626

2727

2828
def ai_track(description: str, **span_kwargs: "Any") -> "Callable[[F], F]":
29-
def decorator(f: F) -> F:
30-
def sync_wrapped(*args: Any, **kwargs: Any) -> Any:
29+
def decorator(f: "F") -> "F":
30+
def sync_wrapped(*args: "Any", **kwargs: "Any") -> "Any":
3131
curr_pipeline = _ai_pipeline_name.get()
3232
op = span_kwargs.pop("op", "ai.run" if curr_pipeline else "ai.pipeline")
3333

sentry_sdk/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class BaseClient:
180180
spotlight: "Optional[SpotlightClient]" = None
181181

182182
def __init__(self, options: "Optional[Dict[str, Any]]" = None) -> None:
183-
self.options: Dict[str, Any] = (
183+
self.options: "Dict[str, Any]" = (
184184
options if options is not None else DEFAULT_OPTIONS
185185
)
186186

@@ -495,7 +495,7 @@ def _prepare_event(
495495
hint: "Hint",
496496
scope: "Optional[Scope]",
497497
) -> "Optional[Event]":
498-
previous_total_spans: Optional[int] = None
498+
previous_total_spans: "Optional[int]" = None
499499
previous_total_breadcrumbs: "Optional[int]" = None
500500

501501
if event.get("timestamp") is None:

sentry_sdk/crons/decorator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ def _async_wrapper(
122122
self, fn: "Callable[P, Awaitable[Any]]"
123123
) -> "Callable[P, Awaitable[Any]]":
124124
@wraps(fn)
125-
async def inner(*args: "P.args", **kwargs: "P.kwargs") -> R:
125+
async def inner(*args: "P.args", **kwargs: "P.kwargs") -> "R":
126126
with self:
127127
return await fn(*args, **kwargs)
128128

129129
return inner
130130

131131
def _sync_wrapper(self, fn: "Callable[P, R]") -> "Callable[P, R]":
132132
@wraps(fn)
133-
def inner(*args: "P.args", **kwargs: "P.kwargs") -> R:
133+
def inner(*args: "P.args", **kwargs: "P.kwargs") -> "R":
134134
with self:
135135
return fn(*args, **kwargs)
136136

sentry_sdk/integrations/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _generate_default_integrations_iterator(
2727
) -> "Callable[[bool], Iterator[Type[Integration]]]":
2828
def iter_default_integrations(
2929
with_auto_enabling_integrations: bool,
30-
) -> Iterator[Type[Integration]]:
30+
) -> "Iterator[Type[Integration]]":
3131
"""Returns an iterator of the default integration classes:"""
3232
from importlib import import_module
3333

sentry_sdk/integrations/aiohttp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ def init(*args: "Any", **kwargs: "Any") -> None:
219219

220220
def create_trace_config() -> "TraceConfig":
221221
async def on_request_start(
222-
session: ClientSession,
223-
trace_config_ctx: SimpleNamespace,
224-
params: TraceRequestStartParams,
222+
session: "ClientSession",
223+
trace_config_ctx: "SimpleNamespace",
224+
params: "TraceRequestStartParams",
225225
) -> None:
226226
if sentry_sdk.get_client().get_integration(AioHttpIntegration) is None:
227227
return
@@ -296,9 +296,9 @@ def _make_request_processor(
296296
weak_request: "weakref.ReferenceType[Request]",
297297
) -> "EventProcessor":
298298
def aiohttp_processor(
299-
event: Event,
300-
hint: dict[str, Tuple[type, BaseException, Any]],
301-
) -> Event:
299+
event: "Event",
300+
hint: "dict[str, Tuple[type, BaseException, Any]]",
301+
) -> "Event":
302302
request = weak_request()
303303
if request is None:
304304
return event

sentry_sdk/integrations/anthropic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ async def new_iterator_async() -> "AsyncIterator[MessageStreamEvent]":
374374

375375

376376
def _wrap_message_create(f: "Any") -> "Any":
377-
def _execute_sync(f: Any, *args: Any, **kwargs: Any) -> Any:
377+
def _execute_sync(f: "Any", *args: "Any", **kwargs: "Any") -> "Any":
378378
gen = _sentry_patched_create_common(f, *args, **kwargs)
379379

380380
try:
@@ -410,7 +410,7 @@ def _sentry_patched_create_sync(*args: "Any", **kwargs: "Any") -> "Any":
410410

411411

412412
def _wrap_message_create_async(f: "Any") -> "Any":
413-
async def _execute_async(f: Any, *args: Any, **kwargs: Any) -> Any:
413+
async def _execute_async(f: "Any", *args: "Any", **kwargs: "Any") -> "Any":
414414
gen = _sentry_patched_create_common(f, *args, **kwargs)
415415

416416
try:

sentry_sdk/integrations/argv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ArgvIntegration(Integration):
1818
@staticmethod
1919
def setup_once() -> None:
2020
@add_global_event_processor
21-
def processor(event: Event, hint: Optional[Hint]) -> Optional[Event]:
21+
def processor(event: "Event", hint: "Optional[Hint]") -> "Optional[Event]":
2222
if sentry_sdk.get_client().get_integration(ArgvIntegration) is not None:
2323
extra = event.setdefault("extra", {})
2424
# If some event processor decided to set extra to e.g. an

0 commit comments

Comments
 (0)