Skip to content

Commit 11a4357

Browse files
committed
chore: stylefixes
1 parent 899a631 commit 11a4357

File tree

9 files changed

+29
-24
lines changed

9 files changed

+29
-24
lines changed

sentry_sdk/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def __init__(self, dsn=None, *args, **kwargs):
3232

3333
for integration in options.get("integrations", None) or ():
3434
assert integration.identifier, "identifier of integration must be set"
35-
assert isinstance(integration.identifier, str), "identifier of integration must be a string"
35+
assert isinstance(
36+
integration.identifier, str
37+
), "identifier of integration must be a string"
3638
integration.install(self)
3739

3840
@property

sentry_sdk/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"environment": None,
1010
"server_name": DEFAULT_SERVER_NAME,
1111
"drain_timeout": 2.0,
12-
"integrations": []
12+
"integrations": [],
1313
}
1414

1515
SDK_INFO = {"name": "sentry-python", "version": VERSION}

sentry_sdk/integrations/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ def parse_environment(cls, environ):
1717
for key, value in environ.items():
1818
if not key.startswith("SENTRY_"):
1919
continue
20-
key = key[len("SENTRY_"):].replace("-","_").lower()
20+
key = key[len("SENTRY_") :].replace("-", "_").lower()
2121
identifier_prefix = "%s_" % cls.identifier
2222
if key.startswith(identifier_prefix):
23-
integration_options[key[len(identifier_prefix):]] = value
23+
integration_options[key[len(identifier_prefix) :]] = value
2424
else:
2525
client_options[key] = value
2626

sentry_sdk/integrations/django/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ def _install():
110110
if _installed:
111111
return
112112

113-
client_options, integration_options = \
114-
DjangoIntegration.parse_environment(dict(
115-
(key, getattr(settings, key)) for key in dir(settings)
116-
))
113+
client_options, integration_options = DjangoIntegration.parse_environment(
114+
dict((key, getattr(settings, key)) for key in dir(settings))
115+
)
117116

118-
client_options.setdefault("integrations", []) \
119-
.append(DjangoIntegration(**integration_options))
117+
client_options.setdefault("integrations", []).append(
118+
DjangoIntegration(**integration_options)
119+
)
120120

121121
init(**client_options)
122122
_installed = True
@@ -142,7 +142,7 @@ def _install_impl():
142142

143143

144144
class DjangoIntegration(Integration):
145-
identifier = 'django'
145+
identifier = "django"
146146

147147
def install(self, client):
148148
_install_impl()

sentry_sdk/integrations/flask.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@ class FlaskSentry(object):
1717
def __init__(self, app=None):
1818
self.app = app
1919
if app is not None:
20-
self.init_app(app, **options)
20+
self.init_app(app)
2121

22-
def init_app(self, app, setup_logger=True):
22+
def init_app(self, app):
2323
if not hasattr(app, "extensions"):
2424
app.extensions = {}
2525
elif app.extensions.get(__name__, None):
2626
raise RuntimeError("Sentry extension is already registered")
2727
app.extensions[__name__] = True
2828

29-
client_options, integration_options = \
30-
FlaskIntegration.parse_environment(app.config)
29+
client_options, integration_options = FlaskIntegration.parse_environment(
30+
app.config
31+
)
3132
integration = FlaskIntegration(app, **integration_options)
32-
client_options.setdefault('integrations', []).append(integration)
33+
client_options.setdefault("integrations", []).append(integration)
3334
init(**client_options)
3435

3536

@@ -43,12 +44,12 @@ def __init__(self, app, setup_logger=True):
4344
def install(self, client=None):
4445
appcontext_pushed.connect(self._push_appctx, sender=self._app)
4546
self._app.teardown_appcontext(self._pop_appctx)
46-
got_request_exception.connect(self._capture_exception,
47-
sender=self._app)
47+
got_request_exception.connect(self._capture_exception, sender=self._app)
4848
self._app.before_request(self._before_request)
4949

5050
if self._setup_logger:
5151
from .logging import HANDLER
52+
5253
self._app.logger.addHandler(HANDLER)
5354

5455
def _push_appctx(self, *args, **kwargs):

sentry_sdk/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,13 @@ def get_lines_from_file(filename, lineno, loader=None, module=None):
169169
upper_bound = min(lineno + 1 + context_lines, len(source))
170170

171171
try:
172-
pre_context = [slim_string(line.strip("\r\n")) for line in source[lower_bound:lineno]]
172+
pre_context = [
173+
slim_string(line.strip("\r\n")) for line in source[lower_bound:lineno]
174+
]
173175
context_line = slim_string(source[lineno].strip("\r\n"))
174176
post_context = [
175-
slim_string(line.strip("\r\n")) for line in source[(lineno + 1) : upper_bound]
177+
slim_string(line.strip("\r\n"))
178+
for line in source[(lineno + 1) : upper_bound]
176179
]
177180
return pre_context, context_line, post_context
178181
except IndexError:

tests/integrations/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sys
22
import pytest
33
import sentry_sdk
4-
from sentry_sdk.consts import DEFAULT_OPTIONS
54
from sentry_sdk.client import Client, Transport
65

76

@@ -18,7 +17,7 @@ def close(self):
1817
def capture_event(self, event):
1918
pass
2019

21-
dsn = 'LOL'
20+
dsn = "LOL"
2221

2322

2423
@pytest.fixture(autouse=True)

tests/integrations/django/myapp/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# SECURITY WARNING: keep the secret key used in production secret!
3232
SECRET_KEY = "u95e#xr$t3!vdux)fj11!*q*^w^^r#kiyrvt3kjui-t_k%m3op"
3333

34-
SENTRY_FOO = 'yes'
34+
SENTRY_FOO = "yes"
3535

3636
# SECURITY WARNING: don't run with debug turned on in production!
3737
DEBUG = True

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ basepython =
6060
py3.5: python3.5
6161
py3.6: python3.6
6262
py3.7: python3.7
63-
linters: python3.6
63+
linters: python3
6464
pypy: pypy
6565

6666
commands =

0 commit comments

Comments
 (0)