Skip to content

Commit a12d33c

Browse files
Merge remote-tracking branch 'origin/master' into ci/ruff-inline-imports
# Conflicts: # pyproject.toml # sentry_sdk/integrations/spark/spark_driver.py # sentry_sdk/integrations/threading.py
2 parents 81c5110 + 4c1a136 commit a12d33c

49 files changed

Lines changed: 190 additions & 205 deletions

Some content is hidden

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

‎pyproject.toml‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ disallow_incomplete_defs = true
146146
disallow_subclassing_any = true
147147
disallow_untyped_decorators = true
148148
disallow_untyped_defs = true
149+
enable_error_code = ["unused-awaitable"]
149150
no_implicit_optional = true
150151
python_version = "3.11"
151152
strict_equality = true
@@ -299,11 +300,10 @@ select = [
299300
"W", # pycodestyle warnings (same as flake8 default)
300301
"F", # Pyflakes (same as flake8 default)
301302
"I",
302-
# Note: B and N rules are NOT enabled by default in flake8
303-
# They were only active through the plugins, which may not have been fully enabled
304303
"T20", # print() and pprint() calls
305304
"PT011", # pytest.raises() too broad
306305
"PLC0415", # Import not at the top level of the file
306+
"RUF100", # Unused noqa directive
307307
]
308308

