Skip to content

Commit c7e2c7f

Browse files
committed
chore: stylefixes
1 parent 5b6ad39 commit c7e2c7f

File tree

6 files changed

+22
-16
lines changed

6 files changed

+22
-16
lines changed

sentry_sdk/integrations/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
def register_integration(identifier, integration=None):
66
def inner(integration):
77
if _locked:
8-
raise ValueError("A client has already been initialized. "
9-
"Registration of integrations no longer possible")
8+
raise ValueError(
9+
"A client has already been initialized. "
10+
"Registration of integrations no longer possible"
11+
)
1012
if identifier in _integrations:
1113
raise ValueError("Integration with that name already exists.")
1214
_integrations[identifier] = integration
@@ -22,19 +24,22 @@ def get_integration(identifier):
2224
return _integrations[identifier]
2325

2426

25-
@register_integration('django')
27+
@register_integration("django")
2628
def _django_integration(*a, **kw):
2729
from .django import install
30+
2831
return install(*a, **kw)
2932

3033

31-
@register_integration('flask')
34+
@register_integration("flask")
3235
def _flask_integration(*a, **kw):
3336
from .flask import install
37+
3438
return install(*a, **kw)
3539

3640

37-
@register_integration('celery')
41+
@register_integration("celery")
3842
def _celery_integration(*a, **kw):
3943
from .celery import install
44+
4045
return install(*a, **kw)

sentry_sdk/integrations/django/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
except ImportError:
1111
from django.core.urlresolvers import resolve
1212

13-
from sentry_sdk import get_current_hub, configure_scope, capture_exception, init
13+
from sentry_sdk import get_current_hub, configure_scope, capture_exception
1414
from .._wsgi import RequestExtractor
1515

1616

@@ -121,7 +121,6 @@ def sentry_patched_getattr(self, key):
121121
except AttributeError:
122122
rv = []
123123

124-
125124
rv = type(rv)([MIDDLEWARE_NAME]) + rv
126125
elif key == "INSTALLED_APPS":
127126
try:
@@ -138,7 +137,6 @@ def sentry_patched_getattr(self, key):
138137
self.__dict__[key] = rv
139138
return rv
140139

141-
142140
type(settings).__getattr__ = sentry_patched_getattr
143141

144142
signals.request_finished.connect(_request_finished)

sentry_sdk/integrations/flask.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22

33
from threading import Lock
44

5-
from sentry_sdk import capture_exception, configure_scope, get_current_hub, init
5+
from sentry_sdk import capture_exception, get_current_hub
66
from ._wsgi import RequestExtractor
77

88
try:
99
from flask_login import current_user
1010
except ImportError:
1111
current_user = None
1212

13-
from flask import request, _app_ctx_stack
14-
from flask.signals import appcontext_pushed, appcontext_tearing_down, got_request_exception
13+
from flask import request
14+
from flask.signals import (
15+
appcontext_pushed,
16+
appcontext_tearing_down,
17+
got_request_exception,
18+
)
1519

1620

1721
_installer_lock = Lock()
@@ -30,15 +34,16 @@ def install(client):
3034

3135
_installed = True
3236

37+
3338
def _push_appctx(*args, **kwargs):
3439
get_current_hub().push_scope()
40+
get_current_hub().add_event_processor(lambda: _event_processor)
3541

36-
with configure_scope() as scope:
37-
get_current_hub().add_event_processor(lambda: _event_processor)
3842

3943
def _pop_appctx(*args, **kwargs):
4044
get_current_hub().pop_scope_unsafe()
4145

46+
4247
def _capture_exception(sender, exception, **kwargs):
4348
capture_exception(exception)
4449

tests/integrations/celery/test_celery.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
import sentry_sdk
32
from sentry_sdk import Client, get_current_hub
43

54
pytest.importorskip("celery")

tests/integrations/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from sentry_sdk.client import Transport
66

7+
78
class TestTransport(Transport):
89
def __init__(self):
910
pass

tests/integrations/django/myapp/settings.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,4 @@ def process_response(self, request, response):
129129

130130
STATIC_URL = "/static/"
131131

132-
133-
import sentry_sdk
134132
sentry_sdk.get_current_hub().bind_client(sentry_sdk.Client(integrations=["django"]))

0 commit comments

Comments
 (0)