Sort imports

This commit is contained in:
Hugo Osvaldo Barrera 2021-07-25 18:34:41 +02:00
parent 0556e53e0c
commit 5b8f00e720
35 changed files with 57 additions and 59 deletions

View file

@ -8,7 +8,6 @@ from setuptools import Command
from setuptools import find_packages
from setuptools import setup
requirements = [
# https://github.com/mitsuhiko/click/issues/200
"click>=5.0,<9.0",

View file

@ -8,8 +8,8 @@ import aiohttp
import click_log
import pytest
from hypothesis import HealthCheck
from hypothesis import settings
from hypothesis import Verbosity
from hypothesis import settings
@pytest.fixture(autouse=True)

View file

@ -7,15 +7,16 @@ from urllib.parse import unquote as urlunquote
import aiostream
import pytest
from .. import assert_item_equals
from .. import EVENT_TEMPLATE
from .. import normalize_item
from .. import TASK_TEMPLATE
from .. import VCARD_TEMPLATE
from vdirsyncer import exceptions
from vdirsyncer.storage.base import normalize_meta_value
from vdirsyncer.vobject import Item
from .. import EVENT_TEMPLATE
from .. import TASK_TEMPLATE
from .. import VCARD_TEMPLATE
from .. import assert_item_equals
from .. import normalize_item
def get_server_mixin(server_name):
from . import __name__ as base

View file

@ -5,12 +5,12 @@ import aiohttp
import aiostream
import pytest
from .. import get_server_mixin
from .. import StorageTests
from tests import assert_item_equals
from vdirsyncer import exceptions
from vdirsyncer.vobject import Item
from .. import StorageTests
from .. import get_server_mixin
dav_server = os.environ.get("DAV_SERVER", "skip")
ServerMixin = get_server_mixin(dav_server)

View file

@ -6,15 +6,16 @@ import aiostream
import pytest
from aioresponses import aioresponses
from . import dav_server
from . import DAVStorageTests
from .. import format_item
from tests import EVENT_TEMPLATE
from tests import TASK_TEMPLATE
from tests import VCARD_TEMPLATE
from vdirsyncer import exceptions
from vdirsyncer.storage.dav import CalDAVStorage
from .. import format_item
from . import DAVStorageTests
from . import dav_server
class TestCalDAVStorage(DAVStorageTests):
storage_class = CalDAVStorage

View file

@ -1,8 +1,9 @@
import pytest
from . import DAVStorageTests
from vdirsyncer.storage.dav import CardDAVStorage
from . import DAVStorageTests
class TestCardDAVStorage(DAVStorageTests):
storage_class = CardDAVStorage

View file

@ -5,10 +5,10 @@ import sys
import pytest
import requests
from .. import StorageTests
from vdirsyncer.storage.etesync import EtesyncCalendars
from vdirsyncer.storage.etesync import EtesyncContacts
from .. import StorageTests
pytestmark = pytest.mark.skipif(
os.getenv("ETESYNC_TESTS", "") != "true", reason="etesync tests disabled"

View file

@ -3,10 +3,11 @@ import subprocess
import aiostream
import pytest
from . import StorageTests
from vdirsyncer.storage.filesystem import FilesystemStorage
from vdirsyncer.vobject import Item
from . import StorageTests
class TestFilesystemStorage(StorageTests):
storage_class = FilesystemStorage

View file

@ -1,6 +1,6 @@
import pytest
from aioresponses import aioresponses
from aioresponses import CallbackResult
from aioresponses import aioresponses
from tests import normalize_item
from vdirsyncer.exceptions import UserError

View file

@ -1,13 +1,14 @@
import aiostream
import pytest
from aioresponses import aioresponses
from aioresponses import CallbackResult
from aioresponses import aioresponses
import vdirsyncer.storage.http
from . import StorageTests
from vdirsyncer.storage.base import Storage
from vdirsyncer.storage.singlefile import SingleFileStorage
from . import StorageTests
class CombinedStorage(Storage):
"""A subclass of HttpStorage to make testing easier. It supports writes via

View file

@ -1,8 +1,9 @@
import pytest
from . import StorageTests
from vdirsyncer.storage.memory import MemoryStorage
from . import StorageTests
class TestMemoryStorage(StorageTests):

View file

@ -1,8 +1,9 @@
import pytest
from . import StorageTests
from vdirsyncer.storage.singlefile import SingleFileStorage
from . import StorageTests
class TestSingleFileStorage(StorageTests):

View file

@ -7,7 +7,6 @@ from vdirsyncer import cli
from vdirsyncer import exceptions
from vdirsyncer.cli.config import Config
invalid = object()

View file

@ -3,7 +3,6 @@ import pytest
from vdirsyncer.cli.discover import expand_collections
missing = object()

View file

@ -6,8 +6,8 @@ import pytest
from hypothesis import given
from vdirsyncer import exceptions
from vdirsyncer.cli.fetchparams import expand_fetch_params
from vdirsyncer.cli.fetchparams import STRATEGIES
from vdirsyncer.cli.fetchparams import expand_fetch_params
@pytest.fixture

View file

@ -4,7 +4,6 @@ from hypothesis import given
from vdirsyncer.sync.status import SqliteStatus
status_dict_strategy = st.dictionaries(
st.text(),
st.tuples(

View file

@ -6,13 +6,13 @@ import hypothesis.strategies as st
import pytest
from hypothesis import assume
from hypothesis.stateful import Bundle
from hypothesis.stateful import rule
from hypothesis.stateful import RuleBasedStateMachine
from hypothesis.stateful import rule
from tests import blow_up
from tests import uid_strategy
from vdirsyncer.storage.memory import _random_string
from vdirsyncer.storage.memory import MemoryStorage
from vdirsyncer.storage.memory import _random_string
from vdirsyncer.sync import sync as _sync
from vdirsyncer.sync.exceptions import BothReadOnly
from vdirsyncer.sync.exceptions import IdentConflict

View file

@ -5,9 +5,9 @@ from hypothesis import given
from tests import blow_up
from vdirsyncer.exceptions import UserError
from vdirsyncer.metasync import MetaSyncConflict
from vdirsyncer.metasync import logger
from vdirsyncer.metasync import metasync
from vdirsyncer.metasync import MetaSyncConflict
from vdirsyncer.storage.base import normalize_meta_value
from vdirsyncer.storage.memory import MemoryStorage

View file

@ -1,7 +1,7 @@
import aiostream
import pytest
from hypothesis import given
from hypothesis import HealthCheck
from hypothesis import given
from hypothesis import settings
from tests import uid_strategy

View file

@ -5,17 +5,16 @@ import pytest
from hypothesis import assume
from hypothesis import given
from hypothesis.stateful import Bundle
from hypothesis.stateful import rule
from hypothesis.stateful import RuleBasedStateMachine
from hypothesis.stateful import rule
import vdirsyncer.vobject as vobject
from tests import BARE_EVENT_TEMPLATE
from tests import EVENT_TEMPLATE
from tests import EVENT_WITH_TIMEZONE_TEMPLATE
from tests import VCARD_TEMPLATE
from tests import normalize_item
from tests import uid_strategy
from tests import VCARD_TEMPLATE
_simple_split = [
VCARD_TEMPLATE.format(r=123, uid=123),

View file

@ -8,9 +8,8 @@ import aiohttp
import click
import click_log
from .. import __version__
from .. import BUGTRACKER_HOME
from .. import __version__
cli_logger = logging.getLogger(__name__)
click_log.basic_config("vdirsyncer")
@ -124,7 +123,8 @@ def sync(ctx, collections, force_delete):
# Sync only "first_collection" from the pair "bob"
vdirsyncer sync bob/first_collection
"""
from .tasks import prepare_pair, sync_collection
from .tasks import prepare_pair
from .tasks import sync_collection
async def main(collections):
conn = aiohttp.TCPConnector(limit_per_host=16)
@ -162,7 +162,8 @@ def metasync(ctx, collections):
See the `sync` command for usage.
"""
from .tasks import prepare_pair, metasync_collection
from .tasks import metasync_collection
from .tasks import prepare_pair
async def main(collections):
conn = aiohttp.TCPConnector(limit_per_host=16)

View file

@ -6,14 +6,13 @@ import string
from configparser import RawConfigParser
from itertools import chain
from .. import exceptions
from .. import PROJECT_HOME
from .. import exceptions
from ..utils import cached_property
from ..utils import expand_path
from .fetchparams import expand_fetch_params
from .utils import storage_class_from_config
GENERAL_ALL = frozenset(["status_path"])
GENERAL_REQUIRED = frozenset(["status_path"])
SECTION_NAME_CHARS = frozenset(chain(string.ascii_letters, string.digits, "_"))
@ -320,8 +319,8 @@ load_config = Config.from_filename_or_environment
def _resolve_conflict_via_command(a, b, command, a_name, b_name, _check_call=None):
import tempfile
import shutil
import tempfile
if _check_call is None:
from subprocess import check_call as _check_call

View file

@ -15,7 +15,6 @@ from .utils import save_status
from .utils import storage_class_from_config
from .utils import storage_instance_from_config
# Increase whenever upgrade potentially breaks discovery cache and collections
# should be re-discovered
DISCOVERY_CACHE_VERSION = 1

View file

@ -2,10 +2,10 @@ import logging
import click
from . import AppContext
from .. import exceptions
from ..utils import expand_path
from ..utils import synchronized
from . import AppContext
SUFFIX = ".fetch"

View file

@ -8,10 +8,10 @@ from .config import CollectionConfig
from .discover import collections_for_pair
from .discover import storage_class_from_config
from .discover import storage_instance_from_config
from .utils import JobFailed
from .utils import cli_logger
from .utils import get_status_name
from .utils import handle_cli_error
from .utils import JobFailed
from .utils import load_status
from .utils import manage_sync_status
from .utils import save_status

View file

@ -9,7 +9,6 @@ import aiohttp
import click
from atomicwrites import atomic_write
from . import cli_logger
from .. import BUGTRACKER_HOME
from .. import DOCS_HOME
from .. import exceptions
@ -20,7 +19,7 @@ from ..sync.exceptions import SyncConflict
from ..sync.status import SqliteStatus
from ..utils import expand_path
from ..utils import get_storage_init_args
from . import cli_logger
STATUS_PERMISSIONS = 0o600
STATUS_DIR_PERMISSIONS = 0o700

View file

@ -2,12 +2,11 @@ import logging
import aiohttp
from . import __version__
from . import DOCS_HOME
from . import __version__
from . import exceptions
from .utils import expand_path
logger = logging.getLogger(__name__)
USERAGENT = f"vdirsyncer/{__version__}"

View file

@ -8,18 +8,18 @@ from inspect import signature
import aiohttp
import aiostream
from vdirsyncer.exceptions import Error
from .. import exceptions
from .. import http
from .. import utils
from ..http import USERAGENT
from ..http import prepare_auth
from ..http import prepare_client_cert
from ..http import prepare_verify
from ..http import USERAGENT
from ..vobject import Item
from .base import normalize_meta_value
from .base import Storage
from vdirsyncer.exceptions import Error
from .base import normalize_meta_value
dav_logger = logging.getLogger(__name__)

View file

@ -10,7 +10,10 @@ import click
try:
import etesync
import etesync.exceptions
from etesync import AddressBook, Contact, Calendar, Event
from etesync import AddressBook
from etesync import Calendar
from etesync import Contact
from etesync import Event
has_etesync = True
except ImportError:
@ -21,10 +24,8 @@ from .. import exceptions
from ..cli.utils import assert_permissions
from ..utils import checkdir
from ..vobject import Item
from .base import Storage
logger = logging.getLogger(__name__)

View file

@ -11,8 +11,8 @@ from ..utils import expand_path
from ..utils import generate_href
from ..utils import get_etag_from_file
from ..vobject import Item
from .base import normalize_meta_value
from .base import Storage
from .base import normalize_meta_value
logger = logging.getLogger(__name__)

View file

@ -8,12 +8,12 @@ import aiohttp
import click
from atomicwrites import atomic_write
from . import base
from . import dav
from .. import exceptions
from ..utils import checkdir
from ..utils import expand_path
from ..utils import open_graphical_browser
from . import base
from . import dav
logger = logging.getLogger(__name__)

View file

@ -3,11 +3,11 @@ import urllib.parse as urlparse
import aiohttp
from .. import exceptions
from ..http import USERAGENT
from ..http import prepare_auth
from ..http import prepare_client_cert
from ..http import prepare_verify
from ..http import request
from ..http import USERAGENT
from ..vobject import Item
from ..vobject import split_collection
from .base import Storage

View file

@ -1,8 +1,8 @@
import random
from .. import exceptions
from .base import normalize_meta_value
from .base import Storage
from .base import normalize_meta_value
def _random_string():

View file

@ -6,7 +6,6 @@ from inspect import getfullargspec
from . import exceptions
# This is only a subset of the chars allowed per the spec. In particular `@` is
# not included, because there are some servers that (incorrectly) encode it to
# `%40` when it's part of a URL path, and reject or "repair" URLs that contain

View file

@ -5,7 +5,6 @@ from itertools import tee
from .utils import cached_property
from .utils import uniq
IGNORE_PROPS = (
# PRODID is changed by radicale for some reason after upload
"PRODID",