We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
reload(numpy);numpy.max([]) raises TypeError
Using `maintenance/1.11.x` on Windows (msvc builds), the following code fails:

``` Python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib import reload
>>> import numpy
>>> reload(numpy)
<module 'numpy' from 'X:\\Python35\\lib\\site-packages\\numpy\\__init__.py'>
>>> numpy.max([])
Traceback (most recent call last):
  File "X:\Python35\lib\site-packages\numpy\core\fromnumeric.py", line 2290, in amax
    amax = a.max
AttributeError: 'list' object has no attribute 'max'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "X:\Python35\lib\site-packages\numpy\core\fromnumeric.py", line 2293, in amax
    out=out, **kwargs)
  File "X:\Python35\lib\site-packages\numpy\core\_methods.py", line 26, in _amax
    return umr_maximum(a, axis, None, out, keepdims)
TypeError: an integer is required (got type type)
```

I traced this to #7736, backport of #4619 


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `numpy/__init__.py`
Content:
```
1 """
2 NumPy
3 =====
4 
5 Provides
6   1. An array object of arbitrary homogeneous items
7   2. Fast mathematical operations over arrays
8   3. Linear Algebra, Fourier Transforms, Random Number Generation
9 
10 How to use the documentation
11 ----------------------------
12 Documentation is available in two forms: docstrings provided
13 with the code, and a loose standing reference guide, available from
14 `the NumPy homepage <http://www.scipy.org>`_.
15 
16 We recommend exploring the docstrings using
17 `IPython <http://ipython.scipy.org>`_, an advanced Python shell with
18 TAB-completion and introspection capabilities.  See below for further
19 instructions.
20 
21 The docstring examples assume that `numpy` has been imported as `np`::
22 
23   >>> import numpy as np
24 
25 Code snippets are indicated by three greater-than signs::
26 
27   >>> x = 42
28   >>> x = x + 1
29 
30 Use the built-in ``help`` function to view a function's docstring::
31 
32   >>> help(np.sort)
33   ... # doctest: +SKIP
34 
35 For some objects, ``np.info(obj)`` may provide additional help.  This is
36 particularly true if you see the line "Help on ufunc object:" at the top
37 of the help() page.  Ufuncs are implemented in C, not Python, for speed.
38 The native Python help() does not know how to view their help, but our
39 np.info() function does.
40 
41 To search for documents containing a keyword, do::
42 
43   >>> np.lookfor('keyword')
44   ... # doctest: +SKIP
45 
46 General-purpose documents like a glossary and help on the basic concepts
47 of numpy are available under the ``doc`` sub-module::
48 
49   >>> from numpy import doc
50   >>> help(doc)
51   ... # doctest: +SKIP
52 
53 Available subpackages
54 ---------------------
55 doc
56     Topical documentation on broadcasting, indexing, etc.
57 lib
58     Basic functions used by several sub-packages.
59 random
60     Core Random Tools
61 linalg
62     Core Linear Algebra Tools
63 fft
64     Core FFT routines
65 polynomial
66     Polynomial tools
67 testing
68     Numpy testing tools
69 f2py
70     Fortran to Python Interface Generator.
71 distutils
72     Enhancements to distutils with support for
73     Fortran compilers support and more.
74 
75 Utilities
76 ---------
77 test
78     Run numpy unittests
79 show_config
80     Show numpy build configuration
81 dual
82     Overwrite certain functions with high-performance Scipy tools
83 matlib
84     Make everything matrices.
85 __version__
86     Numpy version string
87 
88 Viewing documentation using IPython
89 -----------------------------------
90 Start IPython with the NumPy profile (``ipython -p numpy``), which will
91 import `numpy` under the alias `np`.  Then, use the ``cpaste`` command to
92 paste examples into the shell.  To see which functions are available in
93 `numpy`, type ``np.<TAB>`` (where ``<TAB>`` refers to the TAB key), or use
94 ``np.*cos*?<ENTER>`` (where ``<ENTER>`` refers to the ENTER key) to narrow
95 down the list.  To view the docstring for a function, use
96 ``np.cos?<ENTER>`` (to view the docstring) and ``np.cos??<ENTER>`` (to view
97 the source code).
98 
99 Copies vs. in-place operation
100 -----------------------------
101 Most of the functions in `numpy` return a copy of the array argument
102 (e.g., `np.sort`).  In-place versions of these functions are often
103 available as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``.
104 Exceptions to this rule are documented.
105 
106 """
107 from __future__ import division, absolute_import, print_function
108 
109 import sys
110 
111 
112 class ModuleDeprecationWarning(DeprecationWarning):
113     """Module deprecation warning.
114 
115     The nose tester turns ordinary Deprecation warnings into test failures.
116     That makes it hard to deprecate whole modules, because they get
117     imported by default. So this is a special Deprecation warning that the
118     nose tester will let pass without making tests fail.
119 
120     """
121     pass
122 
123 
124 class VisibleDeprecationWarning(UserWarning):
125     """Visible deprecation warning.
126 
127     By default, python will not show deprecation warnings, so this class
128     can be used when a very visible warning is helpful, for example because
129     the usage is most likely a user bug.
130 
131     """
132     pass
133 
134 
135 class _NoValue:
136     """Special keyword value.
137 
138     This class may be used as the default value assigned to a
139     deprecated keyword in order to check if it has been given a user
140     defined value.
141     """
142     pass
143 
144 
145 # oldnumeric and numarray were removed in 1.9. In case some packages import
146 # but do not use them, we define them here for backward compatibility.
147 oldnumeric = 'removed'
148 numarray = 'removed'
149 
150 
151 # We first need to detect if we're being called as part of the numpy setup
152 # procedure itself in a reliable manner.
153 try:
154     __NUMPY_SETUP__
155 except NameError:
156     __NUMPY_SETUP__ = False
157 
158 
159 if __NUMPY_SETUP__:
160     import sys as _sys
161     _sys.stderr.write('Running from numpy source directory.\n')
162     del _sys
163 else:
164     try:
165         from numpy.__config__ import show as show_config
166     except ImportError:
167         msg = """Error importing numpy: you should not try to import numpy from
168         its source directory; please exit the numpy source tree, and relaunch
169         your python interpreter from there."""
170         raise ImportError(msg)
171     from .version import git_revision as __git_revision__
172     from .version import version as __version__
173 
174     from ._import_tools import PackageLoader
175 
176     def pkgload(*packages, **options):
177         loader = PackageLoader(infunc=True)
178         return loader(*packages, **options)
179 
180     from . import add_newdocs
181     __all__ = ['add_newdocs',
182                'ModuleDeprecationWarning',
183                'VisibleDeprecationWarning']
184 
185     pkgload.__doc__ = PackageLoader.__call__.__doc__
186 
187     # We don't actually use this ourselves anymore, but I'm not 100% sure that
188     # no-one else in the world is using it (though I hope not)
189     from .testing import Tester
190     test = testing.nosetester._numpy_tester().test
191     bench = testing.nosetester._numpy_tester().bench
192 
193     # Allow distributors to run custom init code
194     from . import _distributor_init
195 
196     from . import core
197     from .core import *
198     from . import compat
199     from . import lib
200     from .lib import *
201     from . import linalg
202     from . import fft
203     from . import polynomial
204     from . import random
205     from . import ctypeslib
206     from . import ma
207     from . import matrixlib as _mat
208     from .matrixlib import *
209     from .compat import long
210 
211     # Make these accessible from numpy name-space
212     #  but not imported in from numpy import *
213     if sys.version_info[0] >= 3:
214         from builtins import bool, int, float, complex, object, str
215         unicode = str
216     else:
217         from __builtin__ import bool, int, float, complex, object, unicode, str
218 
219     from .core import round, abs, max, min
220 
221     __all__.extend(['__version__', 'pkgload', 'PackageLoader',
222                'show_config'])
223     __all__.extend(core.__all__)
224     __all__.extend(_mat.__all__)
225     __all__.extend(lib.__all__)
226     __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma'])
227 
228     # Filter annoying Cython warnings that serve no good purpose.
229     import warnings
230     warnings.filterwarnings("ignore", message="numpy.dtype size changed")
231     warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
232     warnings.filterwarnings("ignore", message="numpy.ndarray size changed")
233
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/numpy/__init__.py b/numpy/__init__.py
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -107,8 +107,21 @@
 from __future__ import division, absolute_import, print_function
 
 import sys
+import warnings
 
+# Disallow reloading numpy. Doing that does nothing to change previously
+# loaded modules, which would need to be reloaded separately, but it does
+# change the identity of the warnings and sentinal classes defined below
+# with dire consequences when checking for identity.
+if '_is_loaded' in globals():
+    raise RuntimeError('Reloading numpy is not supported')
+_is_loaded = True
 
+
+# Define some global warnings and the _NoValue sentinal. Defining them here
+# means that their identity will change if numpy is reloaded, hence if that is
+# to be allowed they should be moved into their own, non-reloadable module.
+# Note that these should be defined (or imported) before the other imports.
 class ModuleDeprecationWarning(DeprecationWarning):
     """Module deprecation warning.
 
