Skip to content

Commit 71e5cfa

Browse files
committed
fix: Update mypy
1 parent 880b860 commit 71e5cfa

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

sentry_sdk/integrations/celery.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
from sentry_sdk._compat import reraise
1616
from sentry_sdk.integrations import Integration
1717
from sentry_sdk.integrations.logging import ignore_logger
18+
from sentry_sdk._types import MYPY
19+
20+
if MYPY:
21+
from typing import Any
1822

1923

2024
CELERY_CONTROL_FLOW_EXCEPTIONS = (Retry, Ignore, Reject)
@@ -156,9 +160,12 @@ def _capture_exception(task, exc_info):
156160
if hasattr(task, "throws") and isinstance(exc_info[1], task.throws):
157161
return
158162

163+
# If an integration is there, a client has to be there.
164+
client = hub.client # type: Any
165+
159166
event, hint = event_from_exception(
160167
exc_info,
161-
client_options=hub.client.options,
168+
client_options=client.options,
162169
mechanism={"type": "celery", "handled": False},
163170
)
164171

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ deps =
130130
linters: black
131131
linters: flake8
132132
linters: flake8-import-order
133-
linters: mypy
133+
linters: mypy>=0.720
134134

135135
# https://github.com/PyCQA/flake8-bugbear/pull/77
136136
linters: git+https://github.com/untitaker/flake8-bugbear#branch=fix/b901-yield-expr

0 commit comments

Comments
 (0)