Skip to content

Commit

Permalink
Remove unneeded arguments from super()
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Sep 16, 2023
1 parent dc6e4f5 commit 8da3c61
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/socketio/asyncio_pubsub_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def can_disconnect(self, sid, namespace):

async def disconnect(self, sid, namespace, **kwargs):
if kwargs.get('ignore_queue'):
return await super(AsyncPubSubManager, self).disconnect(
return await super().disconnect(
sid, namespace=namespace)
message = {'method': 'disconnect', 'sid': sid,
'namespace': namespace or '/', 'host_id': self.host_id}
Expand Down
3 changes: 1 addition & 2 deletions src/socketio/kafka_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def __init__(self, url='kafka://localhost:9092', channel='socketio',
'(Run "pip install kafka-python" in your '
'virtualenv).')

super(KafkaManager, self).__init__(channel=channel,
write_only=write_only)
super().__init__(channel=channel, write_only=write_only)

urls = [url] if isinstance(url, str) else url
self.kafka_urls = [url[8:] if url != 'kafka://' else 'localhost:9092'
Expand Down
6 changes: 2 additions & 4 deletions src/socketio/kombu_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ def __init__(self, url='amqp://guest:guest@localhost:5672//',
raise RuntimeError('Kombu package is not installed '
'(Run "pip install kombu" in your '
'virtualenv).')
super(KombuManager, self).__init__(channel=channel,
write_only=write_only,
logger=logger)
super().__init__(channel=channel, write_only=write_only, logger=logger)
self.url = url
self.connection_options = connection_options or {}
self.exchange_options = exchange_options or {}
Expand All @@ -65,7 +63,7 @@ def __init__(self, url='amqp://guest:guest@localhost:5672//',
self.publisher_connection = self._connection()

def initialize(self):
super(KombuManager, self).initialize()
super().initialize()

monkey_patched = True
if self.server.async_mode == 'eventlet':
Expand Down
8 changes: 3 additions & 5 deletions src/socketio/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ class WSGIApp(engineio.WSGIApp):
"""
def __init__(self, socketio_app, wsgi_app=None, static_files=None,
socketio_path='socket.io'):
super(WSGIApp, self).__init__(socketio_app, wsgi_app,
static_files=static_files,
engineio_path=socketio_path)
super().__init__(socketio_app, wsgi_app, static_files=static_files,
engineio_path=socketio_path)


class Middleware(WSGIApp):
"""This class has been renamed to WSGIApp and is now deprecated."""
def __init__(self, socketio_app, wsgi_app=None,
socketio_path='socket.io'):
super(Middleware, self).__init__(socketio_app, wsgi_app,
socketio_path=socketio_path)
super().__init__(socketio_app, wsgi_app, socketio_path=socketio_path)
4 changes: 2 additions & 2 deletions src/socketio/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Namespace(BaseNamespace):
omitted, the default namespace is used.
"""
def __init__(self, namespace=None):
super(Namespace, self).__init__(namespace=namespace)
super().__init__(namespace=namespace)
self.server = None

def _set_server(self, server):
Expand Down Expand Up @@ -166,7 +166,7 @@ class ClientNamespace(BaseNamespace):
omitted, the default namespace is used.
"""
def __init__(self, namespace=None):
super(ClientNamespace, self).__init__(namespace=namespace)
super().__init__(namespace=namespace)
self.client = None

def _set_client(self, client):
Expand Down
9 changes: 4 additions & 5 deletions src/socketio/pubsub_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class PubSubManager(BaseManager):
name = 'pubsub'

def __init__(self, channel='socketio', write_only=False, logger=None):
super(PubSubManager, self).__init__()
super().__init__()
self.channel = channel
self.write_only = write_only
self.host_id = uuid.uuid4().hex
self.logger = logger

def initialize(self):
super(PubSubManager, self).initialize()
super().initialize()
if not self.write_only:
self.thread = self.server.start_background_task(self._thread)
self._get_logger().info(self.name + ' backend initialized.')
Expand All @@ -47,7 +47,7 @@ def emit(self, event, data, namespace=None, room=None, skip_sid=None,
The parameters are the same as in :meth:`.Server.emit`.
"""
if kwargs.get('ignore_queue'):
return super(PubSubManager, self).emit(
return super().emit(
event, data, namespace=namespace, room=room, skip_sid=skip_sid,
callback=callback)
namespace = namespace or '/'
Expand Down Expand Up @@ -81,8 +81,7 @@ def can_disconnect(self, sid, namespace):

def disconnect(self, sid, namespace=None, **kwargs):
if kwargs.get('ignore_queue'):
return super(PubSubManager, self).disconnect(
sid, namespace=namespace)
return super().disconnect(sid, namespace=namespace)
message = {'method': 'disconnect', 'sid': sid,
'namespace': namespace or '/', 'host_id': self.host_id}
self._handle_disconnect(message) # handle in this host
Expand Down
6 changes: 2 additions & 4 deletions src/socketio/redis_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ def __init__(self, url='redis://localhost:6379/0', channel='socketio',
self.redis_url = url
self.redis_options = redis_options or {}
self._redis_connect()
super(RedisManager, self).__init__(channel=channel,
write_only=write_only,
logger=logger)
super().__init__(channel=channel, write_only=write_only, logger=logger)

def initialize(self):
super(RedisManager, self).initialize()
super().initialize()

monkey_patched = True
if self.server.async_mode == 'eventlet':
Expand Down
4 changes: 1 addition & 3 deletions src/socketio/zmq_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ def __init__(self, url='zmq+tcp://localhost:5555+5556',
self.sink = sink
self.sub = sub
self.channel = channel
super(ZmqManager, self).__init__(channel=channel,
write_only=write_only,
logger=logger)
super().__init__(channel=channel, write_only=write_only, logger=logger)

def _publish(self, data):
pickled_data = pickle.dumps(
Expand Down

0 comments on commit 8da3c61

Please sign in to comment.