Skip to content

Commit

Permalink
style: fix W0102, W1201, W1309, W0404, C0209
Browse files Browse the repository at this point in the history
  • Loading branch information
F33RNI committed Jan 3, 2024
1 parent c5ef5df commit d46b054
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Backupper.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def __queue_cleaner(process_output_queue__: multiprocessing.Queue or None) -> No
return -1

def _generate_tree(
self, entries: Dict, root_relative_to_dirname: bool = False, ignore_filepaths_abs: List = []
self, entries: Dict, root_relative_to_dirname: bool = False, ignore_filepaths_abs: List or None = None
) -> Dict or int:
"""Parses entries and generates dict of files and dirs with the following structure using multiprocessing:
{
Expand Down Expand Up @@ -508,7 +508,7 @@ def _generate_tree(
Args:
entries (Dict): {"path": skip} ex. {"path_1": True, "path_2": False, ...}
root_relative_to_dirname (bool): True to calculate path relative to dirname(root_dir) instead of root_dir
ignore_filepaths_abs (List, optional): list of absolute filepaths to exclude from tree. Defaults to [].
ignore_filepaths_abs (List, optional): list of absolute filepaths to exclude from tree. Defaults to None.
Returns:
Dict or int: parsed tree or exit status in case of cancel
Expand All @@ -532,7 +532,7 @@ def _generate_tree(
parsed_queue = multiprocessing.Queue(-1)
for path_abs, skip in entries.items():
# Check if we need to exclude it
if path_abs in ignore_filepaths_abs:
if ignore_filepaths_abs and path_abs in ignore_filepaths_abs:
continue

# Extract root directory
Expand Down Expand Up @@ -592,7 +592,7 @@ def _generate_tree(
path_abs = os.path.join(root_dir, path_rel)

# Check if we need to exclude it
if path_abs in ignore_filepaths_abs:
if ignore_filepaths_abs and path_abs in ignore_filepaths_abs:
continue

# Put into tree
Expand Down Expand Up @@ -1344,7 +1344,7 @@ def start_backup(
del output_tree

# Extract all existing files / directories inside backup (output_directory) again
logging.info(f"Generating output (existing files) tree again")
logging.info("Generating output (existing files) tree again")
output_tree = self._generate_tree({output_dir: False}, ignore_filepaths_abs=[output_dir])

# Exit ?
Expand Down
3 changes: 1 addition & 2 deletions GUIHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QHBoxLayout,
QPushButton,
QLineEdit,
Expand Down Expand Up @@ -108,7 +107,7 @@ def __init__(

# Load font
if os.path.exists(FONT):
logging.info("Loading font from: {}".format(FONT))
logging.info(f"Loading font from: {FONT}")
font_id = QtGui.QFontDatabase.addApplicationFont(FONT)
font_name = QtGui.QFontDatabase.applicationFontFamilies(font_id)[0]
self.setFont(QtGui.QFont(font_name, 12 if sys.platform == "darwin" else 10, 300))
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def main() -> None:
LoggingHandler.worker_configurer(logging_handler.queue)

# Log software version and GitHub link
logging.info("FloppyCat Simple Backup Utility version: " + str(__version__))
logging.info(f"FloppyCat Simple Backup Utility version: {__version__}")
logging.info("https://github.com/F33RNI/FloppyCat")

# Load configs
Expand Down

0 comments on commit d46b054

Please sign in to comment.