Skip to content

style: Reformat with black==24.1.0 #2680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: end-of-file-fixer

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 24.1.0
hooks:
- id: black
exclude: ^(.*_pb2.py|.*_pb2_grpc.py)
Expand Down
12 changes: 6 additions & 6 deletions sentry_sdk/integrations/arq.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ def event_processor(event, hint):
extra = event.setdefault("extra", {})
extra["arq-job"] = {
"task": ctx["job_name"],
"args": args
if _should_send_default_pii()
else SENSITIVE_DATA_SUBSTITUTE,
"kwargs": kwargs
if _should_send_default_pii()
else SENSITIVE_DATA_SUBSTITUTE,
"args": (
args if _should_send_default_pii() else SENSITIVE_DATA_SUBSTITUTE
),
"kwargs": (
kwargs if _should_send_default_pii() else SENSITIVE_DATA_SUBSTITUTE
),
"retry": ctx["job_try"],
}

Expand Down
16 changes: 10 additions & 6 deletions sentry_sdk/integrations/huey.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ def event_processor(event, hint):
extra = event.setdefault("extra", {})
extra["huey-job"] = {
"task": task.name,
"args": task.args
if _should_send_default_pii()
else SENSITIVE_DATA_SUBSTITUTE,
"kwargs": task.kwargs
if _should_send_default_pii()
else SENSITIVE_DATA_SUBSTITUTE,
"args": (
task.args
if _should_send_default_pii()
else SENSITIVE_DATA_SUBSTITUTE
),
"kwargs": (
task.kwargs
if _should_send_default_pii()
else SENSITIVE_DATA_SUBSTITUTE
),
"retry": (task.default_retries or 0) - task.retries,
}

Expand Down
1 change: 1 addition & 0 deletions sentry_sdk/integrations/opentelemetry/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
are experimental and not suitable for production use. They may be changed or
removed at any time without prior notice.
"""

import sys
from importlib import import_module

Expand Down
6 changes: 3 additions & 3 deletions sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ def get_dynamic_sampling_context(self):

baggage = self.get_baggage()
if baggage is not None:
self._propagation_context[
"dynamic_sampling_context"
] = baggage.dynamic_sampling_context()
self._propagation_context["dynamic_sampling_context"] = (
baggage.dynamic_sampling_context()
)

return self._propagation_context["dynamic_sampling_context"]

Expand Down
12 changes: 6 additions & 6 deletions sentry_sdk/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ def _serialize_node_impl(
should_repr_strings=should_repr_strings,
is_databag=is_databag,
is_request_body=is_request_body,
remaining_depth=remaining_depth - 1
if remaining_depth is not None
else None,
remaining_depth=(
remaining_depth - 1 if remaining_depth is not None else None
),
remaining_breadth=remaining_breadth,
)
rv_dict[str_k] = v
Expand All @@ -375,9 +375,9 @@ def _serialize_node_impl(
should_repr_strings=should_repr_strings,
is_databag=is_databag,
is_request_body=is_request_body,
remaining_depth=remaining_depth - 1
if remaining_depth is not None
else None,
remaining_depth=(
remaining_depth - 1 if remaining_depth is not None else None
),
remaining_breadth=remaining_breadth,
)
)
Expand Down
6 changes: 3 additions & 3 deletions sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,9 @@ def get_trace_context(self):
rv["status"] = self.status

if self.containing_transaction:
rv[
"dynamic_sampling_context"
] = self.containing_transaction.get_baggage().dynamic_sampling_context()
rv["dynamic_sampling_context"] = (
self.containing_transaction.get_baggage().dynamic_sampling_context()
)

return rv

Expand Down
1 change: 1 addition & 0 deletions tests/integrations/asyncpg/test_asyncpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

The tests use the following credentials to establish a database connection.
"""

import os


Expand Down
14 changes: 8 additions & 6 deletions tests/integrations/aws_lambda/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,14 @@ def repl(runtime, verbose):
_REPL_CODE.format(line=line),
b"",
cleanup.append,
subprocess_kwargs={
"stdout": subprocess.DEVNULL,
"stderr": subprocess.DEVNULL,
}
if not verbose
else {},
subprocess_kwargs=(
{
"stdout": subprocess.DEVNULL,
"stderr": subprocess.DEVNULL,
}
if not verbose
else {}
),
)

