Browse Source

Change calls to parent class to super()

pull/1748/head
Safihre 4 years ago
parent
commit
49e67a0bef
  1. 2
      sabnzbd/assembler.py
  2. 6
      sabnzbd/decoder.py
  3. 2
      sabnzbd/directunpacker.py
  4. 2
      sabnzbd/dirscanner.py
  5. 2
      sabnzbd/downloader.py
  6. 18
      sabnzbd/nzbstuff.py
  7. 2
      sabnzbd/postproc.py
  8. 2
      sabnzbd/rating.py
  9. 2
      sabnzbd/sabtray.py
  10. 2
      sabnzbd/urlgrabber.py
  11. 2
      sabnzbd/utils/kronos.py
  12. 2
      sabnzbd/utils/systrayiconthread.py
  13. 2
      tests/testhelper.py

2
sabnzbd/assembler.py

@ -41,7 +41,7 @@ import sabnzbd.utils.rarfile as rarfile
class Assembler(Thread):
def __init__(self):
Thread.__init__(self)
super().__init__()
self.queue: queue.Queue[Tuple[Optional[NzbObject], Optional[NzbFile], Optional[bool]]] = queue.Queue()
def stop(self):

6
sabnzbd/decoder.py

@ -47,7 +47,7 @@ except ImportError:
class CrcError(Exception):
def __init__(self, needcrc, gotcrc, data):
Exception.__init__(self)
super().__init__()
self.needcrc = needcrc
self.gotcrc = gotcrc
self.data = data
@ -55,7 +55,7 @@ class CrcError(Exception):
class BadYenc(Exception):
def __init__(self):
Exception.__init__(self)
super().__init__()
class Decoder:
@ -109,7 +109,7 @@ class DecoderWorker(Thread):
""" The actuall workhorse that handles decoding! """
def __init__(self, decoder_queue):
Thread.__init__(self)
super().__init__()
logging.debug("Initializing decoder %s", self.name)
self.decoder_queue: queue.Queue[Tuple[Optional[Article], Optional[List[bytes]]]] = decoder_queue

2
sabnzbd/directunpacker.py

@ -50,7 +50,7 @@ RAR_NR = re.compile(r"(.*?)(\.part(\d*).rar|\.r(\d*))$", re.IGNORECASE)
class DirectUnpacker(threading.Thread):
def __init__(self, nzo: NzbObject):
threading.Thread.__init__(self)
super().__init__()
self.nzo: NzbObject = nzo
self.active_instance: Optional[subprocess.Popen] = None

2
sabnzbd/dirscanner.py

