File indexing completed on 2024-05-12 16:09:14

0001 #!/usr/bin/env python
0002 
0003 # SPDX-FileCopyrightText: 2014 Sven Brauch <svenbrauch@gmail.com>
0004 # SPDX-License-Identifier: GPL-2.0-or-later
0005 
0006 import importlib
0007 
0008 modules = ["numpy", "numpy.ctypeslib",
0009            "numpy.lib.scimath", "numpy.fft", "numpy.linalg",
0010            "numpy.testing", "numpy.random"]
0011 
0012 special_hints = {
0013     "array": { "returns": "ndarray()" }
0014 }
0015 
0016 import sys
0017 sys.path.append("../introspection/")
0018 import introspect
0019 with open("../../documentation_files/numpy.py", 'w') as sys.stdout:
0020     sys.stdout.write("class getset_descriptor: pass\n")
0021     sys.stdout.write("class dictproxy: pass\n")
0022     sys.stdout.write("class member_descriptor: pass\n")
0023 
0024     for module in modules:
0025         dumper = introspect.ModuleDumper(importlib.import_module(module),
0026                                          startIndent=4*(module.count('.')),
0027                                          special_hints=special_hints)
0028         for index, component in enumerate(module.split('.')[1:]):
0029             sys.stdout.write((" "*index*4) + "class " + component + ":\n")
0030         dumper.dump()
0031 
0032     sys.stdout.write("fromfile = _fromfile\n")
0033     sys.stdout.write("frombuffer = _frombuffer\n")
0034     sys.stdout.write("fromstring = _fromstring\n")