diff --git a/src/debugpy/adapter/clients.py b/src/debugpy/adapter/clients.py index b2977a79..1fd01a07 100644 --- a/src/debugpy/adapter/clients.py +++ b/src/debugpy/adapter/clients.py @@ -47,7 +47,7 @@ class Client(components.Component): stream = messaging.JsonIOStream.from_socket(sock) with sessions.Session() as session: - super(Client, self).__init__(session, stream) + super().__init__(session, stream) self.client_id = None """ID of the connecting client. This can be 'test' while running tests.""" diff --git a/src/debugpy/adapter/components.py b/src/debugpy/adapter/components.py index a4c84b98..cc88d141 100644 --- a/src/debugpy/adapter/components.py +++ b/src/debugpy/adapter/components.py @@ -12,7 +12,7 @@ ACCEPT_CONNECTIONS_TIMEOUT = 10 class ComponentNotAvailable(Exception): def __init__(self, type): - super(ComponentNotAvailable, self).__init__(f"{type.__name__} is not available") + super().__init__(f"{type.__name__} is not available") class Component(util.Observable): @@ -40,7 +40,7 @@ class Component(util.Observable): finally: session.lock.release() - super(Component, self).__init__() + super().__init__() self.session = session diff --git a/src/debugpy/adapter/launchers.py b/src/debugpy/adapter/launchers.py index eb57680e..2a8e6488 100644 --- a/src/debugpy/adapter/launchers.py +++ b/src/debugpy/adapter/launchers.py @@ -19,7 +19,7 @@ class Launcher(components.Component): def __init__(self, session, stream): with session: assert not session.launcher - super(Launcher, self).__init__(session, stream) + super().__init__(session, stream) self.pid = None """Process ID of the debuggee process, as reported by the launcher.""" diff --git a/src/debugpy/adapter/servers.py b/src/debugpy/adapter/servers.py index 36c6a17d..a339981d 100644 --- a/src/debugpy/adapter/servers.py +++ b/src/debugpy/adapter/servers.py @@ -255,7 +255,7 @@ class Server(components.Component): assert connection.server is None with session: assert not session.server - super(Server, self).__init__(session, channel=connection.channel) + super().__init__(session, channel=connection.channel) self.connection = connection @@ -361,7 +361,7 @@ class Server(components.Component): with _lock: _connections.remove(self.connection) _connections_changed.set() - super(Server, self).disconnect() + super().disconnect() def serve(host="127.0.0.1", port=0): diff --git a/src/debugpy/adapter/sessions.py b/src/debugpy/adapter/sessions.py index c4a0bd55..590649f1 100644 --- a/src/debugpy/adapter/sessions.py +++ b/src/debugpy/adapter/sessions.py @@ -30,7 +30,7 @@ class Session(util.Observable): def __init__(self): from debugpy.adapter import clients - super(Session, self).__init__() + super().__init__() self.lock = threading.RLock() self.id = next(self._counter) diff --git a/src/debugpy/common/json.py b/src/debugpy/common/json.py index 8f4aca39..d5bd12da 100644 --- a/src/debugpy/common/json.py +++ b/src/debugpy/common/json.py @@ -27,7 +27,7 @@ class JsonEncoder(json.JSONEncoder): pass else: return get_state() - return super(JsonEncoder, self).default(value) + return super().default(value) class JsonObject(object): diff --git a/src/debugpy/common/messaging.py b/src/debugpy/common/messaging.py index 2ad5801d..bd3e24de 100644 --- a/src/debugpy/common/messaging.py +++ b/src/debugpy/common/messaging.py @@ -29,7 +29,7 @@ class JsonIOError(IOError): cause = kwargs.pop("cause", None) if not len(args) and cause is not None: args = [str(cause)] - super(JsonIOError, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.stream = stream """The stream that couldn't be read or written. @@ -51,7 +51,7 @@ class NoMoreMessages(JsonIOError, EOFError): def __init__(self, *args, **kwargs): args = args if len(args) else ["No more messages"] - super(NoMoreMessages, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) class JsonIOStream(object): @@ -326,9 +326,9 @@ class MessageDict(collections.OrderedDict): assert message is None or isinstance(message, Message) if items is None: - super(MessageDict, self).__init__() + super().__init__() else: - super(MessageDict, self).__init__(items) + super().__init__(items) self.message = message """The Message object that owns this dict. @@ -548,7 +548,7 @@ class Event(Message): """ def __init__(self, channel, seq, event, body, json=None): - super(Event, self).__init__(channel, seq, json) + super().__init__(channel, seq, json) self.event = event @@ -642,7 +642,7 @@ class Request(Message): """ def __init__(self, channel, seq, command, arguments, json=None): - super(Request, self).__init__(channel, seq, json) + super().__init__(channel, seq, json) self.command = command @@ -753,7 +753,7 @@ class OutgoingRequest(Request): _parse = _handle = None def __init__(self, channel, seq, command, arguments): - super(OutgoingRequest, self).__init__(channel, seq, command, arguments) + super().__init__(channel, seq, command, arguments) self._response_handlers = [] def describe(self): @@ -862,7 +862,7 @@ class Response(Message): """ def __init__(self, channel, seq, request, body, json=None): - super(Response, self).__init__(channel, seq, json) + super().__init__(channel, seq, json) self.request = request """The request to which this is the response.""" @@ -954,7 +954,7 @@ class Disconnect(Message): """ def __init__(self, channel): - super(Disconnect, self).__init__(channel, None) + super().__init__(channel, None) def describe(self): return f"disconnect from {self.channel}" diff --git a/src/debugpy/common/singleton.py b/src/debugpy/common/singleton.py index bc52026f..d515a4ab 100644 --- a/src/debugpy/common/singleton.py +++ b/src/debugpy/common/singleton.py @@ -128,7 +128,7 @@ class ThreadSafeSingleton(Singleton): """ def __init__(self, *args, **kwargs): - super(ThreadSafeSingleton, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Make sure each derived class gets a separate copy. type(self).readonly_attrs = set(type(self).readonly_attrs) diff --git a/src/debugpy/common/util.py b/src/debugpy/common/util.py index f67761b5..47a6488c 100644 --- a/src/debugpy/common/util.py +++ b/src/debugpy/common/util.py @@ -26,7 +26,7 @@ class Observable(object): def __setattr__(self, name, value): try: - return super(Observable, self).__setattr__(name, value) + return super().__setattr__(name, value) finally: for ob in self.observers: ob(self, name) diff --git a/tests/debug/targets.py b/tests/debug/targets.py index 242742ab..80299df8 100644 --- a/tests/debug/targets.py +++ b/tests/debug/targets.py @@ -89,7 +89,7 @@ class Program(Target): pytest_id = "program" def __init__(self, filename, args=()): - super(Program, self).__init__(filename, args) + super().__init__(filename, args) self._cwd = "" def make_relative(self, cwd): @@ -137,7 +137,7 @@ class Module(Target): def __init__(self, filename=None, name=None, args=()): assert (filename is None) ^ (name is None) - super(Module, self).__init__(filename, args) + super().__init__(filename, args) self.name = name if name is not None else self.filename.purebasename def __repr__(self): @@ -163,7 +163,7 @@ class Code(Target): def __init__(self, filename=None, code=None, args=()): assert (filename is None) ^ (code is None) - super(Code, self).__init__(filename, args) + super().__init__(filename, args) if code is not None: self.code = code diff --git a/tests/debugpy/test_args.py b/tests/debugpy/test_args.py index 1a918e0c..03341f24 100644 --- a/tests/debugpy/test_args.py +++ b/tests/debugpy/test_args.py @@ -55,7 +55,7 @@ def test_shell_expansion(pyfile, target, run, expansion): class Session(debug.Session): def run_in_terminal(self, args, cwd, env): expand(args) - return super(Session, self).run_in_terminal(args, cwd, env) + return super().run_in_terminal(args, cwd, env) args = ["0", "$1", "2"] with Session() as session: diff --git a/tests/patterns/_impl.py b/tests/patterns/_impl.py index 75cab8e2..de7d0b51 100644 --- a/tests/patterns/_impl.py +++ b/tests/patterns/_impl.py @@ -273,7 +273,7 @@ class SuchThat(Also): """Matches only if condition is true.""" def __init__(self, pattern, condition): - super(SuchThat, self).__init__(pattern) + super().__init__(pattern) self.condition = condition def __repr__(self): @@ -290,7 +290,7 @@ class InRange(Also): """Matches only if the value is within the specified range.""" def __init__(self, pattern, start, stop): - super(InRange, self).__init__(pattern) + super().__init__(pattern) self.start = start self.stop = stop @@ -308,7 +308,7 @@ class EqualTo(Also): """Matches any object that is equal to the specified object.""" def __init__(self, pattern, obj): - super(EqualTo, self).__init__(pattern) + super().__init__(pattern) self.obj = obj def __repr__(self): @@ -328,7 +328,7 @@ class NotEqualTo(Also): """Matches any object that is not equal to the specified object.""" def __init__(self, pattern, obj): - super(NotEqualTo, self).__init__(pattern) + super().__init__(pattern) self.obj = obj def __repr__(self): @@ -342,7 +342,7 @@ class SameAs(Also): """Matches one specific object only (i.e. makes '==' behave like 'is').""" def __init__(self, pattern, obj): - super(SameAs, self).__init__(pattern) + super().__init__(pattern) self.obj = obj def __repr__(self): @@ -357,7 +357,7 @@ class Matching(Also): def __init__(self, pattern, regex, flags=0): assert isinstance(regex, bytes) or isinstance(regex, str) - super(Matching, self).__init__(pattern) + super().__init__(pattern) self.regex = regex self.flags = flags diff --git a/tests/timeline.py b/tests/timeline.py index 3d493450..24d0393b 100644 --- a/tests/timeline.py +++ b/tests/timeline.py @@ -403,7 +403,7 @@ class Interval(tuple): occs = occ.and_following(up_to=stop) break - result = super(Interval, cls).__new__(cls, occs) + result = super().__new__(cls, occs) result.timeline = timeline result.start = start result.stop = stop @@ -610,7 +610,7 @@ class SequencedExpectation(DerivativeExpectation): OPERATOR = ">>" def __init__(self, first, second): - super(SequencedExpectation, self).__init__(first, second) + super().__init__(first, second) @property def first(self): @@ -717,7 +717,7 @@ class XorExpectation(DerivativeExpectation): class ConditionalExpectation(DerivativeExpectation): def __init__(self, expectation, condition): self.condition = condition - super(ConditionalExpectation, self).__init__(expectation) + super().__init__(expectation) @property def expectation(self): @@ -980,7 +980,7 @@ class MessageOccurrence(Occurrence): # Assign message first for the benefit of self._data in child classes. self.message = message - super(MessageOccurrence, self).__init__(self.TYPE, self._key, self._data) + super().__init__(self.TYPE, self._key, self._data) @property def seq(self): @@ -1032,7 +1032,7 @@ class EventOccurrence(MessageOccurrence): def __init__(self, message): assert isinstance(message, messaging.Event) - super(EventOccurrence, self).__init__(message) + super().__init__(message) @property def event(self): @@ -1052,7 +1052,7 @@ class EventOccurrence(MessageOccurrence): @property def _id(self): - return super(EventOccurrence, self)._id + [("event", self.message.event)] + return super()._id + [("event", self.message.event)] class RequestOccurrence(MessageOccurrence): @@ -1060,7 +1060,7 @@ class RequestOccurrence(MessageOccurrence): def __init__(self, message): assert isinstance(message, messaging.Request) - super(RequestOccurrence, self).__init__(message) + super().__init__(message) self.response = None if isinstance(message, messaging.OutgoingRequest): self.on_response = message.on_response @@ -1083,7 +1083,7 @@ class RequestOccurrence(MessageOccurrence): @property def _id(self): - return super(RequestOccurrence, self)._id + [("command", self.message.command)] + return super()._id + [("command", self.message.command)] def wait_for_response(self, freeze=True, raise_if_failed=True): response = Response(self, some.object).wait_until_realized(freeze) @@ -1104,7 +1104,7 @@ class ResponseOccurrence(MessageOccurrence): # Assign request first for the benefit of self._key. self.request = request_occ request_occ.response = self - super(ResponseOccurrence, self).__init__(message) + super().__init__(message) @property def body(self): @@ -1128,7 +1128,7 @@ class ResponseOccurrence(MessageOccurrence): @property def _id(self): - return super(ResponseOccurrence, self)._id + [ + return super()._id + [ ("command", self.message.request.command), ("request_seq", self.message.request.seq), ]