$ isort aiosmtpd
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/smtp.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/__init__.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/controller.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/handlers.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/qa/test_1testsuite.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/docs/conf.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/docs/_exts/autoprogramm.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/test_main.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/test_starttls.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/conftest.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/test_smtp.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/test_proxyprotocol.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/test_handlers.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/test_smtps.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/test_server.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/test_smtpsmuggling.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/tests/test_lmtp.py
Fixing /var/cache/github/aio-libs/aiosmtpd/aiosmtpd/testing/helpers.py
$ git diff
diff --git a/aiosmtpd/__init__.py b/aiosmtpd/__init__.py
index e6e714a..b52f290 100644
--- a/aiosmtpd/__init__.py
+++ b/aiosmtpd/__init__.py
@@ -3,7 +3,6 @@
import asyncio
import warnings
-
__version__ = "1.4.6"
diff --git a/aiosmtpd/controller.py b/aiosmtpd/controller.py
index 8efa33e..78dd29c 100644
--- a/aiosmtpd/controller.py
+++ b/aiosmtpd/controller.py
@@ -10,9 +10,14 @@ import time
from abc import ABCMeta, abstractmethod
from contextlib import ExitStack
from pathlib import Path
-from socket import AF_INET6, SOCK_STREAM, create_connection, has_ipv6
-from socket import socket as makesock
-from socket import timeout as socket_timeout
+from socket import (
+ AF_INET6,
+ SOCK_STREAM,
+ create_connection,
+ has_ipv6,
+ socket as makesock,
+ timeout as socket_timeout,
+)
try:
from socket import AF_UNIX
diff --git a/aiosmtpd/docs/_exts/autoprogramm.py b/aiosmtpd/docs/_exts/autoprogramm.py
index ea4a5cf..eb13174 100644
--- a/aiosmtpd/docs/_exts/autoprogramm.py
+++ b/aiosmtpd/docs/_exts/autoprogramm.py
@@ -41,7 +41,6 @@ from docutils.parsers.rst.directives import unchanged # pytype: disable=pyi-err
from docutils.statemachine import StringList
from sphinx.util.nodes import nested_parse_with_titles
-
__all__ = ("AutoprogrammDirective", "import_object", "scan_programs", "setup")
diff --git a/aiosmtpd/docs/conf.py b/aiosmtpd/docs/conf.py
index 44a6422..230895f 100644
--- a/aiosmtpd/docs/conf.py
+++ b/aiosmtpd/docs/conf.py
@@ -92,6 +92,7 @@ copyright = f"2015-{datetime.datetime.now().year}, {author}"
#
from aiosmtpd import __version__ # noqa: E402
+
# "noqa: E402" used to silence flake8 protest
release = __version__
diff --git a/aiosmtpd/handlers.py b/aiosmtpd/handlers.py
index 94a2fc8..086ba5f 100644
--- a/aiosmtpd/handlers.py
+++ b/aiosmtpd/handlers.py
@@ -20,14 +20,16 @@ from abc import ABCMeta, abstractmethod
from argparse import ArgumentParser
from email.message import Message as Em_Message
from email.parser import BytesParser, Parser
-from typing import Any, List, TextIO, Type, TypeVar, Optional, Union
+from typing import Any, List, Optional, TextIO, Type, TypeVar, Union
from public import public
from aiosmtpd import _get_or_new_eventloop
-from aiosmtpd.smtp import SMTP as SMTPServer
-from aiosmtpd.smtp import Envelope as SMTPEnvelope
-from aiosmtpd.smtp import Session as SMTPSession
+from aiosmtpd.smtp import (
+ SMTP as SMTPServer,
+ Envelope as SMTPEnvelope,
+ Session as SMTPSession,
+)
T = TypeVar("T")
diff --git a/aiosmtpd/qa/test_1testsuite.py b/aiosmtpd/qa/test_1testsuite.py
index db20c61..2d83a5f 100644
--- a/aiosmtpd/qa/test_1testsuite.py
+++ b/aiosmtpd/qa/test_1testsuite.py
@@ -4,12 +4,12 @@
"""Test the sanity of the test suite itself"""
import re
-import pytest
import socket
-
-from aiosmtpd.testing import statuscodes
from itertools import combinations
+import pytest
+
+from aiosmtpd.testing import statuscodes
ENFORCE_ENHANCED_STATUS_CODES = False
"""Whether to do strict compliance checking against RFC 2034 § 4"""
diff --git a/aiosmtpd/smtp.py b/aiosmtpd/smtp.py
index fd1fb5a..dde8919 100644
--- a/aiosmtpd/smtp.py
+++ b/aiosmtpd/smtp.py
@@ -39,7 +39,6 @@ from public import public
from aiosmtpd import __version__, _get_or_new_eventloop
from aiosmtpd.proxy_protocol import ProxyData, get_proxy
-
# region #### Custom Data Types #######################################################
class _Missing(enum.Enum):
diff --git a/aiosmtpd/testing/helpers.py b/aiosmtpd/testing/helpers.py
index 8ee630a..179033b 100644
--- a/aiosmtpd/testing/helpers.py
+++ b/aiosmtpd/testing/helpers.py
@@ -12,7 +12,7 @@ import time
from smtplib import SMTP as SMTP_Client
from typing import List
-from aiosmtpd.smtp import Envelope, Session, SMTP
+from aiosmtpd.smtp import SMTP, Envelope, Session
ASYNCIO_CATCHUP_DELAY = float(os.environ.get("ASYNCIO_CATCHUP_DELAY", 0.1))
"""
diff --git a/aiosmtpd/tests/conftest.py b/aiosmtpd/tests/conftest.py
index 66c4bfd..6c8519b 100644
--- a/aiosmtpd/tests/conftest.py
+++ b/aiosmtpd/tests/conftest.py
@@ -6,10 +6,10 @@ import inspect
import socket
import ssl
import warnings
+from collections.abc import Iterator
from contextlib import suppress
from functools import wraps
from smtplib import SMTP as SMTPClient
-from collections.abc import Iterator
from typing import Any, Callable, Generator, NamedTuple, Optional, Type, TypeVar
import pytest
diff --git a/aiosmtpd/tests/test_handlers.py b/aiosmtpd/tests/test_handlers.py
index 392689d..5c55e29 100644
--- a/aiosmtpd/tests/test_handlers.py
+++ b/aiosmtpd/tests/test_handlers.py
@@ -15,16 +15,18 @@ from typing import AnyStr, Callable, Generator, Type, TypeVar, Union
import pytest
-from aiosmtpd.controller import Controller
-from aiosmtpd.handlers import AsyncMessage, Debugging, Mailbox, Proxy, Sink
-from aiosmtpd.handlers import Message as AbstractMessageHandler
-from aiosmtpd.smtp import SMTP as Server
-from aiosmtpd.smtp import Session as ServerSession
-from aiosmtpd.smtp import Envelope
-from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES as S
-from aiosmtpd.testing.statuscodes import StatusCode
-
from .conftest import Global, controller_data, handler_data
+from aiosmtpd.controller import Controller
+from aiosmtpd.handlers import (
+ AsyncMessage,
+ Debugging,
+ Mailbox,
+ Message as AbstractMessageHandler,
+ Proxy,
+ Sink,
+)
+from aiosmtpd.smtp import SMTP as Server, Envelope, Session as ServerSession
+from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES as S, StatusCode
try:
from typing_extensions import Protocol
diff --git a/aiosmtpd/tests/test_lmtp.py b/aiosmtpd/tests/test_lmtp.py
index c1d43d4..b1fc17e 100644
--- a/aiosmtpd/tests/test_lmtp.py
+++ b/aiosmtpd/tests/test_lmtp.py
@@ -8,13 +8,12 @@ from typing import Generator
import pytest
+from .conftest import Global
from aiosmtpd.controller import Controller
from aiosmtpd.handlers import Sink
from aiosmtpd.lmtp import LMTP
from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES as S
-from .conftest import Global
-
class LMTPController(Controller):
def factory(self):
diff --git a/aiosmtpd/tests/test_main.py b/aiosmtpd/tests/test_main.py
index 3f47bbf..98eaaf1 100644
--- a/aiosmtpd/tests/test_main.py
+++ b/aiosmtpd/tests/test_main.py
@@ -9,8 +9,7 @@ import sys
import time
from contextlib import contextmanager
from multiprocessing.synchronize import Event as MP_Event
-from smtplib import SMTP as SMTPClient
-from smtplib import SMTP_SSL
+from smtplib import SMTP as SMTPClient, SMTP_SSL
from typing import Generator
import pytest
diff --git a/aiosmtpd/tests/test_proxyprotocol.py b/aiosmtpd/tests/test_proxyprotocol.py
index 02ec5f3..cacccec 100644
--- a/aiosmtpd/tests/test_proxyprotocol.py
+++ b/aiosmtpd/tests/test_proxyprotocol.py
@@ -13,8 +13,7 @@ from base64 import b64decode
from contextlib import contextmanager, suppress
from functools import partial
from ipaddress import IPv4Address, IPv6Address
-from smtplib import SMTP as SMTPClient
-from smtplib import SMTPServerDisconnected
+from smtplib import SMTP as SMTPClient, SMTPServerDisconnected
from typing import Any, Callable, Dict, List, Optional
import pytest
@@ -22,9 +21,9 @@ from pytest_mock import MockFixture
from aiosmtpd.handlers import Sink
from aiosmtpd.proxy_protocol import (
- V2_CMD,
AF,
PROTO,
+ V2_CMD,
V2_SIGNATURE,
AsyncReader,
MalformedTLV,
@@ -33,9 +32,11 @@ from aiosmtpd.proxy_protocol import (
UnknownTypeTLV,
get_proxy,
)
-from aiosmtpd.smtp import SMTP as SMTPServer
-from aiosmtpd.smtp import Session as SMTPSession
-from aiosmtpd.smtp import Envelope as SMTPEnvelope
+from aiosmtpd.smtp import (
+ SMTP as SMTPServer,
+ Envelope as SMTPEnvelope,
+ Session as SMTPSession,
+)
from aiosmtpd.tests.conftest import Global, controller_data, handler_data
DEFAULT_AUTOCANCEL = 0.1
diff --git a/aiosmtpd/tests/test_server.py b/aiosmtpd/tests/test_server.py
index 829361a..ee47d9c 100644
--- a/aiosmtpd/tests/test_server.py
+++ b/aiosmtpd/tests/test_server.py
@@ -11,32 +11,30 @@ import sys
import time
from contextlib import ExitStack
from functools import partial
-from threading import Event
from pathlib import Path
from smtplib import SMTP as SMTPClient, SMTPServerDisconnected
from tempfile import mkdtemp
-from threading import Thread
+from threading import Event, Thread
from typing import Generator, Optional
import pytest
from pytest_mock import MockFixture
+from .conftest import AUTOSTOP_DELAY, Global
from aiosmtpd.controller import (
Controller,
UnixSocketController,
- UnthreadedController,
UnixSocketMixin,
UnixSocketUnthreadedController,
+ UnthreadedController,
_FakeServer,
- get_localhost,
_server_to_client_ssl_ctx,
+ get_localhost,
)
from aiosmtpd.handlers import Sink
from aiosmtpd.smtp import SMTP as Server
from aiosmtpd.testing.helpers import catchup_delay
-from .conftest import Global, AUTOSTOP_DELAY
-
class SlowStartController(Controller):
def __init__(self, *args, **kwargs):
diff --git a/aiosmtpd/tests/test_smtp.py b/aiosmtpd/tests/test_smtp.py
index 008ba8c..b683cb2 100644
--- a/aiosmtpd/tests/test_smtp.py
+++ b/aiosmtpd/tests/test_smtp.py
@@ -21,7 +21,7 @@ from smtplib import (
SMTPServerDisconnected,
)
from textwrap import dedent
-from typing import cast, Any, Callable, Generator, List, Tuple, Union
+from typing import Any, Callable, Generator, List, Tuple, Union, cast
import pytest
from pytest_mock import MockFixture
diff --git a/aiosmtpd/tests/test_smtps.py b/aiosmtpd/tests/test_smtps.py
index 22d33cc..4e33f34 100644
--- a/aiosmtpd/tests/test_smtps.py
+++ b/aiosmtpd/tests/test_smtps.py
@@ -9,12 +9,11 @@ from typing import Generator, Union
import pytest
+from .conftest import Global
from aiosmtpd.controller import Controller
from aiosmtpd.testing.helpers import ReceivingHandler
from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES as S
-from .conftest import Global
-
@pytest.fixture
def ssl_controller(
diff --git a/aiosmtpd/tests/test_smtpsmuggling.py b/aiosmtpd/tests/test_smtpsmuggling.py
index 32ce4d2..d13ceb1 100644
--- a/aiosmtpd/tests/test_smtpsmuggling.py
+++ b/aiosmtpd/tests/test_smtpsmuggling.py
@@ -3,14 +3,13 @@
"""Test SMTP smuggling."""
-import smtplib
import re
+import smtplib
+from .conftest import handler_data
from aiosmtpd.testing.helpers import ReceivingHandler
from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES as S
-from .conftest import handler_data
-
def new_data(self, msg):
self.putcmd("data")
diff --git a/aiosmtpd/tests/test_starttls.py b/aiosmtpd/tests/test_starttls.py
index 5e0a180..b57812b 100644
--- a/aiosmtpd/tests/test_starttls.py
+++ b/aiosmtpd/tests/test_starttls.py
@@ -9,17 +9,13 @@ from typing import Generator
import pytest
+from .conftest import Global, handler_data
from aiosmtpd.controller import Controller
from aiosmtpd.handlers import Sink
-from aiosmtpd.smtp import SMTP as Server
-from aiosmtpd.smtp import Envelope
-from aiosmtpd.smtp import Session as Sess_
-from aiosmtpd.smtp import TLSSetupException
+from aiosmtpd.smtp import SMTP as Server, Envelope, Session as Sess_, TLSSetupException
from aiosmtpd.testing.helpers import ReceivingHandler, catchup_delay
from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES as S
-from .conftest import Global, handler_data
-
# region #### Harness Classes & Functions #############################################
flake8 --select "I1 I2" aiosmtpd
aiosmtpd/controller.py:21:1: I202 Additional newline in a group of imports. 'from typing import Any, Awaitable, Dict, Literal, Optional, Union' is identified as Stdlib and 'from socket import timeout' is identified as Stdlib.
aiosmtpd/handlers.py:23:1: I101 Imported names are in the wrong order. Should be Any, List, Optional, TextIO, Type, TypeVar, Union
aiosmtpd/handlers.py:29:1: I100 Import statements are in the wrong order. 'from aiosmtpd.smtp import Envelope' should be before 'from aiosmtpd.smtp import SMTP'
aiosmtpd/qa/test_0packaging.py:15:1: I202 Additional newline in a group of imports. 'from packaging import version' is identified as Third Party and 'import pytest' is identified as Third Party.
aiosmtpd/qa/test_1testsuite.py:7:1: I201 Missing newline between import groups. 'import pytest' is identified as Third Party and 'import re' is identified as Stdlib.
aiosmtpd/qa/test_1testsuite.py:8:1: I100 Import statements are in the wrong order. 'import socket' should be before 'import pytest' and in a different group.
aiosmtpd/qa/test_1testsuite.py:8:1: I201 Missing newline between import groups. 'import socket' is identified as Stdlib and 'import pytest' is identified as Third Party.
aiosmtpd/qa/test_1testsuite.py:11:1: I100 Import statements are in the wrong order. 'from itertools import combinations' should be before 'from aiosmtpd.testing import statuscodes' and in a different group.
aiosmtpd/qa/test_1testsuite.py:11:1: I201 Missing newline between import groups. 'from itertools import combinations' is identified as Stdlib and 'from aiosmtpd.testing import statuscodes' is identified as Application.
aiosmtpd/testing/helpers.py:15:1: I101 Imported names are in the wrong order. Should be Envelope, SMTP, Session
aiosmtpd/tests/conftest.py:12:1: I100 Import statements are in the wrong order. 'from collections.abc import Iterator' should be before 'from smtplib import SMTP'
aiosmtpd/tests/test_handlers.py:23:1: I100 Import statements are in the wrong order. 'from aiosmtpd.smtp import Envelope' should be before 'from aiosmtpd.smtp import Session'
aiosmtpd/tests/test_handlers.py:27:1: I202 Additional newline in a group of imports. 'from .conftest import Global, controller_data, handler_data' is identified as Application Relative and 'from aiosmtpd.testing.statuscodes import StatusCode' is identified as Application.
aiosmtpd/tests/test_lmtp.py:16:1: I202 Additional newline in a group of imports. 'from .conftest import Global' is identified as Application Relative and 'from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES' is identified as Application.
aiosmtpd/tests/test_proxyprotocol.py:24:1: I101 Imported names are in the wrong order. Should be AF, AsyncReader, MalformedTLV, PROTO, ProxyData, ProxyTLV, UnknownTypeTLV, V2_CMD, V2_SIGNATURE, get_proxy
aiosmtpd/tests/test_proxyprotocol.py:38:1: I100 Import statements are in the wrong order. 'from aiosmtpd.smtp import Envelope' should be before 'from aiosmtpd.smtp import Session'
aiosmtpd/tests/test_server.py:15:1: I100 Import statements are in the wrong order. 'from pathlib import Path' should be before 'from threading import Event'
aiosmtpd/tests/test_server.py:24:1: I101 Imported names are in the wrong order. Should be Controller, UnixSocketController, UnixSocketMixin, UnixSocketUnthreadedController, UnthreadedController, _FakeServer, _server_to_client_ssl_ctx, get_localhost
aiosmtpd/tests/test_server.py:38:1: I101 Imported names are in the wrong order. Should be AUTOSTOP_DELAY, Global
aiosmtpd/tests/test_server.py:38:1: I202 Additional newline in a group of imports. 'from .conftest import Global, AUTOSTOP_DELAY' is identified as Application Relative and 'from aiosmtpd.testing.helpers import catchup_delay' is identified as Application.
aiosmtpd/tests/test_smtp.py:24:1: I101 Imported names are in the wrong order. Should be Any, Callable, Generator, List, Tuple, Union, cast
aiosmtpd/tests/test_smtp.py:30:1: I100 Import statements are in the wrong order. 'from aiosmtpd.controller import Controller' should be before 'from .conftest import Global, controller_data, handler_data'
aiosmtpd/tests/test_smtp.py:32:1: I101 Imported names are in the wrong order. Should be AuthResult, BOGUS_LIMIT, CALL_LIMIT_DEFAULT, Envelope, LoginPassword, MISSING, SMTP, Session, __ident__, auth_mechanism
aiosmtpd/tests/test_smtps.py:16:1: I202 Additional newline in a group of imports. 'from .conftest import Global' is identified as Application Relative and 'from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES' is identified as Application.
aiosmtpd/tests/test_smtpsmuggling.py:7:1: I100 Import statements are in the wrong order. 'import re' should be before 'import smtplib'
aiosmtpd/tests/test_smtpsmuggling.py:12:1: I202 Additional newline in a group of imports. 'from .conftest import handler_data' is identified as Application Relative and 'from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES' is identified as Application.
aiosmtpd/tests/test_starttls.py:15:1: I100 Import statements are in the wrong order. 'from aiosmtpd.smtp import Envelope' should be before 'from aiosmtpd.smtp import SMTP'
aiosmtpd/tests/test_starttls.py:21:1: I202 Additional newline in a group of imports. 'from .conftest import Global, handler_data' is identified as Application Relative and 'from aiosmtpd.testing.statuscodes import SMTP_STATUS_CODES' is identified as Application.
isort configured in pyproject.toml:
Added in commits 779717d and 3075e23 by @pepoluan. isort is not listed in requirements-dev.txt
flake8-import-order configured in setup.cfg:
Added in 8d81f96 by @Dreamsorcerer. I was not added to the select option of flake8's config so flake8-import-order rules are not run by flake8 as part of CI. flake8-import-order is not listed in tox.ini's deps.
Which isort order should the project be using? Related to #385.