for line in base64.b64decode(response["LogResult"]).splitlines():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
docker run -d -p 18123:8123 -p9000:9000 --name clickhouse-test --ulimit nofile=262144:262144 --rm clickhouse/clickhouse-server
```
"""

import clickhouse_driver
from clickhouse_driver import Client, connect

Expand Down
1 change: 1 addition & 0 deletions tests/integrations/django/myapp/custom_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from __future__ import absolute_import

try:
Expand Down
1 change: 0 additions & 1 deletion tests/integrations/django/myapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
https://docs.djangoproject.com/en/2.0/ref/settings/
"""


# We shouldn't access settings while setting up integrations. Initialize SDK
# here to provoke any errors that might occur.
import sentry_sdk
Expand Down
1 change: 1 addition & 0 deletions tests/integrations/django/myapp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from __future__ import absolute_import

try:
Expand Down
1 change: 1 addition & 0 deletions tests/integrations/gcp/test_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# GCP Cloud Functions unit tests

"""

import json
from textwrap import dedent
import tempfile
Expand Down
8 changes: 5 additions & 3 deletions tests/integrations/starlette/test_starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,11 @@ def test_middleware_partial_receive_send(sentry_init, capture_events):
},
{
"op": "middleware.starlette.receive",
"description": "_ASGIAdapter.send.<locals>.receive"
if STARLETTE_VERSION < (0, 21)
else "_TestClientTransport.handle_request.<locals>.receive",
"description": (
"_ASGIAdapter.send.<locals>.receive"
if STARLETTE_VERSION < (0, 21)
else "_TestClientTransport.handle_request.<locals>.receive"
),
"tags": {"starlette.middleware_name": "ServerErrorMiddleware"},
},
{
Expand Down
40 changes: 25 additions & 15 deletions tests/test_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,11 @@ def static_method():
),
pytest.param(
GetFrame().instance_method_wrapped()(),
"wrapped"
if sys.version_info < (3, 11)
else "GetFrame.instance_method_wrapped.<locals>.wrapped",
(
"wrapped"
if sys.version_info < (3, 11)
else "GetFrame.instance_method_wrapped.<locals>.wrapped"
),
id="instance_method_wrapped",
),
pytest.param(
Expand All @@ -405,9 +407,11 @@ def static_method():
),
pytest.param(
GetFrame().class_method_wrapped()(),
"wrapped"
if sys.version_info < (3, 11)
else "GetFrame.class_method_wrapped.<locals>.wrapped",
(
"wrapped"
if sys.version_info < (3, 11)
else "GetFrame.class_method_wrapped.<locals>.wrapped"
),
id="class_method_wrapped",
),
pytest.param(
Expand All @@ -422,9 +426,11 @@ def static_method():
),
pytest.param(
GetFrame().inherited_instance_method_wrapped()(),
"wrapped"
if sys.version_info < (3, 11)
else "GetFrameBase.inherited_instance_method_wrapped.<locals>.wrapped",
(
"wrapped"
if sys.version_info < (3, 11)
else "GetFrameBase.inherited_instance_method_wrapped.<locals>.wrapped"
),
id="instance_method_wrapped",
),
pytest.param(
Expand All @@ -434,16 +440,20 @@ def static_method():
),
pytest.param(
GetFrame().inherited_class_method_wrapped()(),
"wrapped"
if sys.version_info < (3, 11)
else "GetFrameBase.inherited_class_method_wrapped.<locals>.wrapped",
(
"wrapped"
if sys.version_info < (3, 11)
else "GetFrameBase.inherited_class_method_wrapped.<locals>.wrapped"
),
id="inherited_class_method_wrapped",
),
pytest.param(
GetFrame().inherited_static_method(),
"inherited_static_method"
if sys.version_info < (3, 11)
else "GetFrameBase.inherited_static_method",
(
"inherited_static_method"
if sys.version_info < (3, 11)
else "GetFrameBase.inherited_static_method"
),
id="inherited_static_method",
),
],
Expand Down