1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
U
P±d%ã@spdZdddgZddlZddlZddlZddlmZddlmZejZej    Z    ddd„Z
dd„Z dd„Z dd„Z dS)z(Fortran to Python Interface Generator.
 
Úrun_mainÚcompileÚ get_includeéNé)Úf2py2e)ÚdiagnoseÚuntitledÚTú.fFc    Cs4ddl}ddl}|dkr4|j|d\}    }
t |    ¡n|}
t|tƒsLt|dƒ}z¼t|
dƒ}    |         |¡W5QRXdd||    j
g} t|tƒržtj
dk} |j || d    }|   |¡t jdd
g| } ztj| d d }Wn&tk
rðtj| d ddd}YnX|rt|j ¡ƒW5|dkrt |
¡X|r*|S|jSdS)a
    Build extension module from a Fortran 77 source string with f2py.
 
    Parameters
    ----------
    source : str or bytes
        Fortran source of module / subroutine to compile
 
        .. versionchanged:: 1.16.0
           Accept str as well as bytes
 
    modulename : str, optional
        The name of the compiled python module
    extra_args : str or list, optional
        Additional parameters passed to f2py
 
        .. versionchanged:: 1.16.0
            A list of args may also be provided.
 
    verbose : bool, optional
        Print f2py output to screen
    source_fn : str, optional
        Name of the file where the fortran source is written.
        The default is to use a temporary file with the extension
        provided by the ``extension`` parameter
    extension : ``{'.f', '.f90'}``, optional
        Filename extension if `source_fn` is not provided.
        The extension tells which fortran standard is used.
        The default is ``.f``, which implies F77 standard.
 
        .. versionadded:: 1.11.0
 
    full_output : bool, optional
        If True, return a `subprocess.CompletedProcess` containing
        the stdout and stderr of the compile process, instead of just
        the status code.
 
        .. versionadded:: 1.20.0
 
 
    Returns
    -------
    result : int or `subprocess.CompletedProcess`
        0 on success, or a `subprocess.CompletedProcess` if
        ``full_output=True``
 
    Examples
    --------
    .. literalinclude:: ../../source/f2py/code/results/compile_session.dat
        :language: python
 
    rN)Úsuffixzutf-8Úwz-cz-mÚposix)r z)import numpy.f2py as f2py2e;f2py2e.main()T)Úcapture_outputéó)ÚstdoutÚstderr)ÚtempfileÚshlexÚmkstempÚosÚcloseÚ
isinstanceÚstrÚremoveÚopenÚwriteÚnameÚsplitÚextendÚsysÚ
executableÚ
subprocessÚrunÚOSErrorÚCompletedProcessÚprintrÚdecodeÚ
returncode)ÚsourceÚ
modulenameÚ
extra_argsÚverboseZ    source_fnÚ    extensionZ full_outputrrÚfÚfnameÚargsZis_posixÚcÚcp©r3úJd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/f2py/__init__.pyrsB< 
 
 
 
 
þþ
 cCstj tj t¡d¡S)aw
    Return the directory that contains the ``fortranobject.c`` and ``.h`` files.
 
    .. note::
 
        This function is not needed when building an extension with
        `numpy.distutils` directly from ``.f`` and/or ``.pyf`` files
        in one go.
 
    Python extension modules built with f2py-generated code need to use
    ``fortranobject.c`` as a source file, and include the ``fortranobject.h``
    header. This function can be used to obtain the directory containing
    both of these files.
 
    Returns
    -------
    include_path : str
        Absolute path to the directory containing ``fortranobject.c`` and
        ``fortranobject.h``.
 
    Notes
    -----
    .. versionadded:: 1.21.1
 
    Unless the build system you are using has specific support for f2py,
    building a Python extension using a ``.pyf`` signature file is a two-step
    process. For a module ``mymod``:
 
    * Step 1: run ``python -m numpy.f2py mymod.pyf --quiet``. This
      generates ``_mymodmodule.c`` and (if needed)
      ``_fblas-f2pywrappers.f`` files next to ``mymod.pyf``.
    * Step 2: build your Python extension module. This requires the
      following source files:
 
      * ``_mymodmodule.c``
      * ``_mymod-f2pywrappers.f`` (if it was generated in Step 1)
      * ``fortranobject.c``
 
    See Also
    --------
    numpy.get_include : function that returns the numpy include directory
 
    Úsrc)rÚpathÚjoinÚdirnameÚ__file__r3r3r3r4r|s,cCs4|dkr ddlm}|tƒ}|Std t|¡ƒ‚dS)NÚtestr)Ú PytestTesterz!module {!r} has no attribute {!r})Znumpy._pytesttesterr;Ú__name__ÚAttributeErrorÚformat)Úattrr;r:r3r3r4Ú __getattr__«s ÿr@cCsttƒ ¡dhBƒS)Nr:)ÚlistÚglobalsÚkeysr3r3r3r4Ú__dir__¹srD)rr    TNr
F)Ú__doc__Ú__all__r r"rr    rrrÚmainrrr@rDr3r3r3r4Ú<module>s$
  ú
j/