Skip to content

Commit

Permalink
fix convert_unspecified_to_localhost pytype check error
Browse files Browse the repository at this point in the history
Fix tab to space
  • Loading branch information
wevsty committed Jun 16, 2021
1 parent cbef7cc commit 98f3669
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
7 changes: 4 additions & 3 deletions aiosmtpd/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ def is_unspecified_address(address: str) -> bool:
@public
def convert_unspecified_to_localhost(
address: str
) -> Literal["::1", "127.0.0.1"]:
) -> str:
localhost = get_localhost()
address_dict = {
"": get_localhost(),
"": localhost,
"0.0.0.0": "127.0.0.1", # nosec
"::": "::1", # nosec
}
return address_dict.get(address, get_localhost())
return str(address_dict.get(address, localhost))


class _FakeServer(asyncio.StreamReaderProtocol):
Expand Down
24 changes: 12 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ ignore =
# black conflicts with E123 & E133
E123
E133
# E261 conflicts with bandit ignore syntax
E261
# E261 conflicts with bandit ignore syntax
E261
# W503 conflicts with PEP8...
W503
# W293 is a bit too noisy. Many files have been edited using editors that do not remove spaces from blank lines.
Expand All @@ -83,16 +83,16 @@ ignore =
E203
# Sometimes we prefer the func()-based creation, not literal, for readability
C408
# Keeping variable names helps to understand the code
PIE781
# Keeping variable names helps to understand the code
PIE781
# Sometimes we need to catch Exception broadly
PIE786
# Custom type required
PIE795
# Some classes need to be used for inheritance and are not unnecessary
PIE798
# Some data must be inserted and cannot be pre-initialized
PIE799
# Custom type required
PIE795
# Some classes need to be used for inheritance and are not unnecessary
PIE798
# Some data must be inserted and cannot be pre-initialized
PIE799
# We don't really care about pytest.fixture vs pytest.fixture()
PT001
# Good idea, but too many changes. Remove this in the future, and create separate PR
Expand All @@ -107,8 +107,8 @@ ignore =
ANN003
# We have too many "if..elif..else: raise" structures that does not convert well to "error-first" design
SIM106
# Dataclasses were introduced with PEP 557 in Python 3.7 but we need support 3.6
SIM119
# Dataclasses were introduced with PEP 557 in Python 3.7 but we need support 3.6
SIM119
per-file-ignores =
aiosmtpd/tests/test_*:ANN001
aiosmtpd/tests/test_proxyprotocol.py:DUO102
Expand Down

0 comments on commit 98f3669

Please sign in to comment.