Skip to content

Commit 8d08a77

Browse files
Merge remote-tracking branch 'origin/master' into ci/mypy-redundant-expr
Co-Authored-By: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com> # Conflicts: # pyproject.toml
2 parents b1803a8 + 4c1a136 commit 8d08a77

49 files changed

Lines changed: 190 additions & 206 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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +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 = ["redundant-expr"]
149+
enable_error_code = ["redundant-expr", "unused-awaitable"]
150150
no_implicit_optional = true
151151
python_version = "3.11"
152152
strict_equality = true
@@ -300,10 +300,9 @@ select = [
300300
"W", # pycodestyle warnings (same as flake8 default)
301301
"F", # Pyflakes (same as flake8 default)
302302
"I",
303-
# Note: B and N rules are NOT enabled by default in flake8
304-
# They were only active through the plugins, which may not have been fully enabled
305303
"T20", # print() and pprint() calls
306304
"PT011", # pytest.raises() too broad
305+
"RUF100", # Unused noqa directive
307306
]
308307

309308
# Use ONLY the same ignores as the original flake8 config + compatibility for this codebase
@@ -312,9 +311,6 @@ ignore = [
312311
"E501", # Line too long
313312
"E402", # Module level import not at top of file
314313
"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
318314

319315
# Additional ignores for codebase compatibility
320316
"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
@@ -1558,7 +1558,7 @@ async def __aexit__(self, exc_type: "Any", exc_value: "Any", tb: "Any") -> None:
15581558
# Use `ClientConstructor` to define the argument types of `init` and
15591559
# `Dict[str, Any]` to tell static analyzers about the return type.
15601560

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

15641564
class Client(ClientConstructor, _Client):

‎sentry_sdk/consts.py‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,10 +1388,10 @@ def __init__(
13881388
environment: "Optional[str]" = None,
13891389
server_name: "Optional[str]" = None,
13901390
shutdown_timeout: float = 2,
1391-
integrations: "Sequence[sentry_sdk.integrations.Integration]" = [], # noqa: B006
1391+
integrations: "Sequence[sentry_sdk.integrations.Integration]" = [],
13921392
ignore_spans: "Optional[IgnoreSpansConfig]" = None,
1393-
in_app_include: "List[str]" = [], # noqa: B006
1394-
in_app_exclude: "List[str]" = [], # noqa: B006
1393+
in_app_include: "List[str]" = [],
1394+
in_app_exclude: "List[str]" = [],
13951395
default_integrations: bool = True,
13961396
dist: "Optional[str]" = None,
13971397
transport: "Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]]" = None,
@@ -1401,7 +1401,7 @@ def __init__(
14011401
data_collection: "Optional[DataCollectionUserOptions]" = None,
14021402
http_proxy: "Optional[str]" = None,
14031403
https_proxy: "Optional[str]" = None,
1404-
ignore_errors: "Sequence[Union[type, str]]" = [], # noqa: B006
1404+
ignore_errors: "Sequence[Union[type, str]]" = [],
14051405
max_request_body_size: str = "medium",
14061406
socket_options: "Optional[List[Tuple[int, int, int | bytes]]]" = None,
14071407
keep_alive: "Optional[bool]" = None,
@@ -1423,18 +1423,16 @@ def __init__(
14231423
disabled_integrations: "Optional[Sequence[Union[sentry_sdk.integrations.Integration, type[sentry_sdk.integrations.Integration]]]]" = None,
14241424
auto_session_tracking: bool = True,
14251425
send_client_reports: bool = True,
1426-
_experiments: "Experiments" = {}, # noqa: B006
1426+
_experiments: "Experiments" = {},
14271427
proxy_headers: "Optional[Dict[str, str]]" = None,
14281428
instrumenter: "Optional[str]" = INSTRUMENTER.SENTRY,
14291429
before_send_transaction: "Optional[TransactionProcessor]" = None,
14301430
project_root: "Optional[str]" = None,
14311431
enable_tracing: "Optional[bool]" = None,
14321432
include_local_variables: "Optional[bool]" = True,
14331433
include_source_context: "Optional[bool]" = True,
1434-
trace_propagation_targets: "Optional[Sequence[str]]" = [ # noqa: B006
1435-
MATCH_ALL
1436-
],
1437-
functions_to_trace: "Sequence[Dict[str, str]]" = [], # noqa: B006
1434+
trace_propagation_targets: "Optional[Sequence[str]]" = [MATCH_ALL],
1435+
functions_to_trace: "Sequence[Dict[str, str]]" = [],
14381436
event_scrubber: "Optional[sentry_sdk.scrubber.EventScrubber]" = None,
14391437
max_value_length: "Optional[int]" = DEFAULT_MAX_VALUE_LENGTH,
14401438
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
@@ -315,7 +315,7 @@ def _check_minimum_version(
315315
return
316316

317317

318-
class DidNotEnable(Exception): # noqa: N818
318+
class DidNotEnable(Exception):
319319
"""
320320
The integration could not be enabled due to a trivial user error like
321321
`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)