summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhippo91 <guillaume.peillex@gmail.com>2019-12-27 14:02:37 +0100
committerhippo91 <guillaume.peillex@gmail.com>2019-12-27 14:02:37 +0100
commit2faef84f021f5688a1191fbd9ef2f8c87b7a5dc5 (patch)
tree7944c1d153904f0713e401f8f174619e8cc984c2
parent0ab461ea95c265a76362ac756faac37931284d45 (diff)
downloadastroid-git-2faef84f021f5688a1191fbd9ef2f8c87b7a5dc5.tar.gz
Add comments
-rw-r--r--astroid/brain/brain_numpy_core_fromnumeric.py5
-rw-r--r--astroid/brain/brain_numpy_core_function_base.py3
2 files changed, 7 insertions, 1 deletions
diff --git a/astroid/brain/brain_numpy_core_fromnumeric.py b/astroid/brain/brain_numpy_core_fromnumeric.py
index 88eb6fe8..48b43456 100644
--- a/astroid/brain/brain_numpy_core_fromnumeric.py
+++ b/astroid/brain/brain_numpy_core_fromnumeric.py
@@ -10,7 +10,10 @@ import functools
import astroid
from brain_numpy_utils import infer_numpy_member
-
+# None is present inside the inferred values of the call to sum function because
+# the variable out in the sum function is not correctly inferred.
+# This module is here to help astroid to determine the exact type of this variable and
+# thus to infer correctly the result of the call to sum function (i.e without None in the inferred values).
def looks_like_out_name_in_numpy_sum(member_name: str, node: astroid.node_classes.NodeNG) -> bool:
if (isinstance(node, astroid.Name)
and node.name == "out"
diff --git a/astroid/brain/brain_numpy_core_function_base.py b/astroid/brain/brain_numpy_core_function_base.py
index 05a73d96..a89638d1 100644
--- a/astroid/brain/brain_numpy_core_function_base.py
+++ b/astroid/brain/brain_numpy_core_function_base.py
@@ -11,6 +11,9 @@ import astroid
from brain_numpy_utils import looks_like_numpy_member, infer_numpy_member
+# TODO: In fact there is obviously a less intrusive way to correctly infer those functions.
+# They are all defined in a .py file thus there is no need to redefine them here.
+# See what is done in brain_numpy_core_fromnumeric module
METHODS_TO_BE_INFERRED = {
"linspace": """def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0):
return numpy.ndarray([0, 0])""",