File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from contextlib import contextmanager
12import json
23from copy import deepcopy
34
5152)
5253
5354
55+ # This noop context manager can be replaced with "from contextlib import nullcontext" when we drop Python 3.6 support
56+ @contextmanager
57+ def nullcontext () -> "Iterator[None]" :
58+ yield
59+
60+
5461def request_body_within_bounds (
5562 client : "Optional[sentry_sdk.client.BaseClient]" , content_length : int
5663) -> bool :
Original file line number Diff line number Diff line change 1919)
2020from sentry_sdk .integrations ._wsgi_common import (
2121 DEFAULT_HTTP_METHODS_TO_CAPTURE ,
22+ nullcontext ,
2223)
2324from sentry_sdk .sessions import track_session
2425from sentry_sdk .tracing import (
3334 logger ,
3435 transaction_from_function ,
3536 _get_installed_modules ,
36- nullcontext ,
3737)
3838from sentry_sdk .tracing import Transaction
3939
Original file line number Diff line number Diff line change 1010import inspect
1111from functools import wraps
1212from typing import TYPE_CHECKING
13+ from contextlib import nullcontext
1314
1415import sentry_sdk
1516from sentry_sdk .ai .utils import get_start_span_function
1617from sentry_sdk .consts import OP , SPANDATA
1718from sentry_sdk .integrations import Integration , DidNotEnable
1819from sentry_sdk .utils import safe_serialize
1920from sentry_sdk .scope import should_send_default_pii
20- from sentry_sdk .utils import nullcontext
2121
2222try :
2323 from mcp .server .lowlevel import Server # type: ignore[import-not-found]
Original file line number Diff line number Diff line change @@ -2108,9 +2108,3 @@ def serialize_attribute(val: "AttributeValue") -> "SerializedAttributeValue":
21082108 # Coerce to string if we don't know what to do with the value. This should
21092109 # never happen as we pre-format early in format_attribute, but let's be safe.
21102110 return {"value" : safe_repr (val ), "type" : "string" }
2111-
2112-
2113- # This noop context manager can be replaced with "from contextlib import nullcontext" when we drop Python 3.6 support
2114- @contextmanager
2115- def nullcontext () -> "Iterator[None]" :
2116- yield
You can’t perform that action at this time.
0 commit comments