Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ad2ba4

Browse files
disallow untyped calls in autocomplete.py
1 parent55e482a commit1ad2ba4

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

‎bpython/autocomplete.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
# To gradually migrate to mypy we aren't setting these globally yet
2525
# mypy: disallow_untyped_defs=True
26+
# mypy: disallow_untyped_calls=True
2627

2728
import__main__
2829
importabc

‎bpython/inspection.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def get_encoding_file(fname):
347347
return"utf8"
348348

349349

350-
defgetattr_safe(obj,name):
350+
defgetattr_safe(obj:Any,name:str):
351351
"""side effect free getattr (calls getattr_static)."""
352352
result=inspect.getattr_static(obj,name)
353353
# Slots are a MemberDescriptorType
@@ -356,7 +356,7 @@ def getattr_safe(obj, name):
356356
returnresult
357357

358358

359-
defhasattr_safe(obj,name):
359+
defhasattr_safe(obj:Any,name:str)->bool:
360360
try:
361361
getattr_safe(obj,name)
362362
returnTrue

‎bpython/simpleeval.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
importast
2929
importsys
3030
importbuiltins
31+
fromtypingimportDict,Any
3132

3233
from .importlineasline_properties
3334
from .inspectionimportgetattr_safe
@@ -44,7 +45,7 @@ class EvaluationError(Exception):
4445
"""Raised if an exception occurred in safe_eval."""
4546

4647

47-
defsafe_eval(expr,namespace):
48+
defsafe_eval(expr:str,namespace:Dict[str,Any])->Any:
4849
"""Not all that safe, just catches some errors"""
4950
try:
5051
returneval(expr,namespace)
@@ -214,7 +215,9 @@ def find_attribute_with_name(node, name):
214215
returnr
215216

216217

217-
defevaluate_current_expression(cursor_offset,line,namespace=None):
218+
defevaluate_current_expression(
219+
cursor_offset:int,line:str,namespace:Dict[str,Any]=None
220+
):
218221
"""
219222
Return evaluated expression to the right of the dot of current attribute.
220223

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp