Skip to content

Commit

Permalink
Blackify __init__
Browse files Browse the repository at this point in the history
  • Loading branch information
pepoluan committed Mar 8, 2021
1 parent 2b83d6b commit 94b24db
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions aiosmtpd/smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,35 +346,35 @@ class SMTP(asyncio.StreamReaderProtocol):
_auth_callback: Optional[AuthCallbackType] = None

def __init__(
self,
handler: Any,
*,
loop: asyncio.AbstractEventLoop = None,
hostname: str = None,
ident: str = None,
timeout: float = 300,
data_size_limit: int = DATA_SIZE_DEFAULT,
enable_SMTPUTF8: bool = False,
decode_data: bool = False,

tls_context: Optional[ssl.SSLContext] = None,
require_starttls: bool = False,

auth_required: bool = False,
auth_require_tls: bool = True,
auth_exclude_mechanism: Optional[Iterable[str]] = None,
auth_callback: AuthCallbackType = None,
authenticator: AuthenticatorType = None,

command_call_limit: Union[int, Dict[str, int], None] = None,
proxy_protocol_timeout: Optional[Union[int, float]] = None,
self,
handler: Any,
*,
loop: asyncio.AbstractEventLoop = None,
hostname: str = None,
ident: str = None,
timeout: float = 300,
data_size_limit: int = DATA_SIZE_DEFAULT,
enable_SMTPUTF8: bool = False,
decode_data: bool = False,
#
tls_context: Optional[ssl.SSLContext] = None,
require_starttls: bool = False,
#
auth_required: bool = False,
auth_require_tls: bool = True,
auth_exclude_mechanism: Optional[Iterable[str]] = None,
auth_callback: AuthCallbackType = None,
authenticator: AuthenticatorType = None,
#
command_call_limit: Union[int, Dict[str, int], None] = None,
proxy_protocol_timeout: Optional[Union[int, float]] = None,
):
self.__ident__ = ident or __ident__
self._loop = loop if loop else make_loop()
super().__init__(
asyncio.StreamReader(loop=self.loop, limit=self.line_length_limit),
client_connected_cb=self._client_connected_cb,
loop=self.loop
loop=self.loop,
)
if data_size_limit is not None and not isinstance(data_size_limit, int):
raise TypeError("data_size_limit must be None or int")
Expand All @@ -390,8 +390,10 @@ def __init__(

self._timeout_duration = timeout
if not auth_require_tls and auth_required:
warn("Requiring AUTH while not requiring TLS "
"can lead to security vulnerabilities!")
warn(
"Requiring AUTH while not requiring TLS "
"can lead to security vulnerabilities!"
)
log.warning("auth_required == True but auth_require_tls == False")
self._auth_require_tls = auth_require_tls

Expand Down Expand Up @@ -420,9 +422,7 @@ def __init__(
if isinstance(command_call_limit, int):
self._call_limit = {"*": command_call_limit}
elif isinstance(command_call_limit, dict):
if not all(
map(lambda x: isinstance(x, int), command_call_limit.values())
):
if not all(isinstance(x, int) for x in command_call_limit.values()):
raise TypeError("All command_call_limit values must be int")
self._call_limit = command_call_limit
self._call_limit.setdefault("*", CALL_LIMIT_DEFAULT)
Expand Down

0 comments on commit 94b24db

Please sign in to comment.