K i[pdZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z mZmZmZddl mZe j$Ze j$ZejZe j,Zej.dk\Zded ed Zd Zd Zd ZdZdZddZdZ GddejBZ"dZ#dZ$dZ%dZ&dZ'ddZ(dZ)y)ae f2py2e - Fortran to Python C/API generator. 2nd Edition. See __usage__ below. Copyright 1999 -- 2011 Pearu Peterson all rights reserved. Copyright 2011 -- present NumPy Developers. Permission to use, modify, and distribute this software is given under the terms of the NumPy License. NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. N)f2py_build_generator) __version__auxfuncs capi_mapscb_rulescfuncs crackfortran f90mod_rulesrules)errmess) aJUsage: 1) To construct extension module sources: f2py [] [[[only:]||[skip:]] \ ] \ [: ...] 2) To compile fortran files and build extension modules: f2py -c [, , ] 3) To generate signature files: f2py -h ...< same options as in (1) > Description: This program generates a Python C/API file (module.c) that contains wrappers for given fortran functions so that they can be called from Python. With the -c option the corresponding extension modules are built. Options: -h Write signatures of the fortran routines to file and exit. You can then edit and use it instead of . If ==stdout then the signatures are printed to stdout. Names of fortran routines for which Python C/API functions will be generated. Default is all that are found in . Paths to fortran/signature files that will be scanned for in order to determine their signatures. skip: Ignore fortran functions that follow until `:'. only: Use only fortran functions that follow until `:'. : Get back to mode. -m Name of the module; f2py generates a Python/C API file module.c or extension module . Default is 'untitled'. '-include
' Writes additional headers in the C wrapper, can be passed multiple times, generates #include
each time. --[no-]lower Do [not] lower the cases in . By default, --lower is assumed with -h key, and --no-lower without -h key. --build-dir All f2py generated files are created in . Default is tempfile.mkdtemp(). --overwrite-signature Overwrite existing signature file. --[no-]latex-doc Create (or not) module.tex. Default is --no-latex-doc. --short-latex Create 'incomplete' LaTeX document (without commands \documentclass, \tableofcontents, and \begin{document}, \end{document}). --[no-]rest-doc Create (or not) module.rst. Default is --no-rest-doc. --debug-capi Create C/API code that reports the state of the wrappers during runtime. Useful for debugging. --[no-]wrap-functions Create Fortran subroutine wrappers to Fortran 77 functions. --wrap-functions is default because it ensures maximum portability/compiler independence. --[no-]freethreading-compatible Create a module that declares it does or doesn't require the GIL. The default is --freethreading-compatible for backward compatibility. Inspect the Fortran code you are wrapping for thread safety issues before passing --no-freethreading-compatible, as f2py does not analyze fortran code for thread safety issues. --include-paths ::... Search include files from the given directories. --help-link [..] List system resources found by system_info.py. See also --link- switch below. [..] is optional list of resources names. E.g. try 'f2py --help-link lapack_opt'. --f2cmap Load Fortran-to-Python KIND specification from the given file. Default: .f2py_f2cmap in current directory. --quiet Run quietly. --verbose Run with extra verbosity. --skip-empty-wrappers Only generate wrapper files when needed. -v Print f2py version ID and exit. build backend options (only effective with -c) [NO_MESON] is used to indicate an option not meant to be used with the meson backend or above Python 3.12: --fcompiler= Specify Fortran compiler type by vendor [NO_MESON] --compiler= Specify distutils C compiler type [NO_MESON] --help-fcompiler List available Fortran compilers and exit [NO_MESON] --f77exec= Specify the path to F77 compiler [NO_MESON] --f90exec= Specify the path to F90 compiler [NO_MESON] --f77flags= Specify F77 compiler flags --f90flags= Specify F90 compiler flags --opt= Specify optimization flags [NO_MESON] --arch= Specify architecture specific optimization flags [NO_MESON] --noopt Compile without optimization [NO_MESON] --noarch Compile without arch-dependent optimization [NO_MESON] --debug Compile with debugging information --dep Specify a meson dependency for the module. This may be passed multiple times for multiple dependencies. Dependencies are stored in a list for further processing. Example: --dep lapack --dep scalapack This will identify "lapack" and "scalapack" as dependencies and remove them from argv, leaving a dependencies list containing ["lapack", "scalapack"]. --backend Specify the build backend for the compilation process. The supported backends are 'meson' and 'distutils'. If not specified, defaults to 'distutils'. On Python 3.12 or higher, the default is 'meson'. Extra options (only effective with -c): --link- Link extension module with as defined by numpy.distutils/system_info.py. E.g. to link with optimized LAPACK libraries (vecLib on MacOSX, ATLAS elsewhere), use --link-lapack_opt. See also --help-link switch. [NO_MESON] -L/path/to/lib/ -l -D -U -I/path/to/include/ .o .so .a Using the following macros may be required with non-gcc Fortran compilers: -DPREPEND_FORTRAN -DNO_APPEND_FORTRAN -DUPPERCASE_FORTRAN When using -DF2PY_REPORT_ATEXIT, a performance report of F2PY interface is printed out at exit (platforms: Linux). When using -DF2PY_REPORT_ON_ARRAY_COPY=, a message is sent to stderr whenever F2PY interface makes a copy of an array. Integer sets the threshold for array sizes when a message should be shown. Version: z numpy Version: z License: NumPy license (see LICENSE.txt in the NumPy source code) Copyright 1999 -- 2011 Pearu Peterson all rights reserved. Copyright 2011 -- present NumPy Developers. https://numpy.org/doc/stable/f2py/index.html c ggggf\}}}}d\}}}}} } } } d} d}d}d}d}d}d}t|\}}}d\}}|ddd}|D].}|d k(r |d k(rd}|d k(rd}|d k(rd}"|dd dk(r|j|d d?|dk(rd}G|dk(rd} O|dk(rd}W|dk(rd} _|dk(r| dz } j|dk(rd}r|dk(rd}z|dk(rd}|dk(rd}|dk(rd}|dk(rd}|dk(rd|d<|dk(rd} |dk(rd} |dk(rd} |dk(rd|d <|d!k(rd}|d"k(rd}|dd#d$k(r%ttt j |d%k(rd}|dd d&k(rCt jd'j|d(dd)|d dzt j|d(d<Y|d*k(rd+}b|dd,k(r.td-t|d.t j |rd}|}|rd}|}| rd} |}| r d} ||d/<| r d} ||d0<| r d} ||d1<|dk(r) t|5 ddd|j||dk(r|j||dk(s|j|1|s'|s%|s#ttt j tjj!|s&| st#d5|d.tj$||r tjj'||}|rFtjj)|r'd |vr#td6|d7t j ||d8<||d9<| |d:<|dk(r|sd|d;<n||d;<|r||d<<|r||d=<|r||d><|r||d?<||d@<||dA<||dB<||dC<||dD<| |dE<|j+d1d||fS#1swYxYw#t$r}td2|d3|d4Yd}~d}~wwxYw)FN)rrrrrrrrrTr.)NN) buildpathcoutputf2py_wrapper_outputonly:skip::z--debug---lower --build-dirz --no-lower--quietz --verbosez --latex-docz--no-latex-docz --rest-docz --no-rest-docz--wrap-functionsz--no-wrap-functionsz --short-latex shortlatexz --coutputz--f2py-wrapper-output--f2cmapz--overwrite-signaturez h-overwrite-h-mz-vz--show-compilersz-include userincludes z #include z--skip-empty-wrappersF-zUnknown option  rr f2cmap_filez OSError: z. Skipping file "z". zCreating build directory zSignature file "z4" exists!!! Use --overwrite-signature to overwrite. emptygendebugverbosedo-lowermodule signsfile onlyfuncs skipfuncs dolatexdoc dorestdoc wrapfuncsr include_paths requires_gil)get_newer_optionsappendprint f2py_versionsysexitr outneedsr#r repropenOSError __usage__ospathisdiroutmessmkdirjoinisfile setdefault) inputlinefilesr/r.r)ff2f3f5f6f8f9f10r*r(dolcr0r1r2rr3freethreading_compatibler- modulenameoptionsldetails W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/numpy/f2py/f2py2e.py scaninputlinerYs)+RR&E9i%;"Ar2r2r2sGH DJIII9J99U6M+Y&Iz%&*,GX  7  '\A '\A #XA rUj LL12  )^D - B , D )^G +  qLG - J " "J , I / !I $ $I ' 'I / !$%GL ! + B ) )B *_C ) )%&GM " $YB $YB rUd] ,  HHJ $ $B rUj OON + 2 21Qr7 ;+612+>F  !B ( ) )H qTS[ od1gYb1 2 HHJ BI BJ BI B!"GI  B-.G) * C%&GM " !V J!W Q"W   Q  !V   Q qX r eJ i  77== # / {"= > GGLLI6 RWW^^I.=3Oyk)^ _ a  "GJGG GI rz) " &( ( ( &GL$GK$GK$GK,GO"::GN }d+ '>[ J)F:->qe4HII Js0 O #N=%O =O O  O0O++O0c|t_|dt_|dt_d|vr|dt_d|vr|dt_d|vr|dt_|dtjdd|dt_ tj|}d|vr{td |dd tj|}|dd dd k(r tjj|n)t|dd 5}|j|ddd|d|D] }|dd|d<n|D] }|d|d< |d|D] }|dd|d<n|D] }|d|d< |D]}|drd|d<d|d<|S#1swYpxYw)Nr)r*r,r/r.r3r+r-zSaving signatures to file "z" istdoutwrnamezmodule.crz-f2pywrappers.fr4Py_MOD_GIL_USEDgil_usedPy_MOD_GIL_NOT_USED)r rUr r)r* f77modulenamer/r.r3 dolowercaserC crack2fortranr9r[writer=)rIrUpostlistpyfrJmods rXcallcrackfortranrhWsEM )L"9-L7%,X%6 "g!(!5 g!(!5 $+O$ "/C O3C O 4 O'  s <E==Fc tjtdggi}}}|D]}d|dvrtj| d|vr8|dj D]"}||vrg||<||j |d$|j ||j |di}t||D]\}}||vr,td|ddjd||Dd 6g} d|vrV|dj D]@}||vr(||vr$| j ||j|/td |d |d Bi||<t||tj|| |S) NzBuilding modules... __user__r]usez Skipping module "" which is used by ,c3&K|] }d|z yw)z"%s"N.0ss rX zbuildmodules..sBavzBs. z Module "z" uses nonexisting "z" which will be ignored. ) r buildcfuncsrCrbuildcallbackskeysr6ziprEindex dict_appendr buildmodule) lstmodulesmnamesisusedbyitemuretr,r]ums rX buildmodulesrs  #$ "BXVG ( f %  # #D )}e))+5A(&( QK&&tF|45 NN4 MM$v, ' ( CGV,B  8  chhB8D>BBD EB++-8AH}f '&,,q/":;(.B1#F778 8CI D 5#4#4VR#@ AB Jc|jD]>\}}||vrg||<t|tr |||z||<+||j|@yN)items isinstancelistr6)d_outd_inkvs rXrzrzsV**,A E>E!H a Qx!|E!H !HOOA  rctjtjj tjj t j}tjj|dd}tjj|dd}t}|j|\}}tdd|\}}|jr.d|vr |j}nt||j}|d|gz }t|\} } | t_t#j$| dt'| | } i} | D]?} d | vs| d j)D]"}|| vrg| |<| |j+| d $A| D]G} | d }| d d k(sd |vs|| vsdjd| |D}t-d|d|dId| vrV| ddkDrMt-dt-tjj/t0j2dd| ddy| D]3} | d d k7s d | vr t5dt7dt9| d z| dt_| t<_| dt_tA| }|j)D]}tC||||d|S)au Equivalent to running:: f2py where ``=string.join(,' ')``, but in Python. Unless ``-h`` is used, this function returns a dictionary containing information on generated modules and their dependencies on source files. You cannot build extension modules with this function, that is, using ``-c`` is not allowed. Use the ``compile`` command instead. Examples -------- The command ``f2py -m scalar scalar.f`` can be executed from Python as follows. .. literalinclude:: ../../source/f2py/code/results/run_main_session.dat :language: python srczfortranobject.hzfortranobject.cr[.]pyf([.]src|)r r!r'rkr]blockz python modulerjrmc3(K|] }d|d yw)"Nrorps rXrszrun_main..s!JqAaS(!Jsz$Skipping Makefile build for module "rlr&r-r*rzKStopping. Edit the signature file and then run f2py on the signature file: r NzJTip: If your original code is Fortran source then you must use -m option. z2All blocks must be python module blocks but got %sr)r2)csrch)"r reset_global_f2py_varsr@rAdirnameabspathr __file__rEmake_f2py_compile_parserparse_known_args filter_files module_namevalidate_modulenamerYrrUrload_f2cmap_filerhrwr6rCbasenamer9argvr TypeErrorr< debugoptionsr r2rrz) comline_listf2pydirfobjhsrcfobjcsrcparserargs pyf_files_modnamerIrUrerplistrrusedbyrmns rXrun_mainrs.'')ggoobggoofoo>?Gww||GU,=>Hww||GU,=>H % 'F00>D,$5|DLIq  <    *4++G w' "<0NE7H w}56w/HH2 E>5\&&( 2H$"$HQK ""5=1 22 4Fm >_ ,{1Jh&!JH[4I!JJ:;-H((.xr34 4g 9  ! ] _ rww'' 45Qw{7K6LBO P' >_ ,g-acPU7^$&' ' '$G,H"L -H x Chhj@CGhX>?@ Jrc.gg}}tj|dz|zdzj}|r t|}nd}|Dcgc]}|j c}D]0} || r|j | |d |j | 2||fScc}w)z, Filter files by prefix and suffix. z.*z\ZrN)recompilematchlenstripr6) prefixsuffixrI remove_prefixfilteredrestrindxfiles rXrrsdH JJv~.6 7 = =E&k$)*q* ; OODJ ' KK   T> +sBctjjtjj|j}|Sr)r@rArr)r,ps rX get_prefixrs* 89A HrceZdZddZy)CombineIncludePathsNctt|dgxsg}|dk(r td|dvr!|j|j dn|j |t ||_y)Nr3--include_pathszJUse --include-paths or -I instead of --include_paths which will be removed>--include-pathsrr)setgetattrrCupdatesplitaddrr3)selfr namespacevalues option_stringinclude_paths_sets rX__call__zCombineIncludePaths.__call__si ?B G M2N - - ` a B B  $ $V\\#%6 7  ! !& )"&'8"9 rr)__name__ __module__ __qualname__rrorrXrrs:rrctjd}|jddt|jddt|jddt|jdd tj|S) NFadd_helpz-Ir3)destactionrrz--freethreading-compatibleftcompat)argparseArgumentParser add_argumentrBooleanOptionalActionrs rX f2py_parserr'sw  $ $e 4F ?;NO )H[\ )H[\ 4:hNlNlm Mrcdj|j}t}|j|\}}|j}|jg}||j |fS)Nr)rErrrr3r)ilinerrremainipathss rXr5r5/s` XXe_ # # %E ]F**51LD&   F ! 4==& ((rctjd}|jddd|jddd gd |jd d |S)NFrz--depr6 dependencies)rrz --backendmeson distutils)choicesdefaultr!r)r)rrrrs rXrr8sY  $ $e 4F ~F  g{-C[Y =1 Mrct}|j\}}tjdg|zt_|j}t r|dk(r t dd}|jxsg||jdS)NrrzMCannot use distutils backend with Python>=3.12, using meson backend instead. r)rbackendrT) rrr9rrMESON_ONLY_VERrCrr)rrremaining_argv backend_keys rXpreparse_sysargvr?s& 'F!224D. }~-CH,,K+42 3 ))/R&& rc>ddl}t}|d}|d}|d}|d}t|}tjj d}tj|=d} tjj d}|r:)=>CHK B XXab\" " "B #XB c   q ! "{2#-3k" XX?r;)>?CH JJ? AE"xx|?u{{2"?J? XX>r:)=>CH #67**%hi XXab\Ir->-D-DR-HIHI$'HHQRLRb4G4M4Mb4QrROR kW4( XXPrH4N)OPCHH   Wc!f:?!7F 6446#I$=$=$B$B$DE CFG***,,R\)DE!"XB$$Q' . 3 1 /0   Q  qM z?a 1j!11  JJ~ &E # @" B2@K@ XX?r;)>?CHJ9%hhqrlGICHH HHNN9 %#((1QU+, HHQUOSXXa[((12,&r+@@>JRQ($ET[[]2!$5aAj\"CDEA?s ^9^!^!( ^&2^& ^+^0^0/ ^59^5 ^:^:^?%^?= ___ -_ __ _ __``4 `>` ^^6``c t|dkDr td|r6|d}tj|}||k7rt d|d|d|d|}|S)NrzOnly one .pyf file per callrz Ignoring -m rtz defines z to be the modulename. )rrrget_f2py_modulenamerC)rrTpyff pyf_modnames rXrrsp 9~677|2248  $ zl#& +.FH %J rc$dtjddvr?tjjdtr t dyddlm}|ydtjddvr tyttjddy)Nz --help-linkrzUse --dep for meson builds rshow_allr) r9rremoverrCnumpy.distutils.system_infor0r)rr/s rXmainr3sk $  &  2 3  = J sxx| !"rr)r)*__doc__rr@pprintrr9numpy.f2py._backendsrrrrrrr r r r r versionr8 numpy_versionshowrC version_inforr?rYrhrrzrrrActionrrr5rrr)rr3rorrXr<s  5   "" ## }}   ""g-Vl^/o[2 ~L^&R FUp$ :(// :)(aH  r