diff --git a/nxdrive/__main__.py b/nxdrive/__main__.py index 0609ba2198..2c26909aa5 100644 --- a/nxdrive/__main__.py +++ b/nxdrive/__main__.py @@ -2,6 +2,7 @@ In this file we cannot use a relative import here, else Drive will not start when packaged. See https://github.com/pyinstaller/pyinstaller/issues/2560 """ + import locale import platform import signal diff --git a/nxdrive/behavior.py b/nxdrive/behavior.py index 487941eba4..1c6f0a84df 100644 --- a/nxdrive/behavior.py +++ b/nxdrive/behavior.py @@ -11,6 +11,7 @@ Allow or disallow server deletions. """ + from types import SimpleNamespace Behavior = SimpleNamespace(server_deletion=True) diff --git a/nxdrive/client/local/__init__.py b/nxdrive/client/local/__init__.py index 912d966266..86a4014bd9 100644 --- a/nxdrive/client/local/__init__.py +++ b/nxdrive/client/local/__init__.py @@ -1,4 +1,5 @@ """ API to access local resources for synchronization. """ + from .base import FileInfo, get # Get the local client related to the current OS diff --git a/nxdrive/client/uploader/__init__.py b/nxdrive/client/uploader/__init__.py index 601d90db8c..533ff59674 100644 --- a/nxdrive/client/uploader/__init__.py +++ b/nxdrive/client/uploader/__init__.py @@ -1,6 +1,7 @@ """ Uploader used by the Remote client for all upload stuff. """ + import json from abc import abstractmethod from logging import getLogger diff --git a/nxdrive/client/uploader/direct_transfer.py b/nxdrive/client/uploader/direct_transfer.py index d957af4c03..4195c772ff 100644 --- a/nxdrive/client/uploader/direct_transfer.py +++ b/nxdrive/client/uploader/direct_transfer.py @@ -1,6 +1,7 @@ """ Uploader used by the Direct Transfer feature. """ + import json from logging import getLogger from pathlib import Path diff --git a/nxdrive/client/uploader/sync.py b/nxdrive/client/uploader/sync.py index 0d1804f6c1..8a06b1b48e 100644 --- a/nxdrive/client/uploader/sync.py +++ b/nxdrive/client/uploader/sync.py @@ -1,6 +1,7 @@ """ Uploader used by the synchronization engine. """ + from pathlib import Path from typing import Any, Dict, Optional diff --git a/nxdrive/dao/base.py b/nxdrive/dao/base.py index 24bce57600..ab3462ddb4 100644 --- a/nxdrive/dao/base.py +++ b/nxdrive/dao/base.py @@ -1,6 +1,7 @@ """ Query formatting in this file is based on http://www.sqlstyle.guide/ """ + import sys from contextlib import suppress from logging import getLogger diff --git a/nxdrive/dao/engine.py b/nxdrive/dao/engine.py index 9f52a18d90..97b0ee2781 100644 --- a/nxdrive/dao/engine.py +++ b/nxdrive/dao/engine.py @@ -1,6 +1,7 @@ """ Query formatting in this file is based on http://www.sqlstyle.guide/ """ + import json import os import shutil diff --git a/nxdrive/dao/manager.py b/nxdrive/dao/manager.py index 0095b71da2..0425ff50e5 100644 --- a/nxdrive/dao/manager.py +++ b/nxdrive/dao/manager.py @@ -1,6 +1,7 @@ """ Query formatting in this file is based on http://www.sqlstyle.guide/ """ + from logging import getLogger from pathlib import Path from sqlite3 import Cursor, IntegrityError, Row diff --git a/nxdrive/engine/engine.py b/nxdrive/engine/engine.py index 4fc2478f12..8fd58da890 100644 --- a/nxdrive/engine/engine.py +++ b/nxdrive/engine/engine.py @@ -838,9 +838,7 @@ def resume_transfer( meth = ( self.dao.get_download if nature == "download" - else self.dao.get_dt_upload - if is_direct_transfer - else self.dao.get_upload + else self.dao.get_dt_upload if is_direct_transfer else self.dao.get_upload ) func = partial(meth, uid=uid) # type: ignore self._resume_transfers(nature, func, is_direct_transfer=is_direct_transfer) diff --git a/nxdrive/fatal_error.py b/nxdrive/fatal_error.py index b5771dded2..9c0d7f100b 100644 --- a/nxdrive/fatal_error.py +++ b/nxdrive/fatal_error.py @@ -1,6 +1,7 @@ """ Fatal error screen management using either Qt or OS-specific dialogs. """ + import sys from contextlib import suppress from pathlib import Path diff --git a/nxdrive/feature.py b/nxdrive/feature.py index 52ce7124b2..18ec07fe30 100644 --- a/nxdrive/feature.py +++ b/nxdrive/feature.py @@ -22,6 +22,7 @@ Enable or disable the synchronization features. """ + from types import SimpleNamespace from typing import List diff --git a/nxdrive/gui/application.py b/nxdrive/gui/application.py index eef2ac55c0..ab4d1a7c55 100644 --- a/nxdrive/gui/application.py +++ b/nxdrive/gui/application.py @@ -1,4 +1,5 @@ """ Main Qt application handling OS events and system tray UI. """ + import os import webbrowser from contextlib import suppress diff --git a/nxdrive/osi/darwin/pyNotificationCenter.py b/nxdrive/osi/darwin/pyNotificationCenter.py index 171632ed9b..8b0043acd3 100644 --- a/nxdrive/osi/darwin/pyNotificationCenter.py +++ b/nxdrive/osi/darwin/pyNotificationCenter.py @@ -1,4 +1,5 @@ """ Python integration macOS notification center. """ + from typing import TYPE_CHECKING, Dict from CoreServices import ( diff --git a/nxdrive/qt/constants.py b/nxdrive/qt/constants.py index 3aac258c2e..d81e5f42be 100644 --- a/nxdrive/qt/constants.py +++ b/nxdrive/qt/constants.py @@ -1,6 +1,7 @@ """ Put here all PyQt constants used across the project. """ + from .imports import ( QAbstractSocket, QDialogButtonBox, diff --git a/nxdrive/qt/imports.py b/nxdrive/qt/imports.py index 9187f27799..86af2e3cb8 100644 --- a/nxdrive/qt/imports.py +++ b/nxdrive/qt/imports.py @@ -1,6 +1,7 @@ """ Put here all PyQt imports used across the project. """ + from PyQt5.QtCore import ( QT_VERSION_STR, QAbstractListModel, diff --git a/nxdrive/state.py b/nxdrive/state.py index 8ea37ed349..d15ac06444 100644 --- a/nxdrive/state.py +++ b/nxdrive/state.py @@ -11,6 +11,7 @@ This state is set at the start of the application to know if it has crashed at the previous run. """ + from types import SimpleNamespace State = SimpleNamespace(about_to_quit=False, crash_details="", has_crashed=False) diff --git a/nxdrive/utils.py b/nxdrive/utils.py index 385d4dec54..5ad482e5de 100644 --- a/nxdrive/utils.py +++ b/nxdrive/utils.py @@ -5,6 +5,7 @@ Most of functions are pure enough to be decorated with a LRU cache. Each *maxsize* is adjusted depending of the heavy use of the decorated function. """ + import os import os.path import re