Use py3 style super calls

This commit is contained in:
Franck Nijhof committed 2020-09-28 14:51:09 +02:00
1 parent 5faff84a9d
commit 86e6cd595f
6 files changed
+13 -13

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ GroupNeed.__doc__ = """A need with the method preset to `"group"`."""
class GroupPermission(Permission):
def __init__(self, key):
need = GroupNeed(key)
super(GroupPermission, self).__init__(need)
super().__init__(need)
class GroupManager:
+8 -8
View File
@@ -10,7 +10,7 @@ import concurrent.futures
class AsyncLogHandlerMixin(logging.Handler):
def __init__(self, *args, **kwargs):
self._executor = concurrent.futures.ThreadPoolExecutor(max_workers=1)
super(AsyncLogHandlerMixin, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
def emit(self, record):
if getattr(self._executor, "_shutdown", False):
@@ -23,11 +23,11 @@ class AsyncLogHandlerMixin(logging.Handler):
def _emit(self, record):
# noinspection PyUnresolvedReferences
super(AsyncLogHandlerMixin, self).emit(record)
super().emit(record)
def close(self):
self._executor.shutdown(wait=True)
super(AsyncLogHandlerMixin, self).close()
super().close()
class CleaningTimedRotatingFileHandler(logging.handlers.TimedRotatingFileHandler):
@@ -35,7 +35,7 @@ class CleaningTimedRotatingFileHandler(logging.handlers.TimedRotatingFileHandler
def __init__(self, *args, **kwargs):
kwargs["encoding"] = kwargs.get("encoding", "utf-8")
super(CleaningTimedRotatingFileHandler, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
# clean up old files on handler start
if self.backupCount > 0:
@@ -48,14 +48,14 @@ class OctoPrintLogHandler(AsyncLogHandlerMixin, CleaningTimedRotatingFileHandler
def __init__(self, *args, **kwargs):
kwargs["encoding"] = kwargs.get("encoding", "utf-8")
super(OctoPrintLogHandler, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
@classmethod
def registerRolloverCallback(cls, callback, *args, **kwargs):
cls.rollover_callbacks.append((callback, args, kwargs))
def doRollover(self):
super(OctoPrintLogHandler, self).doRollover()
super().doRollover()
for rcb in self.rollover_callbacks:
callback, args, kwargs = rcb
@@ -78,7 +78,7 @@ class SerialLogHandler(AsyncLogHandlerMixin, logging.handlers.RotatingFileHandle
def __init__(self, *args, **kwargs):
kwargs["encoding"] = kwargs.get("encoding", "utf-8")
super(SerialLogHandler, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.cleanupFiles()
def shouldRollover(self, record):
@@ -131,7 +131,7 @@ class SerialLogHandler(AsyncLogHandlerMixin, logging.handlers.RotatingFileHandle
class RecordingLogHandler(logging.Handler):
def __init__(self, target=None, *args, **kwargs):
super(RecordingLogHandler, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self._buffer = []
self._target = target
+1 -1
View File
@@ -473,7 +473,7 @@ class Server:
class TaggedFuncsPrinter(wrapt.ObjectProxy):
def __getattribute__(self, attr):
__wrapped__ = super(TaggedFuncsPrinter, self).__getattribute__("__wrapped__")
__wrapped__ = super().__getattribute__("__wrapped__")
if attr == "__wrapped__":
return __wrapped__
+1 -1
View File
@@ -535,7 +535,7 @@ class OctoPrintSessionInterface(flask.sessions.SecureCookieSessionInterface):
def save_session(self, app, session, response):
if flask.g.get("login_via_apikey", False):
return
return super(OctoPrintSessionInterface, self).save_session(app, session, response)
return super().save_session(app, session, response)
#~~ passive login helper
+1 -1
View File
@@ -50,7 +50,7 @@ class UrlRewriter(PatternRewriter):
self.output_url = self.ctx.resolver.resolve_output_to_url(
self.ctx, output)
return super(UrlRewriter, self).input(_in, out, **kw)
return super().input(_in, out, **kw)
def replace_url(self, url):
return replace_url(self.source_url, self.output_url, url)
+1 -1
View File
@@ -177,7 +177,7 @@ class ExceptionHandlerExtension(Extension):
tags = {"try"}
def __init__(self, environment):
super(ExceptionHandlerExtension, self).__init__(environment)
super().__init__(environment)
self._logger = logging.getLogger(__name__)
def parse(self, parser):