Skip to content

Commit

Permalink
ref: upgrade linters to flake8 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile-sentry committed Sep 12, 2022
1 parent 033b236 commit 8b0b539
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ repos:
hooks:
- id: black

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8

Expand Down
6 changes: 3 additions & 3 deletions linter-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
black==22.3.0
flake8==3.9.2
flake8==5.0.4
flake8-import-order==0.18.1
mypy==0.961
types-certifi
types-redis
types-setuptools
flake8-bugbear==21.4.3
pep8-naming==0.13.0
flake8-bugbear==22.9.11
pep8-naming==0.13.2
pre-commit # local linting
4 changes: 2 additions & 2 deletions sentry_sdk/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
PY2 = sys.version_info[0] == 2

if PY2:
import urlparse # noqa
import urlparse

text_type = unicode # noqa

Expand All @@ -39,7 +39,7 @@ def implements_str(cls):
text_type = str
string_types = (text_type,) # type: Tuple[type]
number_types = (int, float) # type: Tuple[type, type]
int_types = (int,) # noqa
int_types = (int,)
iteritems = lambda x: x.items()

def implements_str(x):
Expand Down
14 changes: 7 additions & 7 deletions sentry_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def add_breadcrumb(


@overload
def configure_scope(): # noqa: F811
def configure_scope():
# type: () -> ContextManager[Scope]
pass

Expand All @@ -130,7 +130,7 @@ def configure_scope( # noqa: F811


@overload
def push_scope(): # noqa: F811
def push_scope():
# type: () -> ContextManager[Scope]
pass

Expand All @@ -151,31 +151,31 @@ def push_scope( # noqa: F811
return Hub.current.push_scope(callback)


@scopemethod # noqa
@scopemethod
def set_tag(key, value):
# type: (str, Any) -> None
return Hub.current.scope.set_tag(key, value)


@scopemethod # noqa
@scopemethod
def set_context(key, value):
# type: (str, Dict[str, Any]) -> None
return Hub.current.scope.set_context(key, value)


@scopemethod # noqa
@scopemethod
def set_extra(key, value):
# type: (str, Any) -> None
return Hub.current.scope.set_extra(key, value)


@scopemethod # noqa
@scopemethod
def set_user(value):
# type: (Optional[Dict[str, Any]]) -> None
return Hub.current.scope.set_user(value)


@scopemethod # noqa
@scopemethod
def set_level(value):
# type: (str) -> None
return Hub.current.scope.set_level(value)
Expand Down
6 changes: 3 additions & 3 deletions sentry_sdk/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def start_transaction(
return transaction

@overload
def push_scope( # noqa: F811
def push_scope(
self, callback=None # type: Optional[None]
):
# type: (...) -> ContextManager[Scope]
Expand Down Expand Up @@ -595,7 +595,7 @@ def pop_scope_unsafe(self):
return rv

@overload
def configure_scope( # noqa: F811
def configure_scope(
self, callback=None # type: Optional[None]
):
# type: (...) -> ContextManager[Scope]
Expand All @@ -610,7 +610,7 @@ def configure_scope( # noqa: F811

def configure_scope( # noqa
self, callback=None # type: Optional[Callable[[Scope], None]]
): # noqa
):
# type: (...) -> Optional[ContextManager[Scope]]

"""
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/serverless.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def overload(x):


@overload
def serverless_function(f, flush=True): # noqa: F811
def serverless_function(f, flush=True):
# type: (F, bool) -> F
pass

Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

try:
# Optional dependency of Starlette to parse form data.
import multipart # type: ignore # noqa: F401
import multipart # type: ignore
except ImportError:
multipart = None

Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from sentry_sdk.utils import logger

if PY2:
import thread # noqa
import thread
else:
import threading

Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ def _get_contextvars():
# `aiocontextvars` is absolutely required for functional
# contextvars on Python 3.6.
try:
from aiocontextvars import ContextVar # noqa
from aiocontextvars import ContextVar

return True, ContextVar
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def __init__(self, substring):
try:
# the `unicode` type only exists in python 2, so if this blows up,
# we must be in py3 and have the `bytes` type
self.valid_types = (str, unicode) # noqa
self.valid_types = (str, unicode)
except NameError:
self.valid_types = (str, bytes)

Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/aiohttp/test_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ async def test_traces_sampler_gets_request_object_in_sampling_context(
sentry_init,
aiohttp_client,
DictionaryContaining, # noqa:N803
ObjectDescribedBy, # noqa:N803
ObjectDescribedBy,
):
traces_sampler = mock.Mock()
sentry_init(
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/aws_lambda/test_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,8 @@ def test_handler(event, context):
def test_traces_sampler_gets_correct_values_in_sampling_context(
run_lambda_function,
DictionaryContaining, # noqa:N803
ObjectDescribedBy, # noqa:N803
StringContaining, # noqa:N803
ObjectDescribedBy,
StringContaining,
):
# TODO: This whole thing is a little hacky, specifically around the need to
# get `conftest.py` code into the AWS runtime, which is why there's both
Expand Down

0 comments on commit 8b0b539

Please sign in to comment.