@@ -135,9 +148,8 @@
 class _NoValue:
     """Special keyword value.
 
-    This class may be used as the default value assigned to a
-    deprecated keyword in order to check if it has been given a user
-    defined value.
+    This class may be used as the default value assigned to a deprecated
+    keyword in order to check if it has been given a user defined value.
     """
     pass
 
@@ -155,11 +167,8 @@
 except NameError:
     __NUMPY_SETUP__ = False
 
-
 if __NUMPY_SETUP__:
-    import sys as _sys
-    _sys.stderr.write('Running from numpy source directory.\n')
-    del _sys
+    sys.stderr.write('Running from numpy source directory.\n')
 else:
     try:
         from numpy.__config__ import show as show_config
@@ -209,7 +218,7 @@
     from .compat import long
 
     # Make these accessible from numpy name-space
-    #  but not imported in from numpy import *
+    # but not imported in from numpy import *
     if sys.version_info[0] >= 3:
         from builtins import bool, int, float, complex, object, str
         unicode = str
@@ -225,8 +234,8 @@
     __all__.extend(lib.__all__)
     __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma'])
 
+
     # Filter annoying Cython warnings that serve no good purpose.
-    import warnings
     warnings.filterwarnings("ignore", message="numpy.dtype size changed")
     warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
     warnings.filterwarnings("ignore", message="numpy.ndarray size changed")