309309
# Use ONLY the same ignores as the original flake8 config + compatibility for this codebase
@@ -312,9 +312,6 @@ ignore = [
312312
"E501", # Line too long
313313
"E402", # Module level import not at top of file
314314
"E731", # Do not assign a lambda expression, use a def
315-
"B014", # Redundant exception types
316-
"N812", # Lowercase imported as non-lowercase
317-
"N804", # First argument of classmethod should be named cls
318315

319316
# Additional ignores for codebase compatibility
320317
"E721", # Use isinstance instead of type() == - existing pattern in this codebase

‎sentry_sdk/_init_implementation.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _init(*args: "Optional[str]", **kwargs: "Any") -> "ContextManager[Any]":
6767
# Use `ClientConstructor` to define the argument types of `init` and
6868
# `ContextManager[Any]` to tell static analyzers about the return type.
6969

70-
class init(sentry_sdk.consts.ClientConstructor, _InitGuard): # noqa: N801
70+
class init(sentry_sdk.consts.ClientConstructor, _InitGuard):
7171
pass
7272

7373
else:

‎sentry_sdk/client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ async def __aexit__(self, exc_type: "Any", exc_value: "Any", tb: "Any") -> None:
15591559
# Use `ClientConstructor` to define the argument types of `init` and
15601560
# `Dict[str, Any]` to tell static analyzers about the return type.
15611561

1562-
class get_options(ClientConstructor, Dict[str, Any]): # noqa: N801
1562+
class get_options(ClientConstructor, Dict[str, Any]):
15631563
pass
15641564

15651565
class Client(ClientConstructor, _Client):

‎sentry_sdk/consts.py‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,10 +1389,10 @@ def __init__(
13891389
environment: "Optional[str]" = None,
13901390
server_name: "Optional[str]" = None,
13911391
shutdown_timeout: float = 2,
1392-
integrations: "Sequence[sentry_sdk.integrations.Integration]" = [], # noqa: B006
1392+
integrations: "Sequence[sentry_sdk.integrations.Integration]" = [],
13931393
ignore_spans: "Optional[IgnoreSpansConfig]" = None,
1394-
in_app_include: "List[str]" = [], # noqa: B006
1395-
in_app_exclude: "List[str]" = [], # noqa: B006
1394+
in_app_include: "List[str]" = [],
1395+
in_app_exclude: "List[str]" = [],
13961396
default_integrations: bool = True,
13971397
dist: "Optional[str]" = None,
13981398
transport: "Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]]" = None,
@@ -1402,7 +1402,7 @@ def __init__(
14021402
data_collection: "Optional[DataCollectionUserOptions]" = None,
14031403
http_proxy: "Optional[str]" = None,
14041404
https_proxy: "Optional[str]" = None,
1405-
ignore_errors: "Sequence[Union[type, str]]" = [], # noqa: B006
1405+
ignore_errors: "Sequence[Union[type, str]]" = [],
14061406
max_request_body_size: str = "medium",
14071407
socket_options: "Optional[List[Tuple[int, int, int | bytes]]]" = None,
14081408
keep_alive: "Optional[bool]" = None,
@@ -1424,18 +1424,16 @@ def __init__(
14241424
disabled_integrations: "Optional[Sequence[Union[sentry_sdk.integrations.Integration, type[sentry_sdk.integrations.Integration]]]]" = None,
14251425
auto_session_tracking: bool = True,
14261426
send_client_reports: bool = True,
1427-
_experiments: "Experiments" = {}, # noqa: B006
1427+
_experiments: "Experiments" = {},
14281428
proxy_headers: "Optional[Dict[str, str]]" = None,
14291429
instrumenter: "Optional[str]" = INSTRUMENTER.SENTRY,
14301430
before_send_transaction: "Optional[TransactionProcessor]" = None,
14311431
project_root: "Optional[str]" = None,
14321432
enable_tracing: "Optional[bool]" = None,
14331433
include_local_variables: "Optional[bool]" = True,
14341434
include_source_context: "Optional[bool]" = True,
1435-
trace_propagation_targets: "Optional[Sequence[str]]" = [ # noqa: B006
1436-
MATCH_ALL
1437-
],
1438-
functions_to_trace: "Sequence[Dict[str, str]]" = [], # noqa: B006
1435+
trace_propagation_targets: "Optional[Sequence[str]]" = [MATCH_ALL],
1436+
functions_to_trace: "Sequence[Dict[str, str]]" = [],
14391437
event_scrubber: "Optional[sentry_sdk.scrubber.EventScrubber]" = None,
14401438
max_value_length: "Optional[int]" = DEFAULT_MAX_VALUE_LENGTH,
14411439
enable_backpressure_handling: bool = True,

‎sentry_sdk/crons/decorator.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
R = TypeVar("R")
2727

2828

29-
class monitor: # noqa: N801
29+
class monitor:
3030
"""
3131
Decorator/context manager to capture checkin events for a monitor.
3232

‎sentry_sdk/integrations/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def _check_minimum_version(
314314
return
315315

316316

317-
class DidNotEnable(Exception): # noqa: N818
317+
class DidNotEnable(Exception):
318318
"""
319319
The integration could not be enabled due to a trivial user error like
320320
`flask` not being installed for the `FlaskIntegration`.

‎sentry_sdk/integrations/asgi.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _looks_like_asgi3(app: "Any") -> bool:
9797
elif inspect.isfunction(app):
9898
return iscoroutinefunction(app)
9999
else:
100-
call = getattr(app, "__call__", None) # noqa
100+
call = getattr(app, "__call__", None)
101101
return iscoroutinefunction(call)
102102

103103

‎sentry_sdk/integrations/cloud_resource_context.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
)
2828

2929

30-
class CLOUD_PROVIDER: # noqa: N801
30+
class CLOUD_PROVIDER:
3131
"""
3232
Name of the cloud provider.
3333
see https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/cloud/
@@ -41,7 +41,7 @@ class CLOUD_PROVIDER: # noqa: N801
4141
TENCENT = "tencent_cloud"
4242

4343

44-
class CLOUD_PLATFORM: # noqa: N801
44+
class CLOUD_PLATFORM:
4545
"""
4646
The cloud platform.
4747
see https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/cloud/

‎sentry_sdk/integrations/litestar.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def resolve_middleware_wrapper(self: "BaseRouteHandler") -> "list[Middleware]":
144144

145145
def enable_span_for_middleware(middleware: "Middleware") -> "Middleware":
146146
if (
147-
not hasattr(middleware, "__call__") # noqa: B004
147+
not hasattr(middleware, "__call__")
148148
or middleware is SentryLitestarASGIMiddleware
149149
):
150150
return middleware

‎sentry_sdk/integrations/redis/redis.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def _get_redis_command_args(command: "Any") -> "Sequence[Any]":
2020
return command[0]
2121

2222

23-
def _patch_redis(StrictRedis: "Any", client: "Any") -> None: # noqa: N803
23+
def _patch_redis(StrictRedis: "Any", client: "Any") -> None:
2424
patch_redis_client(
2525
StrictRedis,
2626
is_cluster=False,

0 commit comments

Comments
 (0)