From 39d9cafb8b39432957f4e640d5ef222b66a7096e Mon Sep 17 00:00:00 2001 From: Nick Drozd Date: Thu, 15 Dec 2022 16:00:12 -0600 Subject: Misc type stuff (#1888) --- astroid/brain/brain_builtin_inference.py | 2 +- astroid/brain/brain_uuid.py | 2 +- astroid/brain/helpers.py | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'astroid/brain') diff --git a/astroid/brain/brain_builtin_inference.py b/astroid/brain/brain_builtin_inference.py index a872b38c..61c0baa6 100644 --- a/astroid/brain/brain_builtin_inference.py +++ b/astroid/brain/brain_builtin_inference.py @@ -164,7 +164,7 @@ def _builtin_filter_predicate(node, builtin_name) -> bool: return False -def register_builtin_transform(transform, builtin_name): +def register_builtin_transform(transform, builtin_name) -> None: """Register a new transform function for the given *builtin_name*. The transform function must accept two parameters, a node and diff --git a/astroid/brain/brain_uuid.py b/astroid/brain/brain_uuid.py index f6ba8883..4890e101 100644 --- a/astroid/brain/brain_uuid.py +++ b/astroid/brain/brain_uuid.py @@ -8,7 +8,7 @@ from astroid.nodes.node_classes import Const from astroid.nodes.scoped_nodes import ClassDef -def _patch_uuid_class(node): +def _patch_uuid_class(node: ClassDef) -> None: # The .int member is patched using __dict__ node.locals["int"] = [Const(0, parent=node)] diff --git a/astroid/brain/helpers.py b/astroid/brain/helpers.py index d74f5950..56683c8e 100644 --- a/astroid/brain/helpers.py +++ b/astroid/brain/helpers.py @@ -2,11 +2,18 @@ # For details: https://github.com/PyCQA/astroid/blob/main/LICENSE # Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt +from __future__ import annotations + +from collections.abc import Callable + +from astroid.manager import AstroidManager from astroid.nodes.scoped_nodes import Module -def register_module_extender(manager, module_name, get_extension_mod): - def transform(node): +def register_module_extender( + manager: AstroidManager, module_name: str, get_extension_mod: Callable[[], Module] +) -> None: + def transform(node: Module) -> None: extension_module = get_extension_mod() for name, objs in extension_module.locals.items(): node.locals[name] = objs -- cgit v1.2.1