Enable mypy checking for unreachable code and fix instances. (#8432)

This commit is contained in:
Patrick Cloke 2020-10-01 08:09:18 -04:00 committed by GitHub
parent c1ef579b63
commit 4ff0201e62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 38 additions and 53 deletions

View file

@ -22,7 +22,6 @@ from typing import (
Callable,
Dict,
List,
Match,
Optional,
Tuple,
Union,
@ -825,14 +824,14 @@ def server_matches_acl_event(server_name: str, acl_event: EventBase) -> bool:
return False
def _acl_entry_matches(server_name: str, acl_entry: str) -> Match:
def _acl_entry_matches(server_name: str, acl_entry: Any) -> bool:
if not isinstance(acl_entry, str):
logger.warning(
"Ignoring non-str ACL entry '%s' (is %s)", acl_entry, type(acl_entry)
)
return False
regex = glob_to_regex(acl_entry)
return regex.match(server_name)
return bool(regex.match(server_name))
class FederationHandlerRegistry: