Use --no-implicit-optional for type checking (#3220)

This makes type checking PEP 484 compliant (as of 2018).
mypy will change its defaults soon.

See:
https://github.com/python/mypy/issues/9091
https://github.com/python/mypy/pull/13401
This commit is contained in:
Shantanu 2022-08-12 19:28:47 -07:00 committed by GitHub
parent 6064a43545
commit 680cbe3a4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -22,6 +22,7 @@ warn_no_return=True
warn_redundant_casts=True warn_redundant_casts=True
warn_unused_ignores=True warn_unused_ignores=True
disallow_any_generics=True disallow_any_generics=True
no_implicit_optional=True
# Unreachable blocks have been an issue when compiling mypyc, let's try # Unreachable blocks have been an issue when compiling mypyc, let's try
# to avoid 'em in the first place. # to avoid 'em in the first place.

View File

@ -114,7 +114,7 @@ def add_token(self, tok_type: int, tok_val: Text, raw: bool = False) -> None:
args.insert(0, ilabel) args.insert(0, ilabel)
func(*args) func(*args)
def determine_route(self, value: Text = None, force: bool = False) -> Optional[int]: def determine_route(self, value: Optional[Text] = None, force: bool = False) -> Optional[int]:
alive_ilabels = self.ilabels alive_ilabels = self.ilabels
if len(alive_ilabels) == 0: if len(alive_ilabels) == 0:
*_, most_successful_ilabel = self._dead_ilabels *_, most_successful_ilabel = self._dead_ilabels