mypy: Refactor extract_recipients in actions.py to remove type ignore.

This commit is contained in:
neiljp (Neil Pilgrim) 2019-08-02 21:14:40 +00:00 committed by Tim Abbott
parent 5ab64daecc
commit 12f3ed12c4
1 changed files with 7 additions and 3 deletions

View File

@ -1945,9 +1945,13 @@ def extract_recipients(
) -> Union[List[str], List[int]]: ) -> Union[List[str], List[int]]:
# We try to accept multiple incoming formats for recipients. # We try to accept multiple incoming formats for recipients.
# See test_extract_recipients() for examples of what we allow. # See test_extract_recipients() for examples of what we allow.
try:
data = ujson.loads(s) # type: ignore # This function has a super weird union argument. if isinstance(s, str):
except (ValueError, TypeError): try:
data = ujson.loads(s)
except (ValueError, TypeError):
data = s
else:
data = s data = s
if isinstance(data, str): if isinstance(data, str):