{"golden_diff": "diff --git a/numpy/__init__.py b/numpy/__init__.py\n--- a/numpy/__init__.py\n+++ b/numpy/__init__.py\n@@ -107,8 +107,21 @@\n from __future__ import division, absolute_import, print_function\n \n import sys\n+import warnings\n \n+# Disallow reloading numpy. Doing that does nothing to change previously\n+# loaded modules, which would need to be reloaded separately, but it does\n+# change the identity of the warnings and sentinal classes defined below\n+# with dire consequences when checking for identity.\n+if '_is_loaded' in globals():\n+    raise RuntimeError('Reloading numpy is not supported')\n+_is_loaded = True\n \n+\n+# Define some global warnings and the _NoValue sentinal. Defining them here\n+# means that their identity will change if numpy is reloaded, hence if that is\n+# to be allowed they should be moved into their own, non-reloadable module.\n+# Note that these should be defined (or imported) before the other imports.\n class ModuleDeprecationWarning(DeprecationWarning):\n     \"\"\"Module deprecation warning.\n \n@@ -135,9 +148,8 @@\n class _NoValue:\n     \"\"\"Special keyword value.\n \n-    This class may be used as the default value assigned to a\n-    deprecated keyword in order to check if it has been given a user\n-    defined value.\n+    This class may be used as the default value assigned to a deprecated\n+    keyword in order to check if it has been given a user defined value.\n     \"\"\"\n     pass\n \n@@ -155,11 +167,8 @@\n except NameError:\n     __NUMPY_SETUP__ = False\n \n-\n if __NUMPY_SETUP__:\n-    import sys as _sys\n-    _sys.stderr.write('Running from numpy source directory.\\n')\n-    del _sys\n+    sys.stderr.write('Running from numpy source directory.\\n')\n else:\n     try:\n         from numpy.__config__ import show as show_config\n@@ -209,7 +218,7 @@\n     from .compat import long\n \n     # Make these accessible from numpy name-space\n-    #  but not imported in from numpy import *\n+    # but not imported in from numpy import *\n     if sys.version_info[0] >= 3:\n         from builtins import bool, int, float, complex, object, str\n         unicode = str\n@@ -225,8 +234,8 @@\n     __all__.extend(lib.__all__)\n     __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma'])\n \n+\n     # Filter annoying Cython warnings that serve no good purpose.\n-    import warnings\n     warnings.filterwarnings(\"ignore\", message=\"numpy.dtype size changed\")\n     warnings.filterwarnings(\"ignore\", message=\"numpy.ufunc size changed\")\n     warnings.filterwarnings(\"ignore\", message=\"numpy.ndarray size changed\")\n", "issue": "reload(numpy);numpy.max([]) raises TypeError\nUsing `maintenance/1.11.x` on Windows (msvc builds), the following code fails:\n\n``` Python\nPython 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> from importlib import reload\n>>> import numpy\n>>> reload(numpy)\n<module 'numpy' from 'X:\\\\Python35\\\\lib\\\\site-packages\\\\numpy\\\\__init__.py'>\n>>> numpy.max([])\nTraceback (most recent call last):\n  File \"X:\\Python35\\lib\\site-packages\\numpy\\core\\fromnumeric.py\", line 2290, in amax\n    amax = a.max\nAttributeError: 'list' object has no attribute 'max'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"X:\\Python35\\lib\\site-packages\\numpy\\core\\fromnumeric.py\", line 2293, in amax\n    out=out, **kwargs)\n  File \"X:\\Python35\\lib\\site-packages\\numpy\\core\\_methods.py\", line 26, in _amax\n    return umr_maximum(a, axis, None, out, keepdims)\nTypeError: an integer is required (got type type)\n```\n\nI traced this to #7736, backport of #4619 \n\n", "before_files": [{"content": "\"\"\"\nNumPy\n=====\n\nProvides\n  1. An array object of arbitrary homogeneous items\n  2. Fast mathematical operations over arrays\n  3. Linear Algebra, Fourier Transforms, Random Number Generation\n\nHow to use the documentation\n----------------------------\nDocumentation is available in two forms: docstrings provided\nwith the code, and a loose standing reference guide, available from\n`the NumPy homepage <http://www.scipy.org>`_.\n\nWe recommend exploring the docstrings using\n`IPython <http://ipython.scipy.org>`_, an advanced Python shell with\nTAB-completion and introspection capabilities.  See below for further\ninstructions.\n\nThe docstring examples assume that `numpy` has been imported as `np`::\n\n  >>> import numpy as np\n\nCode snippets are indicated by three greater-than signs::\n\n  >>> x = 42\n  >>> x = x + 1\n\nUse the built-in ``help`` function to view a function's docstring::\n\n  >>> help(np.sort)\n  ... # doctest: +SKIP\n\nFor some objects, ``np.info(obj)`` may provide additional help.  This is\nparticularly true if you see the line \"Help on ufunc object:\" at the top\nof the help() page.  Ufuncs are implemented in C, not Python, for speed.\nThe native Python help() does not know how to view their help, but our\nnp.info() function does.\n\nTo search for documents containing a keyword, do::\n\n  >>> np.lookfor('keyword')\n  ... # doctest: +SKIP\n\nGeneral-purpose documents like a glossary and help on the basic concepts\nof numpy are available under the ``doc`` sub-module::\n\n  >>> from numpy import doc\n  >>> help(doc)\n  ... # doctest: +SKIP\n\nAvailable subpackages\n---------------------\ndoc\n    Topical documentation on broadcasting, indexing, etc.\nlib\n    Basic functions used by several sub-packages.\nrandom\n    Core Random Tools\nlinalg\n    Core Linear Algebra Tools\nfft\n    Core FFT routines\npolynomial\n    Polynomial tools\ntesting\n    Numpy testing tools\nf2py\n    Fortran to Python Interface Generator.\ndistutils\n    Enhancements to distutils with support for\n    Fortran compilers support and more.\n\nUtilities\n---------\ntest\n    Run numpy unittests\nshow_config\n    Show numpy build configuration\ndual\n    Overwrite certain functions with high-performance Scipy tools\nmatlib\n    Make everything matrices.\n__version__\n    Numpy version string\n\nViewing documentation using IPython\n-----------------------------------\nStart IPython with the NumPy profile (``ipython -p numpy``), which will\nimport `numpy` under the alias `np`.  Then, use the ``cpaste`` command to\npaste examples into the shell.  To see which functions are available in\n`numpy`, type ``np.<TAB>`` (where ``<TAB>`` refers to the TAB key), or use\n``np.*cos*?<ENTER>`` (where ``<ENTER>`` refers to the ENTER key) to narrow\ndown the list.  To view the docstring for a function, use\n``np.cos?<ENTER>`` (to view the docstring) and ``np.cos??<ENTER>`` (to view\nthe source code).\n\nCopies vs. in-place operation\n-----------------------------\nMost of the functions in `numpy` return a copy of the array argument\n(e.g., `np.sort`).  In-place versions of these functions are often\navailable as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``.\nExceptions to this rule are documented.\n\n\"\"\"\nfrom __future__ import division, absolute_import, print_function\n\nimport sys\n\n\nclass ModuleDeprecationWarning(DeprecationWarning):\n    \"\"\"Module deprecation warning.\n\n    The nose tester turns ordinary Deprecation warnings into test failures.\n    That makes it hard to deprecate whole modules, because they get\n    imported by default. So this is a special Deprecation warning that the\n    nose tester will let pass without making tests fail.\n\n    \"\"\"\n    pass\n\n\nclass VisibleDeprecationWarning(UserWarning):\n    \"\"\"Visible deprecation warning.\n\n    By default, python will not show deprecation warnings, so this class\n    can be used when a very visible warning is helpful, for example because\n    the usage is most likely a user bug.\n\n    \"\"\"\n    pass\n\n\nclass _NoValue:\n    \"\"\"Special keyword value.\n\n    This class may be used as the default value assigned to a\n    deprecated keyword in order to check if it has been given a user\n    defined value.\n    \"\"\"\n    pass\n\n\n# oldnumeric and numarray were removed in 1.9. In case some packages import\n# but do not use them, we define them here for backward compatibility.\noldnumeric = 'removed'\nnumarray = 'removed'\n\n\n# We first need to detect if we're being called as part of the numpy setup\n# procedure itself in a reliable manner.\ntry:\n    __NUMPY_SETUP__\nexcept NameError:\n    __NUMPY_SETUP__ = False\n\n\nif __NUMPY_SETUP__:\n    import sys as _sys\n    _sys.stderr.write('Running from numpy source directory.\\n')\n    del _sys\nelse:\n    try:\n        from numpy.__config__ import show as show_config\n    except ImportError:\n        msg = \"\"\"Error importing numpy: you should not try to import numpy from\n        its source directory; please exit the numpy source tree, and relaunch\n        your python interpreter from there.\"\"\"\n        raise ImportError(msg)\n    from .version import git_revision as __git_revision__\n    from .version import version as __version__\n\n    from ._import_tools import PackageLoader\n\n    def pkgload(*packages, **options):\n        loader = PackageLoader(infunc=True)\n        return loader(*packages, **options)\n\n    from . import add_newdocs\n    __all__ = ['add_newdocs',\n               'ModuleDeprecationWarning',\n               'VisibleDeprecationWarning']\n\n    pkgload.__doc__ = PackageLoader.__call__.__doc__\n\n    # We don't actually use this ourselves anymore, but I'm not 100% sure that\n    # no-one else in the world is using it (though I hope not)\n    from .testing import Tester\n    test = testing.nosetester._numpy_tester().test\n    bench = testing.nosetester._numpy_tester().bench\n\n    # Allow distributors to run custom init code\n    from . import _distributor_init\n\n    from . import core\n    from .core import *\n    from . import compat\n    from . import lib\n    from .lib import *\n    from . import linalg\n    from . import fft\n    from . import polynomial\n    from . import random\n    from . import ctypeslib\n    from . import ma\n    from . import matrixlib as _mat\n    from .matrixlib import *\n    from .compat import long\n\n    # Make these accessible from numpy name-space\n    #  but not imported in from numpy import *\n    if sys.version_info[0] >= 3:\n        from builtins import bool, int, float, complex, object, str\n        unicode = str\n    else:\n        from __builtin__ import bool, int, float, complex, object, unicode, str\n\n    from .core import round, abs, max, min\n\n    __all__.extend(['__version__', 'pkgload', 'PackageLoader',\n               'show_config'])\n    __all__.extend(core.__all__)\n    __all__.extend(_mat.__all__)\n    __all__.extend(lib.__all__)\n    __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma'])\n\n    # Filter annoying Cython warnings that serve no good purpose.\n    import warnings\n    warnings.filterwarnings(\"ignore\", message=\"numpy.dtype size changed\")\n    warnings.filterwarnings(\"ignore\", message=\"numpy.ufunc size changed\")\n    warnings.filterwarnings(\"ignore\", message=\"numpy.ndarray size changed\")\n", "path": "numpy/__init__.py"}], "after_files": [{"content": "\"\"\"\nNumPy\n=====\n\nProvides\n  1. An array object of arbitrary homogeneous items\n  2. Fast mathematical operations over arrays\n  3. Linear Algebra, Fourier Transforms, Random Number Generation\n\nHow to use the documentation\n----------------------------\nDocumentation is available in two forms: docstrings provided\nwith the code, and a loose standing reference guide, available from\n`the NumPy homepage <http://www.scipy.org>`_.\n\nWe recommend exploring the docstrings using\n`IPython <http://ipython.scipy.org>`_, an advanced Python shell with\nTAB-completion and introspection capabilities.  See below for further\ninstructions.\n\nThe docstring examples assume that `numpy` has been imported as `np`::\n\n  >>> import numpy as np\n\nCode snippets are indicated by three greater-than signs::\n\n  >>> x = 42\n  >>> x = x + 1\n\nUse the built-in ``help`` function to view a function's docstring::\n\n  >>> help(np.sort)\n  ... # doctest: +SKIP\n\nFor some objects, ``np.info(obj)`` may provide additional help.  This is\nparticularly true if you see the line \"Help on ufunc object:\" at the top\nof the help() page.  Ufuncs are implemented in C, not Python, for speed.\nThe native Python help() does not know how to view their help, but our\nnp.info() function does.\n\nTo search for documents containing a keyword, do::\n\n  >>> np.lookfor('keyword')\n  ... # doctest: +SKIP\n\nGeneral-purpose documents like a glossary and help on the basic concepts\nof numpy are available under the ``doc`` sub-module::\n\n  >>> from numpy import doc\n  >>> help(doc)\n  ... # doctest: +SKIP\n\nAvailable subpackages\n---------------------\ndoc\n    Topical documentation on broadcasting, indexing, etc.\nlib\n    Basic functions used by several sub-packages.\nrandom\n    Core Random Tools\nlinalg\n    Core Linear Algebra Tools\nfft\n    Core FFT routines\npolynomial\n    Polynomial tools\ntesting\n    Numpy testing tools\nf2py\n    Fortran to Python Interface Generator.\ndistutils\n    Enhancements to distutils with support for\n    Fortran compilers support and more.\n\nUtilities\n---------\ntest\n    Run numpy unittests\nshow_config\n    Show numpy build configuration\ndual\n    Overwrite certain functions with high-performance Scipy tools\nmatlib\n    Make everything matrices.\n__version__\n    Numpy version string\n\nViewing documentation using IPython\n-----------------------------------\nStart IPython with the NumPy profile (``ipython -p numpy``), which will\nimport `numpy` under the alias `np`.  Then, use the ``cpaste`` command to\npaste examples into the shell.  To see which functions are available in\n`numpy`, type ``np.<TAB>`` (where ``<TAB>`` refers to the TAB key), or use\n``np.*cos*?<ENTER>`` (where ``<ENTER>`` refers to the ENTER key) to narrow\ndown the list.  To view the docstring for a function, use\n``np.cos?<ENTER>`` (to view the docstring) and ``np.cos??<ENTER>`` (to view\nthe source code).\n\nCopies vs. in-place operation\n-----------------------------\nMost of the functions in `numpy` return a copy of the array argument\n(e.g., `np.sort`).  In-place versions of these functions are often\navailable as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``.\nExceptions to this rule are documented.\n\n\"\"\"\nfrom __future__ import division, absolute_import, print_function\n\nimport sys\nimport warnings\n\n# Disallow reloading numpy. Doing that does nothing to change previously\n# loaded modules, which would need to be reloaded separately, but it does\n# change the identity of the warnings and sentinal classes defined below\n# with dire consequences when checking for identity.\nif '_is_loaded' in globals():\n    raise RuntimeError('Reloading numpy is not supported')\n_is_loaded = True\n\n\n# Define some global warnings and the _NoValue sentinal. Defining them here\n# means that their identity will change if numpy is reloaded, hence if that is\n# to be allowed they should be moved into their own, non-reloadable module.\n# Note that these should be defined (or imported) before the other imports.\nclass ModuleDeprecationWarning(DeprecationWarning):\n    \"\"\"Module deprecation warning.\n\n    The nose tester turns ordinary Deprecation warnings into test failures.\n    That makes it hard to deprecate whole modules, because they get\n    imported by default. So this is a special Deprecation warning that the\n    nose tester will let pass without making tests fail.\n\n    \"\"\"\n    pass\n\n\nclass VisibleDeprecationWarning(UserWarning):\n    \"\"\"Visible deprecation warning.\n\n    By default, python will not show deprecation warnings, so this class\n    can be used when a very visible warning is helpful, for example because\n    the usage is most likely a user bug.\n\n    \"\"\"\n    pass\n\n\nclass _NoValue:\n    \"\"\"Special keyword value.\n\n    This class may be used as the default value assigned to a deprecated\n    keyword in order to check if it has been given a user defined value.\n    \"\"\"\n    pass\n\n\n# oldnumeric and numarray were removed in 1.9. In case some packages import\n# but do not use them, we define them here for backward compatibility.\noldnumeric = 'removed'\nnumarray = 'removed'\n\n\n# We first need to detect if we're being called as part of the numpy setup\n# procedure itself in a reliable manner.\ntry:\n    __NUMPY_SETUP__\nexcept NameError:\n    __NUMPY_SETUP__ = False\n\nif __NUMPY_SETUP__:\n    sys.stderr.write('Running from numpy source directory.\\n')\nelse:\n    try:\n        from numpy.__config__ import show as show_config\n    except ImportError:\n        msg = \"\"\"Error importing numpy: you should not try to import numpy from\n        its source directory; please exit the numpy source tree, and relaunch\n        your python interpreter from there.\"\"\"\n        raise ImportError(msg)\n    from .version import git_revision as __git_revision__\n    from .version import version as __version__\n\n    from ._import_tools import PackageLoader\n\n    def pkgload(*packages, **options):\n        loader = PackageLoader(infunc=True)\n        return loader(*packages, **options)\n\n    from . import add_newdocs\n    __all__ = ['add_newdocs',\n               'ModuleDeprecationWarning',\n               'VisibleDeprecationWarning']\n\n    pkgload.__doc__ = PackageLoader.__call__.__doc__\n\n    # We don't actually use this ourselves anymore, but I'm not 100% sure that\n    # no-one else in the world is using it (though I hope not)\n    from .testing import Tester\n    test = testing.nosetester._numpy_tester().test\n    bench = testing.nosetester._numpy_tester().bench\n\n    # Allow distributors to run custom init code\n    from . import _distributor_init\n\n    from . import core\n    from .core import *\n    from . import compat\n    from . import lib\n    from .lib import *\n    from . import linalg\n    from . import fft\n    from . import polynomial\n    from . import random\n    from . import ctypeslib\n    from . import ma\n    from . import matrixlib as _mat\n    from .matrixlib import *\n    from .compat import long\n\n    # Make these accessible from numpy name-space\n    # but not imported in from numpy import *\n    if sys.version_info[0] >= 3:\n        from builtins import bool, int, float, complex, object, str\n        unicode = str\n    else:\n        from __builtin__ import bool, int, float, complex, object, unicode, str\n\n    from .core import round, abs, max, min\n\n    __all__.extend(['__version__', 'pkgload', 'PackageLoader',\n               'show_config'])\n    __all__.extend(core.__all__)\n    __all__.extend(_mat.__all__)\n    __all__.extend(lib.__all__)\n    __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma'])\n\n\n    # Filter annoying Cython warnings that serve no good purpose.\n    warnings.filterwarnings(\"ignore\", message=\"numpy.dtype size changed\")\n    warnings.filterwarnings(\"ignore\", message=\"numpy.ufunc size changed\")\n    warnings.filterwarnings(\"ignore\", message=\"numpy.ndarray size changed\")\n", "path": "numpy/__init__.py"}]}