diff --git a/onedrive_client/od_api_helper.py b/onedrive_client/od_api_helper.py index 96f2cda..868ea80 100644 --- a/onedrive_client/od_api_helper.py +++ b/onedrive_client/od_api_helper.py @@ -6,7 +6,7 @@ import onedrivesdk.error import requests -from . import od_dateutils +from onedrive_client import od_dateutils THROTTLE_PAUSE_SEC = 60 diff --git a/onedrive_client/od_auth.py b/onedrive_client/od_auth.py index 13a8244..c84bca8 100644 --- a/onedrive_client/od_auth.py +++ b/onedrive_client/od_auth.py @@ -15,8 +15,8 @@ import os import yaml -from . import od_api_session -from .od_models import account_profile +from onedrive_client import od_api_session +from onedrive_client.od_models import account_profile PATH = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) with open(os.path.join(PATH, 'onedrive_client', 'data', 'security_config.yml')) as config: diff --git a/onedrive_client/od_context.py b/onedrive_client/od_context.py index 33ff722..0575f8f 100644 --- a/onedrive_client/od_context.py +++ b/onedrive_client/od_context.py @@ -7,9 +7,9 @@ import click -from . import mkdir, get_resource, od_webhooks -from .od_models import account_profile -from .od_models import drive_config as _drive_config +from onedrive_client import mkdir, get_resource, od_webhooks +from onedrive_client.od_models import account_profile +from onedrive_client.od_models import drive_config as _drive_config def is_invalid_username(s): diff --git a/onedrive_client/od_i18n.py b/onedrive_client/od_i18n.py index 1be1946..fe91e9d 100644 --- a/onedrive_client/od_i18n.py +++ b/onedrive_client/od_i18n.py @@ -1,6 +1,6 @@ import json -from . import get_resource +from onedrive_client import get_resource class Translator: diff --git a/onedrive_client/od_main.py b/onedrive_client/od_main.py index 4e1b49c..9040446 100755 --- a/onedrive_client/od_main.py +++ b/onedrive_client/od_main.py @@ -12,14 +12,14 @@ import click import daemonocle.cli -from . import od_repo -from . import od_task -from . import od_threads -from . import od_webhook -from .od_tasks import start_repo, merge_dir, update_subscriptions -from .od_auth import get_authenticator_and_drives -from .od_context import load_context -from .od_watcher import LocalRepositoryWatcher +from onedrive_client import od_repo +from onedrive_client import od_task +from onedrive_client import od_threads +from onedrive_client import od_webhook +from onedrive_client.od_tasks import start_repo, merge_dir, update_subscriptions +from onedrive_client.od_auth import get_authenticator_and_drives +from onedrive_client.od_context import load_context +from onedrive_client.od_watcher import LocalRepositoryWatcher context = load_context(asyncio.get_event_loop()) diff --git a/onedrive_client/od_models/__init__.py b/onedrive_client/od_models/__init__.py index 5b69d39..bbbe962 100644 --- a/onedrive_client/od_models/__init__.py +++ b/onedrive_client/od_models/__init__.py @@ -1,4 +1,4 @@ -from . import ( +from onedrive_client.od_models import ( account_profile, bidict, drive_config, diff --git a/onedrive_client/od_models/dict_guard/__init__.py b/onedrive_client/od_models/dict_guard/__init__.py index 6aa4e49..4002996 100644 --- a/onedrive_client/od_models/dict_guard/__init__.py +++ b/onedrive_client/od_models/dict_guard/__init__.py @@ -1,6 +1,6 @@ import os -from . import exceptions +from onedrive_client.od_models.dict_guard import exceptions class DictEntryTypes: diff --git a/onedrive_client/od_models/webhook_notification.py b/onedrive_client/od_models/webhook_notification.py index 87c0ddc..be50c4c 100644 --- a/onedrive_client/od_models/webhook_notification.py +++ b/onedrive_client/od_models/webhook_notification.py @@ -8,7 +8,7 @@ :license: MIT """ -from .. import od_dateutils +from onedrive_client import od_dateutils class WebhookNotification: diff --git a/onedrive_client/od_pref.py b/onedrive_client/od_pref.py index 7682e3a..5379508 100755 --- a/onedrive_client/od_pref.py +++ b/onedrive_client/od_pref.py @@ -9,13 +9,13 @@ import keyring import tabulate -from . import __version__ -from . import mkdir, get_resource, od_i18n, od_auth -from .od_models import pretty_api, drive_config, account_profile -from .od_api_session import OneDriveAPISession, get_keyring_key -from .od_models.dict_guard import GuardedDict, exceptions as guard_errors -from .od_context import load_context, save_context -from .od_repo import get_drive_db_path +from onedrive_client import __version__ +from onedrive_client import mkdir, get_resource, od_i18n, od_auth +from onedrive_client.od_models import pretty_api, drive_config, account_profile +from onedrive_client.od_api_session import OneDriveAPISession, get_keyring_key +from onedrive_client.od_models.dict_guard import GuardedDict, exceptions as guard_errors +from onedrive_client.od_context import load_context, save_context +from onedrive_client.od_repo import get_drive_db_path context = load_context() diff --git a/onedrive_client/od_repo.py b/onedrive_client/od_repo.py index 008e808..6e445d7 100644 --- a/onedrive_client/od_repo.py +++ b/onedrive_client/od_repo.py @@ -13,10 +13,10 @@ from contextlib import closing -from . import get_resource as _get_resource -from .od_models.path_filter import PathFilter as _PathFilter -from .od_api_helper import get_item_modified_datetime, get_item_created_datetime -from .od_dateutils import str_to_datetime, datetime_to_str +from onedrive_client import get_resource as _get_resource +from onedrive_client.od_models.path_filter import PathFilter as _PathFilter +from onedrive_client.od_api_helper import get_item_modified_datetime, get_item_created_datetime +from onedrive_client.od_dateutils import str_to_datetime, datetime_to_str class ItemRecord: diff --git a/onedrive_client/od_tasks/delete_item.py b/onedrive_client/od_tasks/delete_item.py index b44fb68..d9ca694 100644 --- a/onedrive_client/od_tasks/delete_item.py +++ b/onedrive_client/od_tasks/delete_item.py @@ -2,8 +2,8 @@ import onedrivesdk.error -from . import update_item_base -from .. import od_api_helper +from onedrive_client.od_tasks import update_item_base +from onedrive_client import od_api_helper class DeleteRemoteItemTask(update_item_base.UpdateItemTaskBase): diff --git a/onedrive_client/od_tasks/download_file.py b/onedrive_client/od_tasks/download_file.py index 38744b9..947720c 100644 --- a/onedrive_client/od_tasks/download_file.py +++ b/onedrive_client/od_tasks/download_file.py @@ -3,12 +3,12 @@ import onedrivesdk.error -from . import base -from .. import fix_owner_and_timestamp -from ..od_api_helper import get_item_modified_datetime -from ..od_api_helper import item_request_call -from ..od_dateutils import datetime_to_timestamp -from ..od_hashutils import sha1_value +from onedrive_client.od_tasks import base +from onedrive_client import fix_owner_and_timestamp +from onedrive_client.od_api_helper import get_item_modified_datetime +from onedrive_client.od_api_helper import item_request_call +from onedrive_client.od_dateutils import datetime_to_timestamp +from onedrive_client.od_hashutils import sha1_value class DownloadFileTask(base.TaskBase): diff --git a/onedrive_client/od_tasks/merge_dir.py b/onedrive_client/od_tasks/merge_dir.py index fff0229..1083286 100644 --- a/onedrive_client/od_tasks/merge_dir.py +++ b/onedrive_client/od_tasks/merge_dir.py @@ -7,13 +7,15 @@ from onedrivesdk import Item, Folder, ChildrenCollectionRequest from send2trash import send2trash -from . import base -from . import delete_item, download_file, upload_file -from .. import mkdir, fix_owner_and_timestamp -from ..od_api_helper import get_item_modified_datetime, item_request_call -from ..od_dateutils import datetime_to_timestamp, diff_timestamps -from ..od_hashutils import hash_match, sha1_value -from ..od_repo import ItemRecordType +from onedrive_client.od_tasks import base, delete_item, download_file, upload_file +from onedrive_client import mkdir, fix_owner_and_timestamp +from onedrive_client.od_api_helper import ( + get_item_modified_datetime, + item_request_call, +) +from onedrive_client.od_dateutils import datetime_to_timestamp, diff_timestamps +from onedrive_client.od_hashutils import hash_match, sha1_value +from onedrive_client.od_repo import ItemRecordType def rename_with_suffix(parent_abspath, name, host_name): diff --git a/onedrive_client/od_tasks/move_item.py b/onedrive_client/od_tasks/move_item.py index ad8cdd7..b6bab3c 100644 --- a/onedrive_client/od_tasks/move_item.py +++ b/onedrive_client/od_tasks/move_item.py @@ -4,8 +4,8 @@ import onedrivesdk.error from onedrivesdk import Item, ItemReference -from . import update_mtime -from ..od_api_helper import item_request_call +from onedrive_client.od_tasks import update_mtime +from onedrive_client.od_api_helper import item_request_call class MoveItemTask(update_mtime.UpdateTimestampTask): diff --git a/onedrive_client/od_tasks/start_repo.py b/onedrive_client/od_tasks/start_repo.py index 9aeae75..5f2c1b9 100644 --- a/onedrive_client/od_tasks/start_repo.py +++ b/onedrive_client/od_tasks/start_repo.py @@ -1,8 +1,10 @@ import logging import os -from . import base -from . import merge_dir +from onedrive_client.od_tasks import ( + base, + merge_dir, +) class StartRepositoryTask(base.TaskBase): diff --git a/onedrive_client/od_tasks/update_item_base.py b/onedrive_client/od_tasks/update_item_base.py index 634aa75..d9b9571 100644 --- a/onedrive_client/od_tasks/update_item_base.py +++ b/onedrive_client/od_tasks/update_item_base.py @@ -1,4 +1,4 @@ -from . import base +from onedrive_client.od_tasks import base class UpdateItemTaskBase(base.TaskBase): diff --git a/onedrive_client/od_tasks/update_mtime.py b/onedrive_client/od_tasks/update_mtime.py index d964a33..c1bd144 100644 --- a/onedrive_client/od_tasks/update_mtime.py +++ b/onedrive_client/od_tasks/update_mtime.py @@ -5,11 +5,13 @@ import onedrivesdk.error from onedrivesdk import Item, FileSystemInfo -from . import update_item_base -from .. import fix_owner_and_timestamp -from ..od_api_helper import get_item_modified_datetime -from ..od_api_helper import item_request_call -from ..od_dateutils import datetime_to_timestamp +from onedrive_client.od_tasks import update_item_base +from onedrive_client import fix_owner_and_timestamp +from onedrive_client.od_api_helper import ( + get_item_modified_datetime, + item_request_call, +) +from onedrive_client.od_dateutils import datetime_to_timestamp class UpdateTimestampTask(update_item_base.UpdateItemTaskBase): diff --git a/onedrive_client/od_tasks/update_subscriptions.py b/onedrive_client/od_tasks/update_subscriptions.py index f700146..ed6d78c 100644 --- a/onedrive_client/od_tasks/update_subscriptions.py +++ b/onedrive_client/od_tasks/update_subscriptions.py @@ -4,11 +4,11 @@ import onedrivesdk import onedrivesdk.error -from .base import TaskBase -from .. import od_api_helper +from onedrive_client.od_tasks import base +from onedrive_client import od_api_helper -class UpdateSubscriptionTask(TaskBase): +class UpdateSubscriptionTask(base.TaskBase): def __init__(self, repo, task_pool, webhook_worker, subscription_id=None): """ diff --git a/onedrive_client/od_tasks/upload_file.py b/onedrive_client/od_tasks/upload_file.py index cfd38a1..d2c54c6 100644 --- a/onedrive_client/od_tasks/upload_file.py +++ b/onedrive_client/od_tasks/upload_file.py @@ -4,8 +4,8 @@ import onedrivesdk import onedrivesdk.error -from . import update_mtime -from ..od_api_helper import item_request_call +from onedrive_client.od_tasks import update_mtime +from onedrive_client.od_api_helper import item_request_call class UploadFileTask(update_mtime.UpdateTimestampTask): diff --git a/onedrive_client/od_watcher.py b/onedrive_client/od_watcher.py index 71cdb3c..3991e76 100644 --- a/onedrive_client/od_watcher.py +++ b/onedrive_client/od_watcher.py @@ -3,15 +3,25 @@ import threading import onedrivesdk.error -from inotify_simple import flags as _inotify_flags, masks as _inotify_masks, INotify as _INotify - -from .od_tasks import delete_item, move_item, merge_dir, update_mtime, upload_file -from .od_models.path_filter import PathFilter -from .od_models.bidict import loosebidict -from .od_api_helper import item_request_call -from .od_hashutils import hash_match -from .od_repo import ItemRecordType -from .od_stringutils import get_filename_with_incremented_count +from inotify_simple import ( + flags as _inotify_flags, + masks as _inotify_masks, + INotify as _INotify, +) + +from onedrive_client.od_tasks import ( + delete_item, + move_item, + merge_dir, + update_mtime, + upload_file, +) +from onedrive_client.od_models.path_filter import PathFilter +from onedrive_client.od_models.bidict import loosebidict +from onedrive_client.od_api_helper import item_request_call +from onedrive_client.od_hashutils import hash_match +from onedrive_client.od_repo import ItemRecordType +from onedrive_client.od_stringutils import get_filename_with_incremented_count class ParentTaskExistsException(Exception): diff --git a/onedrive_client/od_webhook.py b/onedrive_client/od_webhook.py index 23e7e6b..fbac415 100644 --- a/onedrive_client/od_webhook.py +++ b/onedrive_client/od_webhook.py @@ -7,7 +7,7 @@ import queue import urllib.parse -from .od_models.webhook_notification import WebhookNotification +from onedrive_client.od_models.webhook_notification import WebhookNotification try: JSONDecodeError = json.JSONDecodeError @@ -20,10 +20,10 @@ def get_webhook_server(context): :param onedrive_client.od_context.UserContext context: """ if context.config['webhook_type'] == 'direct': - from .od_webhooks.http_server import WebhookConfig, WebhookListener + from onedrive_client.od_webhooks.http_server import WebhookConfig, WebhookListener wh_config = WebhookConfig(host=context.config['webhook_host'], port=context.config['webhook_port']) elif context.config['webhook_type'] == 'ngrok': - from .od_webhooks.ngrok_server import WebhookConfig, WebhookListener + from onedrive_client.od_webhooks.ngrok_server import WebhookConfig, WebhookListener ngrok_config_file = context.config_dir + '/' + context.DEFAULT_NGROK_CONF_FILENAME if not os.path.isfile(ngrok_config_file): ngrok_config_file = None diff --git a/onedrive_client/od_webhooks/ngrok_server.py b/onedrive_client/od_webhooks/ngrok_server.py index 51c8484..fd11b15 100644 --- a/onedrive_client/od_webhooks/ngrok_server.py +++ b/onedrive_client/od_webhooks/ngrok_server.py @@ -7,7 +7,7 @@ import psutil import requests -from . import http_server +from onedrive_client.od_webhooks import http_server class WebhookConfig(http_server.WebhookConfig):