Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require explicit Optional in type annotations #79

Merged
merged 1 commit into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ disallow_untyped_defs = True
check_untyped_defs = True
strict_equality = True
implicit_reexport = False
no_implicit_optional = True

[mypy-generate_vectors]
ignore_errors = True
Expand Down
4 changes: 2 additions & 2 deletions mnemonic/mnemonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import hmac
import itertools
import os
from typing import AnyStr, List, Sequence, TypeVar, Union
from typing import AnyStr, List, Optional, Sequence, TypeVar, Union
import unicodedata

_T = TypeVar("_T")
Expand All @@ -41,7 +41,7 @@ def binary_search(
a: Sequence[_T],
x: _T,
lo: int = 0,
hi: int = None, # can't use a to specify default for hi
hi: Optional[int] = None, # can't use a to specify default for hi
) -> int:
hi = hi if hi is not None else len(a) # hi defaults to len(a)
pos = bisect.bisect_left(a, x, lo, hi) # find insertion position
Expand Down