Skip to content

Commit df03931

Browse files
committed
Fix mypy and black regressions
1 parent 12e4659 commit df03931

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

bpython/autocomplete.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@
3939
from enum import Enum
4040
from typing import (
4141
Any,
42-
cast,
4342
Dict,
4443
Iterator,
4544
List,
4645
Optional,
46+
Sequence,
4747
Set,
4848
Tuple,
49-
Sequence,
5049
)
5150
from . import inspection
5251
from . import line as lineparts
@@ -391,9 +390,6 @@ def matches(
391390
locals_: Optional[Dict[str, Any]] = None,
392391
**kwargs: Any,
393392
) -> Optional[Set]:
394-
if locals_ is None:
395-
return None
396-
397393
r = self.locate(cursor_offset, line)
398394
if r is None:
399395
return None

bpython/repl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def current_string(self, concatenate=False):
588588

589589
def get_object(self, name):
590590
attributes = name.split(".")
591-
obj = eval(attributes.pop(0), self.interp.locals)
591+
obj = eval(attributes.pop(0), cast(Dict[str, Any], self.interp.locals))
592592
while attributes:
593593
with inspection.AttrCleaner(obj):
594594
obj = getattr(obj, attributes.pop(0))
@@ -783,7 +783,7 @@ def complete(self, tab: bool = False) -> Optional[bool]:
783783
self.completers,
784784
cursor_offset=self.cursor_offset,
785785
line=self.current_line,
786-
locals_=self.interp.locals,
786+
locals_=cast(Dict[str, Any], self.interp.locals),
787787
argspec=self.funcprops,
788788
current_block="\n".join(self.buffer + [self.current_line]),
789789
complete_magic_methods=self.config.complete_magic_methods,

bpython/test/test_inspection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def fun_annotations(number: int, lst: List[int] = []) -> List[int]:
179179
self.assertEqual(props.argspec.args, ["number", "lst"])
180180
self.assertEqual(props.argspec.defaults[0], [])
181181

182+
182183
class A:
183184
a = "a"
184185

0 commit comments

Comments
 (0)