Skip to content

Commit 352de30

Browse files
committed
Fix type annotations
1 parent f797aa1 commit 352de30

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

bpython/cli.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ def show_list(
12991299
arg_pos: Union[str, int, None],
13001300
topline: Optional[inspection.FuncProps] = None,
13011301
formatter: Optional[Callable] = None,
1302-
current_item: Union[str, Literal[False]] = None,
1302+
current_item: Optional[str] = None,
13031303
) -> None:
13041304
v_items: Collection
13051305
shared = ShowListState()
@@ -1315,7 +1315,7 @@ def show_list(
13151315

13161316
if items and formatter:
13171317
items = [formatter(x) for x in items]
1318-
if current_item:
1318+
if current_item is not None:
13191319
current_item = formatter(current_item)
13201320

13211321
if topline:
@@ -1492,8 +1492,10 @@ def tab(self, back: bool = False) -> bool:
14921492

14931493
# 4. swap current word for a match list item
14941494
elif self.matches_iter.matches:
1495-
current_match: Union[str, Literal[False]] = (
1496-
back and self.matches_iter.previous() or next(self.matches_iter)
1495+
current_match = (
1496+
self.matches_iter.previous()
1497+
if back
1498+
else next(self.matches_iter)
14971499
)
14981500
try:
14991501
f = None

bpython/translations/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import locale
33
import os.path
44
import sys
5-
from typing import cast, List
5+
from typing import Optional, cast, List
66

77
from .. import package_dir
88

@@ -17,7 +17,9 @@ def ngettext(singular, plural, n):
1717
return translator.ngettext(singular, plural, n)
1818

1919

20-
def init(locale_dir: str = None, languages: List[str] = None) -> None:
20+
def init(
21+
locale_dir: Optional[str] = None, languages: Optional[List[str]] = None
22+
) -> None:
2123
try:
2224
locale.setlocale(locale.LC_ALL, "")
2325
except locale.Error:

0 commit comments

Comments
 (0)