diff --git a/.github/ISSUE_TEMPLATE/bug_form.yaml b/.github/ISSUE_TEMPLATE/bug_form.yaml index de98042f..f010851a 100644 --- a/.github/ISSUE_TEMPLATE/bug_form.yaml +++ b/.github/ISSUE_TEMPLATE/bug_form.yaml @@ -1,5 +1,5 @@ name: "Bug Report Form" -description: "Report a bug or a similiar issue." +description: "Report a bug or a similar issue." body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7b2d69f9..13ec62b3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug Report -about: Report a bug or a similiar issue - the classic way +about: Report a bug or a similar issue - the classic way title: '' labels: '' assignees: '' @@ -18,7 +18,7 @@ If you want to suggest a feature or have any other question, please use our #### Description diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d6e05f6a..231c88ff 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -36,7 +36,7 @@ - [ ] All new and existing tests passed. -*I provide my contribution under the terms of the [license](./../../LICENSE.txt) of this repository and I affirm the [Developer Certificate of Origin][dco].* +*I provide my contribution under the terms of the [license](./../LICENSE.txt) of this repository and I affirm the [Developer Certificate of Origin][dco].* [dco]: https://developercertificate.org/ diff --git a/noxfile.py b/noxfile.py index 804b8d60..b5f6fdfa 100644 --- a/noxfile.py +++ b/noxfile.py @@ -28,10 +28,10 @@ else: @nox.parametrize("borgbackup", supported_borgbackup_versions) def run_tests(session, borgbackup): # install borgbackup - if (sys.platform == 'darwin'): + if sys.platform == 'darwin': # in macOS there's currently no fuse package which works with borgbackup directly session.install(f"borgbackup=={borgbackup}") - elif (borgbackup == "1.1.18"): + elif borgbackup == "1.1.18": # borgbackup 1.1.18 doesn't support pyfuse3 session.install("llfuse") session.install(f"borgbackup[llfuse]=={borgbackup}") diff --git a/package/fix_app_qt_folder_names_for_codesign.py b/package/fix_app_qt_folder_names_for_codesign.py index 0adfb03f..cbd5805d 100644 --- a/package/fix_app_qt_folder_names_for_codesign.py +++ b/package/fix_app_qt_folder_names_for_codesign.py @@ -18,10 +18,10 @@ def create_symlink(folder: Path) -> None: """Create the appropriate symlink in the MacOS folder pointing to the Resources folder. """ - sibbling = Path(str(folder).replace("MacOS", "")) + sibling = Path(str(folder).replace("MacOS", "")) # PyQt6/Qt/qml/QtQml/Models.2 - root = str(sibbling).partition("Contents")[2].lstrip("/") + root = str(sibling).partition("Contents")[2].lstrip("/") # ../../../../ backward = "../" * (root.count("/") + 1) # ../../../../Resources/PyQt6/Qt/qml/QtQml/Models.2 @@ -41,7 +41,7 @@ def fix_dll(dll: Path) -> None: def match_func(pth: str) -> Optional[str]: """Callback function for MachO.rewriteLoadCommands() that is - called on every lookup path setted in the DLL headers. + called on every lookup path set in the DLL headers. By returning None for system libraries, it changes nothing. Else we return a relative path pointing to the good file in the MacOS folder. @@ -73,7 +73,7 @@ def find_problematic_folders(folder: Path) -> Generator[Path, None, None]: """Recursively yields problematic folders (containing a dot in their name).""" for path in folder.iterdir(): if not path.is_dir() or path.is_symlink(): - # Skip simlinks as they are allowed (even with a dot) + # Skip symlinks as they are allowed (even with a dot) continue if "." in path.name: yield path @@ -83,7 +83,7 @@ def find_problematic_folders(folder: Path) -> Generator[Path, None, None]: def move_contents_to_resources(folder: Path) -> Generator[Path, None, None]: """Recursively move any non symlink file from a problematic folder - to the sibbling one in Resources. + to the sibling one in Resources. """ for path in folder.iterdir(): if path.is_symlink(): @@ -91,10 +91,10 @@ def move_contents_to_resources(folder: Path) -> Generator[Path, None, None]: if path.name == "qml": yield from move_contents_to_resources(path) else: - sibbling = Path(str(path).replace("MacOS", "Resources")) - sibbling.parent.mkdir(parents=True, exist_ok=True) - shutil.move(path, sibbling) - yield sibbling + sibling = Path(str(path).replace("MacOS", "Resources")) + sibling.parent.mkdir(parents=True, exist_ok=True) + shutil.move(path, sibling) + yield sibling def main(args: List[str]) -> int: diff --git a/src/vorta/application.py b/src/vorta/application.py index 34c1acf9..8857a51e 100644 --- a/src/vorta/application.py +++ b/src/vorta/application.py @@ -308,11 +308,6 @@ class VortaApp(QtSingleApplication): Displays a `QMessageBox` with an error message depending on the return code of the `BorgJob`. - - Parameters - ---------- - repo_url : str - The url of the repo of concern """ # extract data from the params for the borg job repo_url = result['params']['repo_url'] @@ -344,7 +339,7 @@ class VortaApp(QtSingleApplication): elif returncode > 128: # 128+N - killed by signal N (e.g. 137 == kill -9) signal = returncode - 128 - text = self.tr('Repository data check for repo was killed by signal %s.') % (signal) + text = self.tr('Repository data check for repo was killed by signal %s.') % signal infotext = self.tr('The process running the check job got a kill signal. Try again.') else: # Real error diff --git a/src/vorta/borg/jobs_manager.py b/src/vorta/borg/jobs_manager.py index 2028535d..4659f3e7 100644 --- a/src/vorta/borg/jobs_manager.py +++ b/src/vorta/borg/jobs_manager.py @@ -25,9 +25,9 @@ class JobInterface(QObject): @abstractmethod def cancel(self): """ - Cancel can be called when the job is not started. It is the responsability of FuncJob to not cancel job if + Cancel can be called when the job is not started. It is the responsibility of FuncJob to not cancel job if no job is running. - The cancel mehod of JobsManager calls the cancel method on the running jobs only. Other jobs are dequeued. + The cancel method of JobsManager calls the cancel method on the running jobs only. Other jobs are dequeued. """ pass @@ -50,6 +50,7 @@ class SiteWorker(threading.Thread): self.current_job = None def run(self): + job = None while True: try: job = self.jobs.get(False) @@ -58,7 +59,8 @@ class SiteWorker(threading.Thread): job.run() logger.debug("Finish job for site: %s", job.repo_id()) except queue.Empty: - logger.debug("No more jobs for site: %s", job.repo_id()) + if job is not None: + logger.debug("No more jobs for site: %s", job.repo_id()) return @@ -77,19 +79,20 @@ class JobsManager: def is_worker_running(self, site=None): """ - See if there are any active jobs. The user can't start a backup if a job is - running. The scheduler can. - """ - # Check status for specific site (repo) - if site in self.workers: - return self.workers[site].is_alive() - else: - return False + See if there are any active jobs. + The user can't start a backup if a job is running. The scheduler can. - # Check if *any* worker is active - for _, worker in self.workers.items(): - if worker.is_alive(): - return True + If site is None, check if there is any worker active for any site (repo). + If site is not None, only check if there is a worker active for the given site (repo). + """ + if site is not None: + if site in self.workers: + if self.workers[site].is_alive(): + return True + else: + for _, worker in self.workers.items(): + if worker.is_alive(): + return True return False def add_job(self, job): diff --git a/src/vorta/network_status/abc.py b/src/vorta/network_status/abc.py index 60f9353a..7f74fc16 100644 --- a/src/vorta/network_status/abc.py +++ b/src/vorta/network_status/abc.py @@ -24,7 +24,7 @@ class NetworkStatusMonitor: def is_network_status_available(self): """Is the network status really available, and not just a dummy implementation?""" - return type(self) != NetworkStatusMonitor + return type(self) is not NetworkStatusMonitor def is_network_metered(self) -> bool: """Is the currently connected network a metered connection?""" diff --git a/src/vorta/profile_export.py b/src/vorta/profile_export.py index fa26ac5c..a370ce1d 100644 --- a/src/vorta/profile_export.py +++ b/src/vorta/profile_export.py @@ -36,7 +36,7 @@ class ProfileExport: def repo_url(self): if ( 'repo' in self._profile_dict - and type(self._profile_dict['repo']) == dict + and isinstance(self._profile_dict['repo'], dict) and 'url' in self._profile_dict['repo'] ): return self._profile_dict['repo']['url'] diff --git a/src/vorta/scheduler.py b/src/vorta/scheduler.py index 7a3fcee5..aa8b2859 100644 --- a/src/vorta/scheduler.py +++ b/src/vorta/scheduler.py @@ -70,7 +70,7 @@ class VortaScheduler(QtCore.QObject): self.bus = bus self.bus.connect(service, path, interface, name, "b", self.loginSuspendNotify) else: - logger.warn('Failed to connect to DBUS interface to detect sleep/resume events') + logger.warning('Failed to connect to DBUS interface to detect sleep/resume events') @QtCore.pyqtSlot(bool) def loginSuspendNotify(self, suspend: bool): diff --git a/src/vorta/views/archive_tab.py b/src/vorta/views/archive_tab.py index cb4d4184..d2af5757 100644 --- a/src/vorta/views/archive_tab.py +++ b/src/vorta/views/archive_tab.py @@ -875,7 +875,7 @@ class ArchiveTab(ArchiveTabBase, ArchiveTabUI, BackupProfileMixin): return msg.exec() == QMessageBox.StandardButton.Yes def delete_action(self): - # Since this function modify the UI, we can't put the whole function in a JobQUeue. + # Since this function modify the UI, we can't put the whole function in a JobQueue. # determine selected archives archives = [] diff --git a/src/vorta/views/diff_result.py b/src/vorta/views/diff_result.py index 5d262efa..da74ff72 100644 --- a/src/vorta/views/diff_result.py +++ b/src/vorta/views/diff_result.py @@ -381,7 +381,6 @@ def parse_diff_lines(lines: List[str], model: 'DiffTree'): if not parsed_line: raise Exception("Couldn't parse diff output `{}`".format(line)) - continue path = PurePath(parsed_line['path']) file_type = FileType.FILE diff --git a/src/vorta/views/partials/treemodel.py b/src/vorta/views/partials/treemodel.py index a184a542..ceff3eb4 100644 --- a/src/vorta/views/partials/treemodel.py +++ b/src/vorta/views/partials/treemodel.py @@ -610,7 +610,7 @@ class FileTreeModel(QAbstractItemModel, Generic[T]): if isinstance(path, PurePath): path = path.parts - return self.root.get_path(path) # handels empty path + return self.root.get_path(path) # handles empty path def data(self, index: QModelIndex, role: int = Qt.ItemDataRole.DisplayRole): """ diff --git a/src/vorta/views/profile_add_edit_dialog.py b/src/vorta/views/profile_add_edit_dialog.py index 56d040c1..75b767d9 100644 --- a/src/vorta/views/profile_add_edit_dialog.py +++ b/src/vorta/views/profile_add_edit_dialog.py @@ -27,7 +27,7 @@ class AddProfileWindow(AddProfileBase, AddProfileUI): self.name_blank = trans_late('AddProfileWindow', 'Please enter a profile name.') self.name_exists = trans_late('AddProfileWindow', 'A profile with this name already exists.') - # Call validate to set inital messages + # Call validate to set initial messages self.buttonBox.button(QDialogButtonBox.StandardButton.Save).setEnabled(self.validate()) def _set_status(self, text): diff --git a/src/vorta/views/repo_tab.py b/src/vorta/views/repo_tab.py index 3b04ffa2..e9f38dba 100644 --- a/src/vorta/views/repo_tab.py +++ b/src/vorta/views/repo_tab.py @@ -40,7 +40,7 @@ class RepoTab(RepoBase, RepoUI, BackupProfileMixin): # compression or speed on a unified scale. this is not 1-dimensional and also depends # on the input data. so we just tell what we know for sure. # "auto" is used for some slower / older algorithms to avoid wasting a lot of time - # on uncompressible data. + # on incompressible data. self.repoCompression.addItem(self.tr('LZ4 (modern, default)'), 'lz4') self.repoCompression.addItem(self.tr('Zstandard Level 3 (modern)'), 'zstd,3') self.repoCompression.addItem(self.tr('Zstandard Level 8 (modern)'), 'zstd,8') diff --git a/src/vorta/views/source_tab.py b/src/vorta/views/source_tab.py index 5a839e62..ed63be2a 100644 --- a/src/vorta/views/source_tab.py +++ b/src/vorta/views/source_tab.py @@ -331,7 +331,7 @@ class SourceTab(SourceBase, SourceUI, BackupProfileMixin): profile = self.profile() # sort indexes, starting with lowest indexes.sort() - # remove each selected row, starting with highest index (otherways, higher indexes become invalid) + # remove each selected row, starting with the highest index (otherwise, higher indexes become invalid) for index in reversed(indexes): db_item = SourceFileModel.get( dir=self.sourceFilesWidget.item(index.row(), SourceColumn.Path).text(), diff --git a/tests/unit/test_treemodel.py b/tests/unit/test_treemodel.py index 1b76d585..dd2b9717 100644 --- a/tests/unit/test_treemodel.py +++ b/tests/unit/test_treemodel.py @@ -87,7 +87,7 @@ class TestFileSystemItem: item.add(child2) item.add(child3) - # test get inexistent subpath + # test get nonexistent subpath assert item.get('unknown') is None assert item.get('unknown', default='default') == 'default'