Skip to content

Commit b1b4dd9

Browse files
author
Hugo Osvaldo Barrera
committed
Sort imports
I don't want to ever have to sort imports again. It's a poor use of developer time. Automate this with a pre-commit hook, and check this on CI. Developers: I suggest you configure your editor to use `reorder_python_imports`. It uses the standard sorting, and detects first/third party libs well.
1 parent 9cb1f8d commit b1b4dd9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+196
-156
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ repos:
1414
hooks:
1515
- id: flake8
1616
additional_dependencies: [flake8-import-order, flake8-bugbear]
17+
- repo: https://github.com/asottile/reorder_python_imports
18+
rev: v2.3.0
19+
hooks:
20+
- id: reorder-python-imports
1721
- repo: local
1822
hooks:
1923
- id: update-travis

scripts/make_travisconf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
32
import itertools
43
import json
54

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
Please refer to https://vdirsyncer.pimutils.org/en/stable/packaging.html for
55
how to package vdirsyncer.
66
'''
7-
8-
9-
from setuptools import Command, find_packages, setup
7+
from setuptools import Command
8+
from setuptools import find_packages
9+
from setuptools import setup
1010

1111

1212
requirements = [

tests/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
'''
22
Test suite for vdirsyncer.
33
'''
4-
54
import hypothesis.strategies as st
5+
import urllib3.exceptions
66

77
from vdirsyncer.vobject import normalize_item
88

9-
import urllib3
10-
import urllib3.exceptions
11-
129
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
1310

1411

tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import os
66

77
import click_log
8-
9-
from hypothesis import HealthCheck, Verbosity, settings
10-
118
import pytest
9+
from hypothesis import HealthCheck
10+
from hypothesis import settings
11+
from hypothesis import Verbosity
1212

1313

1414
@pytest.fixture(autouse=True)

tests/storage/__init__.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
import random
2-
import uuid
3-
42
import textwrap
5-
from urllib.parse import quote as urlquote, unquote as urlunquote
3+
import uuid
4+
from urllib.parse import quote as urlquote
5+
from urllib.parse import unquote as urlunquote
66

77
import hypothesis.strategies as st
8-
from hypothesis import given
9-
108
import pytest
9+
from hypothesis import given
1110

11+
from .. import assert_item_equals
12+
from .. import EVENT_TEMPLATE
13+
from .. import normalize_item
14+
from .. import printable_characters_strategy
15+
from .. import TASK_TEMPLATE
16+
from .. import VCARD_TEMPLATE
1217
from vdirsyncer import exceptions
1318
from vdirsyncer.storage.base import normalize_meta_value
1419
from vdirsyncer.vobject import Item
1520

16-
from .. import EVENT_TEMPLATE, TASK_TEMPLATE, VCARD_TEMPLATE, \
17-
assert_item_equals, normalize_item, printable_characters_strategy
18-
1921

2022
def get_server_mixin(server_name):
2123
from . import __name__ as base

tests/storage/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import pytest
2-
31
import uuid
42

3+
import pytest
4+
55

66
@pytest.fixture
77
def slow_create_collection(request):

tests/storage/dav/__init__.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
import uuid
2-
31
import os
2+
import uuid
43

54
import pytest
6-
7-
import requests
85
import requests.exceptions
96

7+
from .. import get_server_mixin
8+
from .. import StorageTests
109
from tests import assert_item_equals
11-
1210
from vdirsyncer import exceptions
1311
from vdirsyncer.vobject import Item
1412

15-
from .. import StorageTests, get_server_mixin
16-
1713

1814
dav_server = os.environ.get('DAV_SERVER', 'skip')
1915
ServerMixin = get_server_mixin(dav_server)

tests/storage/dav/test_caldav.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22
from textwrap import dedent
33

44
import pytest
5-
6-
import requests
75
import requests.exceptions
86

9-
from tests import EVENT_TEMPLATE, TASK_TEMPLATE, VCARD_TEMPLATE
10-
7+
from . import dav_server
8+
from . import DAVStorageTests
9+
from .. import format_item
10+
from tests import EVENT_TEMPLATE
11+
from tests import TASK_TEMPLATE
12+
from tests import VCARD_TEMPLATE
1113
from vdirsyncer import exceptions
1214
from vdirsyncer.storage.dav import CalDAVStorage
1315

14-
from . import DAVStorageTests, dav_server
15-
from .. import format_item
16-
1716

1817
class TestCalDAVStorage(DAVStorageTests):
1918
storage_class = CalDAVStorage

tests/storage/dav/test_carddav.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import pytest
22

3-
from vdirsyncer.storage.dav import CardDAVStorage
4-
53
from . import DAVStorageTests
4+
from vdirsyncer.storage.dav import CardDAVStorage
65

76

87
class TestCardDAVStorage(DAVStorageTests):

0 commit comments

Comments
 (0)