Skip to content

Commit fa24e49

Browse files
authored
ref: Use new-style super() (getsentry#2744)
1 parent adb9d3e commit fa24e49

8 files changed

Lines changed: 14 additions & 14 deletions

File tree

sentry_sdk/integrations/django/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def __init__(self, get_response=None, *args, **kwargs):
132132
self.get_response = get_response
133133
self._call_method = None
134134
if self.async_capable:
135-
super(SentryWrappingMiddleware, self).__init__(get_response)
135+
super().__init__(get_response)
136136

137137
# We need correct behavior for `hasattr()`, which we can only determine
138138
# when we have an instance of the middleware we're wrapping.

sentry_sdk/integrations/grpc/aio/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, find_name=None):
2323
# type: (ServerInterceptor, Callable[[ServicerContext], str] | None) -> None
2424
self._find_method_name = find_name or self._find_name
2525

26-
super(ServerInterceptor, self).__init__()
26+
super().__init__()
2727

2828
async def intercept_service(self, continuation, handler_call_details):
2929
# type: (ServerInterceptor, Callable[[HandlerCallDetails], Awaitable[RpcMethodHandler]], HandlerCallDetails) -> Awaitable[RpcMethodHandler]

sentry_sdk/integrations/grpc/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, find_name=None):
2020
# type: (ServerInterceptor, Optional[Callable[[ServicerContext], str]]) -> None
2121
self._find_method_name = find_name or ServerInterceptor._find_name
2222

23-
super(ServerInterceptor, self).__init__()
23+
super().__init__()
2424

2525
def intercept_service(self, continuation, handler_call_details):
2626
# type: (ServerInterceptor, Callable[[HandlerCallDetails], RpcMethodHandler], HandlerCallDetails) -> RpcMethodHandler

sentry_sdk/integrations/opentelemetry/span_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class SentrySpanProcessor(SpanProcessor): # type: ignore
8080
def __new__(cls):
8181
# type: () -> SentrySpanProcessor
8282
if not hasattr(cls, "instance"):
83-
cls.instance = super(SentrySpanProcessor, cls).__new__(cls)
83+
cls.instance = super().__new__(cls)
8484

8585
return cls.instance
8686

sentry_sdk/profiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ class ThreadScheduler(Scheduler):
882882

883883
def __init__(self, frequency):
884884
# type: (int) -> None
885-
super(ThreadScheduler, self).__init__(frequency=frequency)
885+
super().__init__(frequency=frequency)
886886

887887
# used to signal to the thread that it should stop
888888
self.running = False
@@ -982,7 +982,7 @@ def __init__(self, frequency):
982982
if ThreadPool is None:
983983
raise ValueError("Profiler mode: {} is not available".format(self.mode))
984984

985-
super(GeventScheduler, self).__init__(frequency=frequency)
985+
super().__init__(frequency=frequency)
986986

987987
# used to signal to the thread that it should stop
988988
self.running = False

sentry_sdk/tracing.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def __init__(
587587
)
588588
name = kwargs.pop("transaction")
589589

590-
super(Transaction, self).__init__(**kwargs)
590+
super().__init__(**kwargs)
591591

592592
self.name = name
593593
self.source = source
@@ -616,7 +616,7 @@ def __repr__(self):
616616

617617
def __enter__(self):
618618
# type: () -> Transaction
619-
super(Transaction, self).__enter__()
619+
super().__enter__()
620620

621621
if self._profile is not None:
622622
self._profile.__enter__()
@@ -628,7 +628,7 @@ def __exit__(self, ty, value, tb):
628628
if self._profile is not None:
629629
self._profile.__exit__(ty, value, tb)
630630

631-
super(Transaction, self).__exit__(ty, value, tb)
631+
super().__exit__(ty, value, tb)
632632

633633
@property
634634
def containing_transaction(self):
@@ -689,7 +689,7 @@ def finish(self, hub=None, end_timestamp=None):
689689
)
690690
self.name = "<unlabeled transaction>"
691691

692-
super(Transaction, self).finish(hub, end_timestamp)
692+
super().finish(hub, end_timestamp)
693693

694694
if not self.sampled:
695695
# At this point a `sampled = None` should have already been resolved
@@ -761,13 +761,13 @@ def set_http_status(self, http_status):
761761
"""Sets the status of the Transaction according to the given HTTP status.
762762
763763
:param http_status: The HTTP status code."""
764-
super(Transaction, self).set_http_status(http_status)
764+
super().set_http_status(http_status)
765765
self.set_context("response", {"status_code": http_status})
766766

767767
def to_json(self):
768768
# type: () -> Dict[str, Any]
769769
"""Returns a JSON-compatible representation of the transaction."""
770-
rv = super(Transaction, self).to_json()
770+
rv = super().to_json()
771771

772772
rv["name"] = self.name
773773
rv["source"] = self.source

tests/integrations/beam/test_beam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def fa(self, x, element=False, another_element=False):
5555

5656
def __init__(self):
5757
self.r = "We are in B"
58-
super(B, self).__init__(self.fa)
58+
super().__init__(self.fa)
5959

6060

6161
class SimpleFunc(DoFn):

tests/integrations/django/myapp/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class ClassBasedView(ListView):
126126

127127
@method_decorator(csrf_exempt)
128128
def dispatch(self, request, *args, **kwargs):
129-
return super(ClassBasedView, self).dispatch(request, *args, **kwargs)
129+
return super().dispatch(request, *args, **kwargs)
130130

131131
def head(self, *args, **kwargs):
132132
sentry_sdk.capture_message("hi")

0 commit comments

Comments
 (0)