[arch] refactoring: proper typing

This commit is contained in:
Vinicius Moreira
2022-01-07 18:23:44 -03:00
parent 30e37d9765
commit 131b787108

View File

@@ -1,7 +1,7 @@
import logging import logging
import time import time
from threading import Thread from threading import Thread
from typing import Set from typing import Optional, Collection
from bauh.api.abstract.handler import ProcessWatcher from bauh.api.abstract.handler import ProcessWatcher
from bauh.commons.html import bold from bauh.commons.html import bold
@@ -10,13 +10,13 @@ from bauh.view.util.translation import I18n
class TransactionStatusHandler(Thread): class TransactionStatusHandler(Thread):
def __init__(self, watcher: ProcessWatcher, i18n: I18n, names: Set[str], logger: logging.Logger, def __init__(self, watcher: ProcessWatcher, i18n: I18n, names: Optional[Collection[str]], logger: logging.Logger,
percentage: bool = True, downloading: int = 0, pkgs_to_remove: int = 0): percentage: bool = True, downloading: int = 0, pkgs_to_remove: int = 0):
super(TransactionStatusHandler, self).__init__(daemon=True) super(TransactionStatusHandler, self).__init__(daemon=True)
self.watcher = watcher self.watcher = watcher
self.i18n = i18n self.i18n = i18n
self.pkgs_to_sync = len(names)
self.names = names self.names = names
self.pkgs_to_sync = len(names) if names else 0
self.pkgs_to_remove = pkgs_to_remove self.pkgs_to_remove = pkgs_to_remove
self.downloading = downloading self.downloading = downloading
self.upgrading = 0 self.upgrading = 0