Skip to content

Commit 9474485

Browse files
committed
Use isort to keep imports sorted
Disable hacking H301 and H306 which aren't compatible with isort.
1 parent 73e0a41 commit 9474485

File tree

14 files changed

+23
-24
lines changed

14 files changed

+23
-24
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
extend-ignore = E203, E266, E501
2+
extend-ignore = E203, E266, E501, H301, H306
33
# line length is intentionally set to 80 here because black uses Bugbear
44
# See https://github.com/psf/black/blob/master/docs/the_black_code_style.md#line-length for more details
55
max-line-length = 80

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ exclude = '''
1212
)/
1313
)
1414
'''
15+
16+
[tool.isort]
17+
profile = "black"
18+
multi_line_output = 3
19+
20+
known_first_party = ["testinfra"]

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
def local_scheme(version):
1818
"""Generate a PEP440 compatible version if PEP440_VERSION is enabled"""
1919
import os
20+
2021
import setuptools_scm.version # only present during setup time
2122

2223
return (

test/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
import pytest
2222

2323
import testinfra
24-
from testinfra.backend.base import BaseBackend
2524
from testinfra.backend import parse_hostspec
26-
25+
from testinfra.backend.base import BaseBackend
2726

2827
BASETESTDIR = os.path.abspath(os.path.dirname(__file__))
2928
BASEDIR = os.path.abspath(os.path.join(BASETESTDIR, os.pardir))

test/test_backends.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
import operator
1414
import os
15-
import pytest
1615
import tempfile
1716

17+
import pytest
18+
1819
import testinfra
1920
import testinfra.backend
20-
from testinfra.backend.base import BaseBackend
21-
from testinfra.backend.base import HostSpec
21+
from testinfra.backend.base import BaseBackend, HostSpec
2222
from testinfra.backend.winrm import _quote
2323
from testinfra.utils.ansible_runner import AnsibleRunner
2424

test/test_modules.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
import crypt
1414
import datetime
1515
import os
16-
import pytest
1716
import re
1817
import time
18+
from ipaddress import IPv4Address, IPv6Address, ip_address
1919

20-
from ipaddress import ip_address
21-
from ipaddress import IPv4Address
22-
from ipaddress import IPv6Address
23-
20+
import pytest
2421

2522
from testinfra.modules.socket import parse_socketspec
2623

testinfra/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
1212

13-
from testinfra.host import get_host
14-
from testinfra.host import get_hosts
13+
from testinfra.host import get_host, get_hosts
1514

1615
__all__ = ["get_host", "get_hosts"]

testinfra/backend/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import os
1515
import urllib.parse
1616

17-
1817
BACKENDS = {
1918
"local": "testinfra.backend.local.LocalBackend",
2019
"ssh": "testinfra.backend.ssh.SshBackend",

testinfra/backend/winrm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# limitations under the License.
1212

1313
import re
14+
1415
from testinfra.backend import base
1516

1617
try:

testinfra/modules/socket.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
# limitations under the License.
1212

1313
import socket
14-
from typing import List
15-
from typing import Optional
16-
from typing import Tuple
14+
from typing import List, Optional, Tuple
1715

1816
from testinfra.modules.base import Module
1917
from testinfra.utils import cached_property

0 commit comments

Comments
 (0)