Skip to content
Snippets Groups Projects
Verified Commit abcf13e2 authored by Antoine Lambert's avatar Antoine Lambert
Browse files

api, inbound_email: Fix mypy 1.15 errors

parent bb2eee75
No related branches found
Tags v0.9.7
1 merge request!1387Apply swh-py-template-v0.3.3 with copier update
Pipeline #13307 passed
......@@ -95,9 +95,9 @@ class SwhWebRateThrottle(ScopedRateThrottle):
def allow_request(self, request: Request, view: APIView) -> bool:
# class based view case
if not self.scope:
default_scope = getattr(view, self.scope_attr, None)
default_scope = getattr(view, self.scope_attr, "")
request_allowed = None
if default_scope is not None:
if default_scope:
# check if there is a specific rate limiting associated
# to the request type
assert request.method is not None
......
......@@ -20,7 +20,7 @@ class MessageHandler:
def __init__(self, raw_message: bytes, sender: Optional[Type] = None):
try:
self.message = email.message_from_bytes(
raw_message, policy=email.policy.default
raw_message, policy=email.policy.default # type: ignore[arg-type]
)
except Exception as exc:
sentry_capture_exception(exc)
......
......@@ -154,7 +154,7 @@ def test_recipient_matches_casemapping():
)
def test_recipient_matches_real_world(filename: str, recipient: str, extension: str):
with open_binary("swh.web.inbound_email.tests.resources", filename) as f:
message = email.message_from_binary_file(f, policy=email.policy.default)
message = email.message_from_binary_file(f, policy=email.policy.default) # type: ignore[arg-type]
assert isinstance(message, EmailMessage)
......@@ -400,7 +400,7 @@ def test_get_message_plaintext(
filename: str, expected_parts: List[str], expected_absent: List[str]
):
with open_binary("swh.web.inbound_email.tests.resources", filename) as f:
message = email.message_from_binary_file(f, policy=email.policy.default)
message = email.message_from_binary_file(f, policy=email.policy.default) # type: ignore[arg-type]
assert isinstance(message, EmailMessage)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment