Skip to content

Commit 64c0987

Browse files
authored
Upgraded linting tooling (#2026)
* Upgraded linting tooling and fixed the typing errors * Upgraded ci python version for linting
1 parent a2e1288 commit 64c0987

File tree

13 files changed

+17
-17
lines changed

13 files changed

+17
-17
lines changed

Diff for: .github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- uses: actions/checkout@v3
2727
- uses: actions/setup-python@v4
2828
with:
29-
python-version: 3.9
29+
python-version: 3.11
3030

3131
- run: |
3232
pip install tox

Diff for: linter-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mypy==0.971
1+
mypy==1.2.0
22
black==22.12.0
33
flake8==5.0.4
44
types-certifi

Diff for: mypy.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[mypy]
2-
python_version = 3.7
2+
python_version = 3.11
33
allow_redefinition = True
44
check_untyped_defs = True
55
; disallow_any_decorated = True

Diff for: sentry_sdk/integrations/asyncio.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def _coro_creating_hub_and_span():
4747

4848
# Trying to use user set task factory (if there is one)
4949
if orig_task_factory:
50-
return orig_task_factory(loop, _coro_creating_hub_and_span()) # type: ignore
50+
return orig_task_factory(loop, _coro_creating_hub_and_span())
5151

5252
# The default task factory in `asyncio` does not have its own function
5353
# but is just a couple of lines in `asyncio.base_events.create_task()`

Diff for: sentry_sdk/integrations/celery.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

3535
try:
36-
from celery import VERSION as CELERY_VERSION
36+
from celery import VERSION as CELERY_VERSION # type: ignore
3737
from celery import Task, Celery
3838
from celery.app.trace import task_has_custom
3939
from celery.beat import Scheduler # type: ignore

Diff for: sentry_sdk/integrations/django/signals_handlers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def _get_receiver_name(receiver):
2626
elif hasattr(
2727
receiver, "func"
2828
): # certain functions (like partials) dont have a name
29-
if hasattr(receiver, "func") and hasattr(receiver.func, "__name__"): # type: ignore
30-
name = "partial(<function " + receiver.func.__name__ + ">)" # type: ignore
29+
if hasattr(receiver, "func") and hasattr(receiver.func, "__name__"):
30+
name = "partial(<function " + receiver.func.__name__ + ">)"
3131

3232
if (
3333
name == ""

Diff for: sentry_sdk/integrations/socket.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def create_connection(
6565
address=address, timeout=timeout, source_address=source_address
6666
)
6767

68-
socket.create_connection = create_connection
68+
socket.create_connection = create_connection # type: ignore
6969

7070

7171
def _patch_getaddrinfo():
@@ -86,4 +86,4 @@ def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
8686

8787
return real_getaddrinfo(host, port, family, type, proto, flags)
8888

89-
socket.getaddrinfo = getaddrinfo
89+
socket.getaddrinfo = getaddrinfo # type: ignore

Diff for: sentry_sdk/integrations/tornado.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async def sentry_execute_request_handler(self, *args, **kwargs):
7878
else:
7979

8080
@coroutine # type: ignore
81-
def sentry_execute_request_handler(self, *args, **kwargs): # type: ignore
81+
def sentry_execute_request_handler(self, *args, **kwargs):
8282
# type: (RequestHandler, *Any, **Any) -> Any
8383
with _handle_request_impl(self):
8484
result = yield from old_execute(self, *args, **kwargs)

Diff for: sentry_sdk/integrations/wsgi.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
WsgiExcInfo = TypeVar("WsgiExcInfo")
3535

3636
class StartResponse(Protocol):
37-
def __call__(self, status, response_headers, exc_info=None):
37+
def __call__(self, status, response_headers, exc_info=None): # type: ignore
3838
# type: (str, WsgiResponseHeaders, Optional[WsgiExcInfo]) -> WsgiResponseIter
3939
pass
4040

@@ -119,7 +119,7 @@ def __call__(self, environ, start_response):
119119
return _ScopedResponse(hub, rv)
120120

121121

122-
def _sentry_start_response(
122+
def _sentry_start_response( # type: ignore
123123
old_start_response, # type: StartResponse
124124
transaction, # type: Transaction
125125
status, # type: str

Diff for: sentry_sdk/profiler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def extract_frame(frame, cwd):
346346

347347
def get_frame_name(frame):
348348
# type: (FrameType) -> str
349-
return frame.f_code.co_qualname # type: ignore
349+
return frame.f_code.co_qualname
350350

351351
else:
352352

Diff for: sentry_sdk/tracing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ def start_child(self, instrumenter=INSTRUMENTER.SENTRY, **kwargs):
781781

782782
def new_span(self, **kwargs):
783783
# type: (**Any) -> NoOpSpan
784-
pass
784+
return self.start_child(**kwargs)
785785

786786
def set_tag(self, key, value):
787787
# type: (str, Any) -> None

Diff for: sentry_sdk/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1077,10 +1077,10 @@ def qualname_from_function(func):
10771077
if (
10781078
_PARTIALMETHOD_AVAILABLE
10791079
and hasattr(func, "_partialmethod")
1080-
and isinstance(func._partialmethod, partialmethod) # type: ignore
1080+
and isinstance(func._partialmethod, partialmethod)
10811081
):
10821082
prefix, suffix = "partialmethod(<function ", ">)"
1083-
func = func._partialmethod.func # type: ignore
1083+
func = func._partialmethod.func
10841084
elif isinstance(func, partial) and hasattr(func.func, "__name__"):
10851085
prefix, suffix = "partial(<function ", ">)"
10861086
func = func.func

Diff for: tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ basepython =
500500
# some random Python 3 binary, but then you get guaranteed mismatches with
501501
# CI. Other tools such as mypy and black have options that pin the Python
502502
# version.
503-
linters: python3.9
503+
linters: python3.11
504504

505505
commands =
506506
; https://github.com/pytest-dev/pytest/issues/5532

0 commit comments

Comments
 (0)