summaryrefslogtreecommitdiff
path: root/astroid/brain/brain_numpy.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-10-28 15:27:44 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2015-10-28 15:27:44 +0200
commit9527b030bc58ee4c5c32bb9d97126bfbeb79afdf (patch)
tree3743f5e9733247bb4453a3da7f9ed5e61d26f13f /astroid/brain/brain_numpy.py
parent22f3b25c1898a32d81a5c4bf8c2b60d144d701f0 (diff)
downloadastroid-git-9527b030bc58ee4c5c32bb9d97126bfbeb79afdf.tar.gz
Rename the brain files again to avoid naming conflicts.
Diffstat (limited to 'astroid/brain/brain_numpy.py')
-rw-r--r--astroid/brain/brain_numpy.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/astroid/brain/brain_numpy.py b/astroid/brain/brain_numpy.py
new file mode 100644
index 00000000..75f4f18f
--- /dev/null
+++ b/astroid/brain/brain_numpy.py
@@ -0,0 +1,62 @@
+# copyright 2003-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
+#
+# This file is part of astroid.
+#
+# astroid is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 2.1 of the License, or (at your option) any
+# later version.
+#
+# astroid is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with astroid. If not, see <http://www.gnu.org/licenses/>.
+
+"""Astroid hooks for numpy."""
+
+import astroid
+
+
+# TODO(cpopa): drop when understanding augmented assignments
+
+def numpy_core_transform():
+ return astroid.parse('''
+ from numpy.core import numeric
+ from numpy.core import fromnumeric
+ from numpy.core import defchararray
+ from numpy.core import records
+ from numpy.core import function_base
+ from numpy.core import machar
+ from numpy.core import getlimits
+ from numpy.core import shape_base
+ __all__ = (['char', 'rec', 'memmap', 'chararray'] + numeric.__all__ +
+ fromnumeric.__all__ +
+ records.__all__ +
+ function_base.__all__ +
+ machar.__all__ +
+ getlimits.__all__ +
+ shape_base.__all__)
+ ''')
+
+
+def numpy_transform():
+ return astroid.parse('''
+ from numpy import core
+ from numpy import matrixlib as _mat
+ from numpy import lib
+ __all__ = ['add_newdocs',
+ 'ModuleDeprecationWarning',
+ 'VisibleDeprecationWarning', 'linalg', 'fft', 'random',
+ 'ctypeslib', 'ma',
+ '__version__', 'pkgload', 'PackageLoader',
+ 'show_config'] + core.__all__ + _mat.__all__ + lib.__all__
+
+ ''')
+
+
+astroid.register_module_extender(astroid.MANAGER, 'numpy.core', numpy_core_transform)
+astroid.register_module_extender(astroid.MANAGER, 'numpy', numpy_transform)