Skip to content

Commit d86332b

Browse files
committed
Add typing to _function_type and _build_proxy_class
1 parent d6ec440 commit d86332b

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

astroid/helpers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,23 @@
2121
from astroid.typing import InferenceResult
2222

2323

24-
def _build_proxy_class(cls_name, builtins):
24+
def _build_proxy_class(cls_name: str, builtins: nodes.Module) -> nodes.ClassDef:
2525
proxy = raw_building.build_class(cls_name)
2626
proxy.parent = builtins
2727
return proxy
2828

2929

30-
def _function_type(function, builtins):
30+
def _function_type(
31+
function: nodes.Lambda | bases.UnboundMethod, builtins: nodes.Module
32+
) -> nodes.ClassDef:
3133
if isinstance(function, scoped_nodes.Lambda):
3234
if function.root().name == "builtins":
3335
cls_name = "builtin_function_or_method"
3436
else:
3537
cls_name = "function"
3638
elif isinstance(function, bases.BoundMethod):
3739
cls_name = "method"
38-
elif isinstance(function, bases.UnboundMethod):
40+
else:
3941
cls_name = "function"
4042
return _build_proxy_class(cls_name, builtins)
4143

astroid/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def unregister_transform(self):
8686
return self._transform.unregister_transform
8787

8888
@property
89-
def builtins_module(self):
89+
def builtins_module(self) -> nodes.Module:
9090
return self.astroid_cache["builtins"]
9191

9292
def visit_transforms(self, node):

astroid/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class InferenceErrorInfo(TypedDict):
3232
class AstroidManagerBrain(TypedDict):
3333
"""Dictionary to store relevant information for a AstroidManager class."""
3434

35-
astroid_cache: dict
35+
astroid_cache: dict[str, nodes.Module]
3636
_mod_file_cache: dict
3737
_failed_import_hooks: list
3838
always_load_extensions: bool

0 commit comments

Comments
 (0)