8000 ref: Update flake8-bugbear · sapcc/sentry-python@c8fedd4 · GitHub
[go: up one dir, main page]

Skip to content

Commit c8fedd4

Browse files
committed
ref: Update flake8-bugbear
1 parent 3af60ef commit c8fedd4

File tree

8 files changed

+15
-16
lines changed

8 files changed

+15
-16
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
ignore = E203, E266, E501, W503, E402, E731, C901, B950
2+
ignore = E203, E266, E501, W503, E402, E731, C901, B950, B011
33
max-line-length = 80
44
max-complexity = 18
55
select = B,C,E,F,W,T4,B9

sentry_sdk/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def reraise(tp, value, tb=None):
6060
def with_metaclass(meta, *bases):
6161
# type: (Any, *Any) -> Any
6262
class metaclass(type):
63-
def __new__(cls, name, this_bases, d):
63+
def __new__(metacls, name, this_bases, d):
6464
# type: (Any, Any, Any, Any) -> Any
6565
return meta(name, bases, d)
6666

sentry_sdk/consts.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ def __init__(
2828
environment=None, # type: Optional[str]
2929
server_name=None, # type: Optional[str]
3030
shutdown_timeout=2, # type: int
31-
integrations=[], # type: Sequence[Integration]
32-
in_app_include=[], # type: List[str]
33-
in_app_exclude=[], # type: List[str]
31+
integrations=[], # type: Sequence[Integration] # noqa: B006
32+
in_app_include=[], # type: List[str] # noqa: B006
33+
in_app_exclude=[], # type: List[str] # noqa: B006
3434
default_integrations=True, # type: bool
3535
dist=None, # type: Optional[str]
3636
transport=None, # type: Optional[Union[Transport, Type[Transport], Callable[[Event], None]]]
3737
sample_rate=1.0, # type: float
3838
send_default_pii=False, # type: bool
3939
http_proxy=None, # type: Optional[str]
4040
https_proxy=None, # type: Optional[str]
41-
ignore_errors=[], # type: List[Union[type, str]]
41+
ignore_errors=[], # type: List[Union[type, str]] # noqa: B006
4242
request_bodies="medium", # type: str
4343
before_send=None, # type: Optional[EventProcessor]
4444
before_breadcrumb=None, # type: Optional[BreadcrumbProcessor]
@@ -49,7 +49,7 @@ def __init__(
4949
# DO NOT ENABLE THIS RIGHT NOW UNLESS YOU WANT TO EXCEED YOUR EVENT QUOTA IMMEDIATELY
5050
traces_sample_rate=0.0, # type: float
5151
traceparent_v2=False, # type: bool
52-
_experiments={}, # type: Dict[str, Any]
52+
_experiments={}, # type: Dict[str, Any] # noqa: B006
5353
):
5454
# type: (...) -> None
5555
pass

sentry_sdk/hub.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import copy
22
import random
33
import sys
4-
import weakref
54

65
from datetime import datetime
76
from contextlib import contextmanager
8-
from warnings import warn
97

108
from sentry_sdk._compat import with_metaclass
119
from sentry_sdk.scope import Scope
@@ -109,7 +107,7 @@ class init(ClientConstructor, ContextManager[Any]):
109107

110108
class HubMeta(type):
111109
@property
112-
def current(self):
110+
def current(cls):
113111
# type: () -> Hub
114112
"""Returns the current instance of the hub."""
115113
rv = _local.get(None)
@@ -119,7 +117,7 @@ def current(self):
119117
return rv
120118

121119
@property
122-
def main(self):
120+
def main(cls):
123121
# type: () -> Hub
124122
"""Returns the main instance of the hub."""
125123
return GLOBAL_HUB

sentry_sdk/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ def to_header(self, timestamp=None):
208208

209209

210210
class AnnotatedValue(object):
211+
__slots__ = ("value", "metadata")
212+
211213
def __init__(self, value, metadata):
212214
# type: (Optional[Any], Dict[str, Any]) -> None
213215
self.value = value
@@ -754,7 +756,7 @@ def get(self, default):
754756

755757
def set(self, value):
756758
# type: (Any) -> None
757-
setattr(self._local, "value", value)
759+
self._local.value = value
758760

759761
return False, ContextVar
760762

tests/integrations/beam/test_beam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class A:
3636
def __init__(self, fn):
3737
self.r = "We are in A"
3838
self.fn = fn
39-
setattr(self, "_inspect_fn", _wrap_inspect_call(self, "fn"))
39+
self._inspect_fn = _wrap_inspect_call(self, "fn")
4040

4141
def process(self):
4242
return self.fn()

tests/utils/test_transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
class MyClass:
5-
def myfunc():
5+
def myfunc(self):
66
pass
77

88

tox.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,8 @@ deps =
155155
linters: flake8
156156
linters: flake8-import-order
157157
linters: mypy>=0.730
158+
linters: flake8-bugbear>=19.8.0
158159

159-
# https://github.com/PyCQA/flake8-bugbear/pull/77
160-
linters: git+https://github.com/untitaker/flake8-bugbear#branch=fix/b901-yield-expr
161160
setenv =
162161
PYTHONDONTWRITEBYTECODE=1
163162
TESTPATH=tests

0 commit comments

Comments
 (0)
0