gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / astroid / brain / brain_numpy.py @ 745
History | View | Annotate | Download (2.16 KB)
1 |
# copyright 2003-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
---|---|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
3 |
#
|
4 |
# This file is part of astroid.
|
5 |
#
|
6 |
# astroid is free software: you can redistribute it and/or modify it under
|
7 |
# the terms of the GNU Lesser General Public License as published by the Free
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) any
|
9 |
# later version.
|
10 |
#
|
11 |
# astroid is distributed in the hope that it will be useful, but WITHOUT
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
14 |
# details.
|
15 |
#
|
16 |
# You should have received a copy of the GNU Lesser General Public License along
|
17 |
# with astroid. If not, see <http://www.gnu.org/licenses/>.
|
18 |
|
19 |
"""Astroid hooks for numpy."""
|
20 |
|
21 |
import astroid |
22 |
|
23 |
|
24 |
# TODO(cpopa): drop when understanding augmented assignments
|
25 |
|
26 |
def numpy_core_transform(): |
27 |
return astroid.parse(''' |
28 |
from numpy.core import numeric
|
29 |
from numpy.core import fromnumeric
|
30 |
from numpy.core import defchararray
|
31 |
from numpy.core import records
|
32 |
from numpy.core import function_base
|
33 |
from numpy.core import machar
|
34 |
from numpy.core import getlimits
|
35 |
from numpy.core import shape_base
|
36 |
__all__ = (['char', 'rec', 'memmap', 'chararray'] + numeric.__all__ +
|
37 |
fromnumeric.__all__ +
|
38 |
records.__all__ +
|
39 |
function_base.__all__ +
|
40 |
machar.__all__ +
|
41 |
getlimits.__all__ +
|
42 |
shape_base.__all__)
|
43 |
''')
|
44 |
|
45 |
|
46 |
def numpy_transform(): |
47 |
return astroid.parse(''' |
48 |
from numpy import core
|
49 |
from numpy import matrixlib as _mat
|
50 |
from numpy import lib
|
51 |
__all__ = ['add_newdocs',
|
52 |
'ModuleDeprecationWarning',
|
53 |
'VisibleDeprecationWarning', 'linalg', 'fft', 'random',
|
54 |
'ctypeslib', 'ma',
|
55 |
'__version__', 'pkgload', 'PackageLoader',
|
56 |
'show_config'] + core.__all__ + _mat.__all__ + lib.__all__
|
57 |
|
58 |
''')
|
59 |
|
60 |
|
61 |
astroid.register_module_extender(astroid.MANAGER, 'numpy.core', numpy_core_transform)
|
62 |
astroid.register_module_extender(astroid.MANAGER, 'numpy', numpy_transform)
|