@ -66,7 +66,7 @@ class DirScanner(threading.Thread):
"""
def __init__(self):
threading.Thread.__init__(self)
super().__init__()
self.newdir()
try:

2
sabnzbd/downloader.py

@ -188,7 +188,7 @@ class Downloader(Thread):
""" Singleton Downloader Thread """
def __init__(self, paused=False):
Thread.__init__(self)
super().__init__()
logging.debug("Initializing downloader")

18
sabnzbd/nzbstuff.py

@ -150,7 +150,7 @@ class Article(TryList):
__slots__ = ArticleSaver + ("fetcher", "fetcher_priority", "tries")
def __init__(self, article, article_bytes, nzf):
TryList.__init__(self)
super().__init__()
self.fetcher: Optional[Server] = None
self.article: str = article
self.art_id = None
@ -255,7 +255,7 @@ class Article(TryList):
dict_ = {}
for item in ArticleSaver:
dict_[item] = getattr(self, item)
dict_["try_list"] = TryList.__getstate__(self)
dict_["try_list"] = super().__getstate__()
return dict_
def __setstate__(self, dict_):
@ -266,7 +266,7 @@ class Article(TryList):
except KeyError:
# Handle new attributes
setattr(self, item, None)
TryList.__setstate__(self, dict_.get("try_list", []))
super().__setstate__(dict_.get("try_list", []))
self.fetcher_priority = 0
self.fetcher = None
self.tries = 0
@ -322,7 +322,7 @@ class NzbFile(TryList):
def __init__(self, date, subject, raw_article_db, file_bytes, nzo):
""" Setup object """
TryList.__init__(self)
super().__init__()
self.date: datetime.datetime = date
self.subject: str = subject
@ -457,7 +457,7 @@ class NzbFile(TryList):
dict_ = {}
for item in NzbFileSaver:
dict_[item] = getattr(self, item)
dict_["try_list"] = TryList.__getstate__(self)
dict_["try_list"] = super().__getstate__()
return dict_
def __setstate__(self, dict_):
@ -468,7 +468,7 @@ class NzbFile(TryList):
except KeyError:
# Handle new attributes
setattr(self, item, None)
TryList.__setstate__(self, dict_.get("try_list", []))
super().__setstate__(dict_.get("try_list", []))
# Convert 2.x.x jobs
if isinstance(self.decodetable, dict):
@ -584,7 +584,7 @@ class NzbObject(TryList):
reuse=None,
dup_check=True,
):
TryList.__init__(self)
super().__init__()
self.filename = filename # Original filename
if nzbname and nzb:
@ -1979,7 +1979,7 @@ class NzbObject(TryList):
dict_ = {}
for item in NzbObjectSaver:
dict_[item] = getattr(self, item)
dict_["try_list"] = TryList.__getstate__(self)
dict_["try_list"] = super().__getstate__()
return dict_
def __setstate__(self, dict_):
@ -1990,7 +1990,7 @@ class NzbObject(TryList):
except KeyError:
# Handle new attributes
setattr(self, item, None)
TryList.__setstate__(self, dict_.get("try_list", []))
super().__setstate__(dict_.get("try_list", []))
# Set non-transferable values
self.pp_active = False

2
sabnzbd/postproc.py

@ -102,7 +102,7 @@ class PostProcessor(Thread):
def __init__(self):
""" Initialize PostProcessor thread """
Thread.__init__(self)
super().__init__()
# This history queue is simply used to log what active items to display in the web_ui
self.history_queue: List[NzbObject] = []

2
sabnzbd/rating.py

@ -120,7 +120,7 @@ class Rating(Thread):
except:
logging.info("Corrupt %s file, discarding", RATING_FILE_NAME)
logging.info("Traceback: ", exc_info=True)
Thread.__init__(self)
super().__init__()
def stop(self):
self.shutdown = True

2
sabnzbd/sabtray.py

@ -82,7 +82,7 @@ class SABTrayThread(SysTrayIconThread):
(T("Shutdown"), None, self.shutdown),
)
SysTrayIconThread.__init__(self, self.sabicons["default"], "SABnzbd", menu_options, None, 0, "SabTrayIcon")
super().__init__(self.sabicons["default"], "SABnzbd", menu_options, None, 0, "SabTrayIcon")
def set_texts(self):
""" Cache texts for performance, doUpdates is called often """

2
sabnzbd/urlgrabber.py

@ -61,7 +61,7 @@ _RARTING_FIELDS = (
class URLGrabber(Thread):
def __init__(self):
Thread.__init__(self)
super().__init__()
self.queue: queue.Queue[Tuple[Optional[str], Optional[NzbObject]]] = queue.Queue()
for url_nzo_tup in sabnzbd.NzbQueue.get_urls():
self.queue.put(url_nzo_tup)

2
sabnzbd/utils/kronos.py

@ -407,7 +407,7 @@ class ThreadedScheduler(Scheduler):
"""A Scheduler that runs in its own thread."""
def __init__(self):
Scheduler.__init__(self)
super().__init__()
# we require a lock around the task queue
self._lock = threading.Lock()

2
sabnzbd/utils/systrayiconthread.py

@ -26,7 +26,7 @@ class SysTrayIconThread(Thread):
terminate = False
def __init__(self, icon, hover_text, menu_options, on_quit=None, default_menu_index=None, window_class_name=None):
Thread.__init__(self)
super().__init__()
self.icon = icon
self.icons = {}
self.hover_text = hover_text

2
tests/testhelper.py

@ -176,7 +176,7 @@ class FakeHistoryDB(db.HistoryDB):
def __init__(self, db_path):
db.HistoryDB.db_path = db_path
super(FakeHistoryDB, self).__init__()
super().__init__()
def add_fake_history_jobs(self, number_of_entries=1):
""" Generate a history db with any number of fake entries """

Loading…
Cancel
Save