summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-07-25 22:38:27 -0600
committerCharles Harris <charlesr.harris@gmail.com>2015-07-25 23:18:23 -0600
commitb80d1f979efb528e855263a38b389cebd3eb90e1 (patch)
treee0db4e5367b504971e4456f6a6286437dfff8812 /numpy/f2py
parente81b9eee676102fbd1c1c2916764e6ce71bac793 (diff)
downloadnumpy-b80d1f979efb528e855263a38b389cebd3eb90e1.tar.gz
STY: Make pyflakes fixes in numpy/f2py
Diffstat (limited to 'numpy/f2py')
-rw-r--r--numpy/f2py/__init__.py7
-rw-r--r--numpy/f2py/auxfuncs.py31
-rw-r--r--numpy/f2py/capi_maps.py19
-rw-r--r--numpy/f2py/cb_rules.py15
-rw-r--r--numpy/f2py/common_rules.py11
-rwxr-xr-xnumpy/f2py/crackfortran.py171
-rw-r--r--numpy/f2py/diagnose.py3
-rwxr-xr-xnumpy/f2py/f2py2e.py338
-rw-r--r--numpy/f2py/f90mod_rules.py13
-rw-r--r--numpy/f2py/func2subr.py17
-rw-r--r--numpy/f2py/rules.py34
-rw-r--r--numpy/f2py/use_rules.py19
12 files changed, 405 insertions, 273 deletions
diff --git a/numpy/f2py/__init__.py b/numpy/f2py/__init__.py
index fcfd1853e..ef4d54e9d 100644
--- a/numpy/f2py/__init__.py
+++ b/numpy/f2py/__init__.py
@@ -1,18 +1,17 @@
#!/usr/bin/env python
+"""Fortran to Python Interface Generator.
+
+"""
from __future__ import division, absolute_import, print_function
__all__ = ['run_main', 'compile', 'f2py_testing']
-import os
import sys
-import subprocess
from . import f2py2e
from . import f2py_testing
from . import diagnose
-from .info import __doc__
-
run_main = f2py2e.run_main
main = f2py2e.main
diff --git a/numpy/f2py/auxfuncs.py b/numpy/f2py/auxfuncs.py
index 2e016e186..d762aa7a5 100644
--- a/numpy/f2py/auxfuncs.py
+++ b/numpy/f2py/auxfuncs.py
@@ -24,12 +24,37 @@ from functools import reduce
from . import __version__
from . import cfuncs
+__all__ = [
+ 'applyrules', 'debugcapi', 'dictappend', 'errmess', 'gentitle',
+ 'getargs2', 'getcallprotoargument', 'getcallstatement',
+ 'getfortranname', 'getpymethoddef', 'getrestdoc', 'getusercode',
+ 'getusercode1', 'hasbody', 'hascallstatement', 'hascommon',
+ 'hasexternals', 'hasinitvalue', 'hasnote', 'hasresultnote',
+ 'isallocatable', 'isarray', 'isarrayofstrings', 'iscomplex',
+ 'iscomplexarray', 'iscomplexfunction', 'iscomplexfunction_warn',
+ 'isdouble', 'isdummyroutine', 'isexternal', 'isfunction',
+ 'isfunction_wrap', 'isint1array', 'isinteger', 'isintent_aux',
+ 'isintent_c', 'isintent_callback', 'isintent_copy', 'isintent_dict',
+ 'isintent_hide', 'isintent_in', 'isintent_inout', 'isintent_inplace',
+ 'isintent_nothide', 'isintent_out', 'isintent_overwrite', 'islogical',
+ 'islogicalfunction', 'islong_complex', 'islong_double',
+ 'islong_doublefunction', 'islong_long', 'islong_longfunction',
+ 'ismodule', 'ismoduleroutine', 'isoptional', 'isprivate', 'isrequired',
+ 'isroutine', 'isscalar', 'issigned_long_longarray', 'isstring',
+ 'isstringarray', 'isstringfunction', 'issubroutine',
+ 'issubroutine_wrap', 'isthreadsafe', 'isunsigned', 'isunsigned_char',
+ 'isunsigned_chararray', 'isunsigned_long_long',
+ 'isunsigned_long_longarray', 'isunsigned_short',
+ 'isunsigned_shortarray', 'l_and', 'l_not', 'l_or', 'outmess',
+ 'replace', 'show', 'stripcomma', 'throw_error',
+]
+
+
f2py_version = __version__.version
-errmess=sys.stderr.write
-#outmess=sys.stdout.write
-show=pprint.pprint
+errmess = sys.stderr.write
+show = pprint.pprint
options={}
debugoptions=[]
diff --git a/numpy/f2py/capi_maps.py b/numpy/f2py/capi_maps.py
index 6155165ba..ce7c0d90e 100644
--- a/numpy/f2py/capi_maps.py
+++ b/numpy/f2py/capi_maps.py
@@ -22,10 +22,27 @@ import copy
import re
import os
import sys
-from .auxfuncs import *
+from .auxfuncs import (
+ debugcapi, dictappend, errmess, gentitle, getcallprotoargument,
+ getcallstatement, getfortranname, getpymethoddef, getrestdoc,
+ getusercode, getusercode1, hasinitvalue, hasnote, hasresultnote,
+ isarray, iscomplex, iscomplexarray, iscomplexfunction, isexternal,
+ isfunction, isintent_aux, isintent_callback, isintent_dict,
+ isintent_hide, isintent_in, isintent_inout, isintent_out, ismodule,
+ isoptional, isrequired, isscalar, isstring, isstringarray,
+ isstringfunction, issubroutine, l_and, l_not, l_or, outmess
+)
+
from .crackfortran import markoutercomma
from . import cb_rules
+__all__ = [
+ 'getctype', 'getstrlength', 'getarrdims', 'getpydocsign',
+ 'getarrdocsign', 'getinit', 'sign2map', 'routsign2map', 'modsign2map',
+ 'cb_sign2map', 'cb_routsign2map', 'common_sign2map'
+]
+
+
# Numarray and Numeric users should set this False
using_newcore = True
diff --git a/numpy/f2py/cb_rules.py b/numpy/f2py/cb_rules.py
index 5cf6b3010..29c0c1c5d 100644
--- a/numpy/f2py/cb_rules.py
+++ b/numpy/f2py/cb_rules.py
@@ -15,18 +15,19 @@ Pearu Peterson
"""
from __future__ import division, absolute_import, print_function
-import pprint
-import sys
-
from . import __version__
-from .auxfuncs import *
+from .auxfuncs import (
+ applyrules, debugcapi, dictappend, errmess, getargs, hasnote, isarray,
+ iscomplex, iscomplexarray, iscomplexfunction, isfunction, isintent_c,
+ isintent_hide, isintent_in, isintent_inout, isintent_nothide,
+ isintent_out, isoptional, isrequired, isscalar, isstring,
+ isstringfunction, issubroutine, l_and, l_not, l_or, outmess, replace,
+ stripcomma, throw_error
+)
from . import cfuncs
f2py_version = __version__.version
-errmess=sys.stderr.write
-outmess=sys.stdout.write
-show=pprint.pprint
################## Rules for callback function ##############
diff --git a/numpy/f2py/common_rules.py b/numpy/f2py/common_rules.py
index d3b7f6dc2..0a4644465 100644
--- a/numpy/f2py/common_rules.py
+++ b/numpy/f2py/common_rules.py
@@ -20,17 +20,12 @@ __version__ = "$Revision: 1.19 $"[10:-1]
from . import __version__
f2py_version = __version__.version
-import pprint
-import sys
-errmess=sys.stderr.write
-outmess=sys.stdout.write
-show=pprint.pprint
-
-from .auxfuncs import *
+from .auxfuncs import (
+ hasbody, hascommon, hasnote, isintent_hide, outmess
+)
from . import capi_maps
from . import func2subr
from .crackfortran import rmbadname
-##############
def findcommonblocks(block,top=1):
ret = []
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py
index 0fde37bcf..3a5940d6f 100755
--- a/numpy/f2py/crackfortran.py
+++ b/numpy/f2py/crackfortran.py
@@ -144,54 +144,62 @@ import sys
import string
import fileinput
import re
-import pprint
import os
import copy
import platform
from . import __version__
-from .auxfuncs import *
+from .auxfuncs import (
+ errmess, hascommon, isdouble, iscomplex, isexternal,isinteger,
+ isintent_aux, isintent_c, isintent_callback, isintent_in,
+ isintent_inout, isintent_inplace,islogical, isoptional,isscalar,
+ isstring, isstringarray, l_or, show
+)
+
f2py_version = __version__.version
# Global flags:
-strictf77=1 # Ignore `!' comments unless line[0]=='!'
-sourcecodeform='fix' # 'fix','free'
-quiet=0 # Be verbose if 0 (Obsolete: not used any more)
-verbose=1 # Be quiet if 0, extra verbose if > 1.
-tabchar=4*' '
-pyffilename=''
-f77modulename=''
-skipemptyends=0 # for old F77 programs without 'program' statement
-ignorecontains=1
-dolowercase=1
-debug=[]
+strictf77 = 1 # Ignore `!' comments unless line[0]=='!'
+sourcecodeform = 'fix' # 'fix','free'
+quiet = 0 # Be verbose if 0 (Obsolete: not used any more)
+verbose = 1 # Be quiet if 0, extra verbose if > 1.
+tabchar = 4*' '
+pyffilename = ''
+f77modulename = ''
+skipemptyends = 0 # for old F77 programs without 'program' statement
+ignorecontains = 1
+dolowercase = 1
+debug = []
# Global variables
-groupcounter=0
-grouplist={groupcounter:[]}
-neededmodule=-1
-expectbegin=1
-skipblocksuntil=-1
-usermodules=[]
-f90modulevars={}
-gotnextfile=1
-filepositiontext=''
-currentfilename=''
-skipfunctions=[]
-skipfuncs=[]
-onlyfuncs=[]
-include_paths=[]
+beginpattern = ''
+currentfilename = ''
+expectbegin = 1
+f90modulevars = {}
+filepositiontext = ''
+gotnextfile = 1
+groupcache = None
+groupcounter = 0
+grouplist = {groupcounter:[]}
+groupname = ''
+include_paths = []
+neededmodule = -1
+onlyfuncs = []
previous_context = None
+skipblocksuntil = -1
+skipfuncs = []
+skipfunctions = []
+usermodules = []
def reset_global_f2py_vars():
- global groupcounter, grouplist, neededmodule, expectbegin, \
- skipblocksuntil, usermodules, f90modulevars, gotnextfile, \
- filepositiontext, currentfilename, skipfunctions, skipfuncs, \
- onlyfuncs, include_paths, previous_context, \
- strictf77, sourcecodeform, quiet, verbose, tabchar, pyffilename, \
- f77modulename, skipemptyends, ignorecontains, dolowercase, debug
+ global groupcounter, grouplist, neededmodule, expectbegin
+ global skipblocksuntil, usermodules, f90modulevars, gotnextfile
+ global filepositiontext, currentfilename, skipfunctions, skipfuncs
+ global onlyfuncs, include_paths, previous_context
+ global strictf77, sourcecodeform, quiet, verbose, tabchar, pyffilename
+ global f77modulename, skipemptyends, ignorecontains, dolowercase, debug
# flags
strictf77 = 1
@@ -223,15 +231,16 @@ def reset_global_f2py_vars():
previous_context = None
-###### Some helper functions
-def show(o,f=0):pprint.pprint(o)
-errmess=sys.stderr.write
def outmess(line,flag=1):
global filepositiontext
- if not verbose: return
+
+ if not verbose:
+ return
if not quiet:
- if flag:sys.stdout.write(filepositiontext)
+ if flag:
+ sys.stdout.write(filepositiontext)
sys.stdout.write(line)
+
re._MAXCACHE=50
defaultimplicitrules={}
for c in "abcdefghopqrstuvwxyz$_": defaultimplicitrules[c]={'typespec':'real'}
@@ -312,8 +321,9 @@ def readfortrancode(ffile,dowithline=show,istop=1):
2) Call dowithline(line) on every line.
3) Recursively call itself when statement \"include '<filename>'\" is met.
"""
- global gotnextfile, filepositiontext, currentfilename, sourcecodeform, strictf77,\
- beginpattern, quiet, verbose, dolowercase, include_paths
+ global gotnextfile, filepositiontext, currentfilename, sourcecodeform, strictf77
+ global beginpattern, quiet, verbose, dolowercase, include_paths
+
if not istop:
saveglobals=gotnextfile, filepositiontext, currentfilename, sourcecodeform, strictf77,\
beginpattern, quiet, verbose, dolowercase
@@ -552,9 +562,10 @@ def crackline(line,reset=0):
Cracked data is saved in grouplist[0].
"""
- global beginpattern, groupcounter, groupname, groupcache, grouplist, gotnextfile,\
- filepositiontext, currentfilename, neededmodule, expectbegin, skipblocksuntil,\
- skipemptyends, previous_context
+ global beginpattern, groupcounter, groupname, groupcache, grouplist
+ global filepositiontext, currentfilename, neededmodule, expectbegin
+ global skipblocksuntil, skipemptyends, previous_context, gotnextfile
+
if ';' in line and not (f2pyenhancementspattern[0].match(line) or
multilinepattern[0].match(line)):
for l in line.split(';'):
@@ -764,9 +775,10 @@ def _resolvenameargspattern(line):
return None, [], None, None
def analyzeline(m, case, line):
- global groupcounter, groupname, groupcache, grouplist, filepositiontext,\
- currentfilename, f77modulename, neededinterface, neededmodule, expectbegin,\
- gotnextfile, previous_context
+ global groupcounter, groupname, groupcache, grouplist, filepositiontext
+ global currentfilename, f77modulename, neededinterface, neededmodule
+ global expectbegin, gotnextfile, previous_context
+
block=m.group('this')
if case != 'multiline':
previous_context = None
@@ -1267,24 +1279,33 @@ def removespaces(expr):
expr2=expr2+expr[i]
expr2=expr2+expr[-1]
return expr2
+
def markinnerspaces(line):
- l='';f=0
- cc='\''
- cc1='"'
- cb=''
+ l = '';
+ f = 0
+ cc = '\''
+ cb = ''
for c in line:
- if cb=='\\' and c in ['\\', '\'', '"']:
- l=l+c
- cb=c
+ if cb == '\\' and c in ['\\', '\'', '"']:
+ l = l + c
+ cb = c
continue
- if f==0 and c in ['\'', '"']: cc=c; cc1={'\'':'"','"':'\''}[c]
- if c==cc:f=f+1
- elif c==cc:f=f-1
- elif c==' ' and f==1: l=l+'@_@'; continue
- l=l+c;cb=c
+ if f == 0 and c in ['\'', '"']:
+ cc = c
+ if c == cc:
+ f = f + 1
+ elif c == cc:
+ f = f - 1
+ elif c==' ' and f == 1:
+ l = l + '@_@'
+ continue
+ l = l + c
+ cb = c
return l
+
def updatevars(typespec, selector, attrspec, entitydecl):
global groupcache, groupcounter
+
last_name = None
kindselect, charselect, typename=cracktypespec(typespec, selector)
if attrspec:
@@ -1513,6 +1534,7 @@ def getblockname(block,unknown='unknown'):
def setmesstext(block):
global filepositiontext
+
try:
filepositiontext='In: %s:%s\n'%(block['from'], block['name'])
except:
@@ -1528,6 +1550,7 @@ def get_usedict(block):
def get_useparameters(block, param_map=None):
global f90modulevars
+
if param_map is None:
param_map = {}
usedict = get_usedict(block)
@@ -1555,6 +1578,7 @@ def get_useparameters(block, param_map=None):
def postcrack2(block,tab='',param_map=None):
global f90modulevars
+
if not f90modulevars:
return block
if isinstance(block, list):
@@ -1594,6 +1618,7 @@ def postcrack(block,args=None,tab=''):
determine expression types if in argument list
"""
global usermodules, onlyfunctions
+
if isinstance(block, list):
gret=[]
uret=[]
@@ -1611,14 +1636,13 @@ def postcrack(block,args=None,tab=''):
str(block))
if 'name' in block and not block['name']=='unknown_interface':
outmess('%sBlock: %s\n'%(tab, block['name']), 0)
- blocktype=block['block']
- block=analyzeargs(block)
- block=analyzecommon(block)
- block['vars']=analyzevars(block)
- block['sortvars']=sortvarnames(block['vars'])
+ block = analyzeargs(block)
+ block = analyzecommon(block)
+ block['vars'] = analyzevars(block)
+ block['sortvars'] = sortvarnames(block['vars'])
if 'args' in block and block['args']:
- args=block['args']
- block['body']=analyzebody(block, args, tab=tab)
+ args = block['args']
+ block['body'] = analyzebody(block, args, tab=tab)
userisdefined=[]
## fromuser = []
@@ -1751,6 +1775,7 @@ def analyzecommon(block):
def analyzebody(block,args,tab=''):
global usermodules, skipfuncs, onlyfuncs, f90modulevars
+
setmesstext(block)
body=[]
for b in block['body']:
@@ -2069,7 +2094,8 @@ def get_parameters(vars, global_params={}):
v[m.start():m.end()].lower().replace('d', 'e'))
v = ''.join(tt)
if iscomplex(vars[n]):
- if v[0]=='(' and v[-1]==')':
+ if v[0] == '(' and v[-1] == ')':
+ # FIXME, unused l looks like potential bug
l = markoutercomma(v[1:-1]).split('@,@')
try:
params[n] = eval(v, g_params, params)
@@ -2109,6 +2135,7 @@ def _eval_scalar(value, params):
def analyzevars(block):
global f90modulevars
+
setmesstext(block)
implicitrules, attrrules=buildimplicitrules(block)
vars=copy.copy(block['vars'])
@@ -2547,6 +2574,7 @@ def determineexprtype(expr,vars,rules={}):
######
def crack2fortrangen(block,tab='\n', as_interface=False):
global skipfuncs, onlyfuncs
+
setmesstext(block)
ret=''
if isinstance(block, list):
@@ -2561,8 +2589,9 @@ def crack2fortrangen(block,tab='\n', as_interface=False):
prefix=''
name=''
args=''
- blocktype=block['block']
- if blocktype=='program': return ''
+ blocktype = block['block']
+ if blocktype == 'program':
+ return ''
argsl = []
if 'name' in block:
name=block['name']
@@ -2579,7 +2608,7 @@ def crack2fortrangen(block,tab='\n', as_interface=False):
for k in list(block['f2pyenhancements'].keys()):
f2pyenhancements = '%s%s%s %s'%(f2pyenhancements, tab+tabchar, k, block['f2pyenhancements'][k])
intent_lst = block.get('intent', [])[:]
- if blocktype=='function' and 'callback' in intent_lst:
+ if blocktype == 'function' and 'callback' in intent_lst:
intent_lst.remove('callback')
if intent_lst:
f2pyenhancements = '%s%sintent(%s) %s'%\
@@ -2610,7 +2639,7 @@ def crack2fortrangen(block,tab='\n', as_interface=False):
entry_stmts = '%s%sentry %s(%s)' \
% (entry_stmts, tab+tabchar, k, ','.join(i))
body = body + entry_stmts
- if blocktype=='block data' and name=='_BLOCK_DATA_':
+ if blocktype == 'block data' and name == '_BLOCK_DATA_':
name = ''
ret='%s%s%s %s%s%s %s%s%s%s%s%s%send %s %s'%(tab, prefix, blocktype, name, args, result, mess, f2pyenhancements, use, vars, common, body, tab, blocktype, name)
return ret
@@ -2777,6 +2806,7 @@ def vars2fortran(block,vars,args,tab='', as_interface=False):
def crackfortran(files):
global usermodules
+
outmess('Reading fortran codes...\n', 0)
readfortrancode(files, crackline)
outmess('Post-processing...\n', 0)
@@ -2788,6 +2818,7 @@ def crackfortran(files):
def crack2fortran(block):
global f2py_version
+
pyf=crack2fortrangen(block)+'\n'
header="""! -*- f90 -*-
! Note: the context of this file is case sensitive.
diff --git a/numpy/f2py/diagnose.py b/numpy/f2py/diagnose.py
index 68d7e48d2..683a8c7e3 100644
--- a/numpy/f2py/diagnose.py
+++ b/numpy/f2py/diagnose.py
@@ -7,8 +7,9 @@ import tempfile
def run_command(cmd):
print('Running %r:' % (cmd))
- s = os.system(cmd)
+ os.system(cmd)
print('------')
+
def run():
_path = os.getcwd()
os.chdir(tempfile.gettempdir())
diff --git a/numpy/f2py/f2py2e.py b/numpy/f2py/f2py2e.py
index 25407d421..254f99966 100755
--- a/numpy/f2py/f2py2e.py
+++ b/numpy/f2py/f2py2e.py
@@ -31,7 +31,7 @@ from . import __version__
f2py_version = __version__.version
errmess = sys.stderr.write
-#outmess=sys.stdout.write
+# outmess=sys.stdout.write
show = pprint.pprint
outmess = auxfuncs.outmess
@@ -170,124 +170,170 @@ numpy Version: %s
Requires: Python 2.3 or higher.
License: NumPy license (see LICENSE.txt in the NumPy source code)
Copyright 1999 - 2011 Pearu Peterson all rights reserved.
-http://cens.ioc.ee/projects/f2py2e/"""%(f2py_version, numpy_version)
+http://cens.ioc.ee/projects/f2py2e/""" % (f2py_version, numpy_version)
+
def scaninputline(inputline):
- files, funcs, skipfuncs, onlyfuncs, debug=[], [], [], [], []
- f, f2, f3, f4, f5, f6, f7, f8, f9=1, 0, 0, 0, 0, 0, 0, 0, 0
+ files, skipfuncs, onlyfuncs, debug = [], [], [], []
+ f, f2, f3, f5, f6, f7, f8, f9 = 1, 0, 0, 0, 0, 0, 0, 0
verbose = 1
- dolc=-1
+ dolc = -1
dolatexdoc = 0
dorestdoc = 0
wrapfuncs = 1
buildpath = '.'
include_paths = []
- signsfile, modulename=None, None
- options = {'buildpath':buildpath,
+ signsfile, modulename = None, None
+ options = {'buildpath': buildpath,
'coutput': None,
'f2py_wrapper_output': None}
for l in inputline:
- if l=='': pass
- elif l=='only:': f=0
- elif l=='skip:': f=-1
- elif l==':': f=1;f4=0
- elif l[:8]=='--debug-': debug.append(l[8:])
- elif l=='--lower': dolc=1
- elif l=='--build-dir': f6=1
- elif l=='--no-lower': dolc=0
- elif l=='--quiet': verbose = 0
- elif l=='--verbose': verbose += 1
- elif l=='--latex-doc': dolatexdoc=1
- elif l=='--no-latex-doc': dolatexdoc=0
- elif l=='--rest-doc': dorestdoc=1
- elif l=='--no-rest-doc': dorestdoc=0
- elif l=='--wrap-functions': wrapfuncs=1
- elif l=='--no-wrap-functions': wrapfuncs=0
- elif l=='--short-latex': options['shortlatex']=1
- elif l=='--coutput': f8=1
- elif l=='--f2py-wrapper-output': f9=1
- elif l=='--overwrite-signature': options['h-overwrite']=1
- elif l=='-h': f2=1
- elif l=='-m': f3=1
- elif l[:2]=='-v':
+ if l == '':
+ pass
+ elif l == 'only:':
+ f = 0
+ elif l == 'skip:':
+ f = -1
+ elif l == ':':
+ f = 1
+ elif l[:8] == '--debug-':
+ debug.append(l[8:])
+ elif l == '--lower':
+ dolc = 1
+ elif l == '--build-dir':
+ f6 = 1
+ elif l == '--no-lower':
+ dolc = 0
+ elif l == '--quiet':
+ verbose = 0
+ elif l == '--verbose':
+ verbose += 1
+ elif l == '--latex-doc':
+ dolatexdoc = 1
+ elif l == '--no-latex-doc':
+ dolatexdoc = 0
+ elif l == '--rest-doc':
+ dorestdoc = 1
+ elif l == '--no-rest-doc':
+ dorestdoc = 0
+ elif l == '--wrap-functions':
+ wrapfuncs = 1
+ elif l == '--no-wrap-functions':
+ wrapfuncs = 0
+ elif l == '--short-latex':
+ options['shortlatex'] = 1
+ elif l == '--coutput':
+ f8 = 1
+ elif l == '--f2py-wrapper-output':
+ f9 = 1
+ elif l == '--overwrite-signature':
+ options['h-overwrite'] = 1
+ elif l == '-h':
+ f2 = 1
+ elif l == '-m':
+ f3 = 1
+ elif l[:2] == '-v':
print(f2py_version)
sys.exit()
- elif l=='--show-compilers':
- f5=1
- elif l[:8]=='-include':
+ elif l == '--show-compilers':
+ f5 = 1
+ elif l[:8] == '-include':
cfuncs.outneeds['userincludes'].append(l[9:-1])
- cfuncs.userincludes[l[9:-1]]='#include '+l[8:]
+ cfuncs.userincludes[l[9:-1]] = '#include ' + l[8:]
elif l[:15] in '--include_paths':
- outmess('f2py option --include_paths is deprecated, use --include-paths instead.\n')
- f7=1
+ outmess(
+ 'f2py option --include_paths is deprecated, use --include-paths instead.\n')
+ f7 = 1
elif l[:15] in '--include-paths':
- f7=1
- elif l[0]=='-':
- errmess('Unknown option %s\n'%repr(l))
+ f7 = 1
+ elif l[0] == '-':
+ errmess('Unknown option %s\n' % repr(l))
sys.exit()
- elif f2: f2=0;signsfile=l
- elif f3: f3=0;modulename=l
- elif f6: f6=0;buildpath=l
- elif f7: f7=0;include_paths.extend(l.split(os.pathsep))
- elif f8: f8=0;options["coutput"]=l
- elif f9: f9=0;options["f2py_wrapper_output"]=l
- elif f==1:
+ elif f2:
+ f2 = 0
+ signsfile = l
+ elif f3:
+ f3 = 0
+ modulename = l
+ elif f6:
+ f6 = 0
+ buildpath = l
+ elif f7:
+ f7 = 0
+ include_paths.extend(l.split(os.pathsep))
+ elif f8:
+ f8 = 0
+ options["coutput"] = l
+ elif f9:
+ f9 = 0
+ options["f2py_wrapper_output"] = l
+ elif f == 1:
try:
open(l).close()
files.append(l)
except IOError as detail:
- errmess('IOError: %s. Skipping file "%s".\n'%(str(detail), l))
- elif f==-1: skipfuncs.append(l)
- elif f==0: onlyfuncs.append(l)
+ errmess('IOError: %s. Skipping file "%s".\n' %
+ (str(detail), l))
+ elif f == -1:
+ skipfuncs.append(l)
+ elif f == 0:
+ onlyfuncs.append(l)
if not f5 and not files and not modulename:
print(__usage__)
sys.exit()
if not os.path.isdir(buildpath):
if not verbose:
- outmess('Creating build directory %s'%(buildpath))
+ outmess('Creating build directory %s' % (buildpath))
os.mkdir(buildpath)
if signsfile:
signsfile = os.path.join(buildpath, signsfile)
if signsfile and os.path.isfile(signsfile) and 'h-overwrite' not in options:
- errmess('Signature file "%s" exists!!! Use --overwrite-signature to overwrite.\n'%(signsfile))
+ errmess(
+ 'Signature file "%s" exists!!! Use --overwrite-signature to overwrite.\n' % (signsfile))
sys.exit()
- options['debug']=debug
- options['verbose']=verbose
- if dolc==-1 and not signsfile: options['do-lower']=0
- else: options['do-lower']=dolc
- if modulename: options['module']=modulename
- if signsfile: options['signsfile']=signsfile
- if onlyfuncs: options['onlyfuncs']=onlyfuncs
- if skipfuncs: options['skipfuncs']=skipfuncs
+ options['debug'] = debug
+ options['verbose'] = verbose
+ if dolc == -1 and not signsfile:
+ options['do-lower'] = 0
+ else:
+ options['do-lower'] = dolc
+ if modulename:
+ options['module'] = modulename
+ if signsfile:
+ options['signsfile'] = signsfile
+ if onlyfuncs:
+ options['onlyfuncs'] = onlyfuncs
+ if skipfuncs:
+ options['skipfuncs'] = skipfuncs
options['dolatexdoc'] = dolatexdoc
options['dorestdoc'] = dorestdoc
options['wrapfuncs'] = wrapfuncs
- options['buildpath']=buildpath
- options['include_paths']=include_paths
+ options['buildpath'] = buildpath
+ options['include_paths'] = include_paths
return files, options
+
def callcrackfortran(files, options):
- rules.options=options
- funcs=[]
- crackfortran.debug=options['debug']
- crackfortran.verbose=options['verbose']
+ rules.options = options
+ crackfortran.debug = options['debug']
+ crackfortran.verbose = options['verbose']
if 'module' in options:
- crackfortran.f77modulename=options['module']
+ crackfortran.f77modulename = options['module']
if 'skipfuncs' in options:
- crackfortran.skipfuncs=options['skipfuncs']
+ crackfortran.skipfuncs = options['skipfuncs']
if 'onlyfuncs' in options:
- crackfortran.onlyfuncs=options['onlyfuncs']
- crackfortran.include_paths[:]=options['include_paths']
- crackfortran.dolowercase=options['do-lower']
- postlist=crackfortran.crackfortran(files)
+ crackfortran.onlyfuncs = options['onlyfuncs']
+ crackfortran.include_paths[:] = options['include_paths']
+ crackfortran.dolowercase = options['do-lower']
+ postlist = crackfortran.crackfortran(files)
if 'signsfile' in options:
- outmess('Saving signatures to file "%s"\n'%(options['signsfile']))
- pyf=crackfortran.crack2fortran(postlist)
- if options['signsfile'][-6:]=='stdout':
+ outmess('Saving signatures to file "%s"\n' % (options['signsfile']))
+ pyf = crackfortran.crack2fortran(postlist)
+ if options['signsfile'][-6:] == 'stdout':
sys.stdout.write(pyf)
else:
- f=open(options['signsfile'], 'w')
+ f = open(options['signsfile'], 'w')
f.write(pyf)
f.close()
if options["coutput"] is None:
@@ -304,10 +350,11 @@ def callcrackfortran(files, options):
mod["f2py_wrapper_output"] = options["f2py_wrapper_output"]
return postlist
+
def buildmodules(lst):
cfuncs.buildcfuncs()
outmess('Building modules...\n')
- modules, mnames, isusedby=[], [], {}
+ modules, mnames, isusedby = [], [], {}
for i in range(len(lst)):
if '__user__' in lst[i]['name']:
cb_rules.buildcallbacks(lst[i])
@@ -315,26 +362,29 @@ def buildmodules(lst):
if 'use' in lst[i]:
for u in lst[i]['use'].keys():
if u not in isusedby:
- isusedby[u]=[]
+ isusedby[u] = []
isusedby[u].append(lst[i]['name'])
modules.append(lst[i])
mnames.append(lst[i]['name'])
ret = {}
for i in range(len(mnames)):
if mnames[i] in isusedby:
- outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i], ','.join(['"%s"'%s for s in isusedby[mnames[i]]])))
+ outmess('\tSkipping module "%s" which is used by %s.\n' % (
+ mnames[i], ','.join(['"%s"' % s for s in isusedby[mnames[i]]])))
else:
- um=[]
+ um = []
if 'use' in modules[i]:
for u in modules[i]['use'].keys():
if u in isusedby and u in mnames:
um.append(modules[mnames.index(u)])
else:
- outmess('\tModule "%s" uses nonexisting "%s" which will be ignored.\n'%(mnames[i], u))
+ outmess(
+ '\tModule "%s" uses nonexisting "%s" which will be ignored.\n' % (mnames[i], u))
ret[mnames[i]] = {}
dict_append(ret[mnames[i]], rules.buildmodule(modules[i], um))
return ret
+
def dict_append(d_out, d_in):
for (k, v) in d_in.items():
if k not in d_out:
@@ -344,68 +394,79 @@ def dict_append(d_out, d_in):
else:
d_out[k].append(v)
+
def run_main(comline_list):
"""Run f2py as if string.join(comline_list,' ') is used as a command line.
In case of using -h flag, return None.
"""
crackfortran.reset_global_f2py_vars()
- f2pydir=os.path.dirname(os.path.abspath(cfuncs.__file__))
+ f2pydir = os.path.dirname(os.path.abspath(cfuncs.__file__))
fobjhsrc = os.path.join(f2pydir, 'src', 'fortranobject.h')
fobjcsrc = os.path.join(f2pydir, 'src', 'fortranobject.c')
- files, options=scaninputline(comline_list)
- auxfuncs.options=options
- postlist=callcrackfortran(files, options)
- isusedby={}
+ files, options = scaninputline(comline_list)
+ auxfuncs.options = options
+ postlist = callcrackfortran(files, options)
+ isusedby = {}
for i in range(len(postlist)):
if 'use' in postlist[i]:
for u in postlist[i]['use'].keys():
if u not in isusedby:
- isusedby[u]=[]
+ isusedby[u] = []
isusedby[u].append(postlist[i]['name'])
for i in range(len(postlist)):
- if postlist[i]['block']=='python module' and '__user__' in postlist[i]['name']:
+ if postlist[i]['block'] == 'python module' and '__user__' in postlist[i]['name']:
if postlist[i]['name'] in isusedby:
- #if not quiet:
- outmess('Skipping Makefile build for module "%s" which is used by %s\n'%(postlist[i]['name'], ','.join(['"%s"'%s for s in isusedby[postlist[i]['name']]])))
+ # if not quiet:
+ outmess('Skipping Makefile build for module "%s" which is used by %s\n' % (
+ postlist[i]['name'], ','.join(['"%s"' % s for s in isusedby[postlist[i]['name']]])))
if 'signsfile' in options:
- if options['verbose']>1:
- outmess('Stopping. Edit the signature file and then run f2py on the signature file: ')
- outmess('%s %s\n'%(os.path.basename(sys.argv[0]), options['signsfile']))
+ if options['verbose'] > 1:
+ outmess(
+ 'Stopping. Edit the signature file and then run f2py on the signature file: ')
+ outmess('%s %s\n' %
+ (os.path.basename(sys.argv[0]), options['signsfile']))
return
for i in range(len(postlist)):
- if postlist[i]['block']!='python module':
+ if postlist[i]['block'] != 'python module':
if 'python module' not in options:
- errmess('Tip: If your original code is Fortran source then you must use -m option.\n')
- raise TypeError('All blocks must be python module blocks but got %s'%(repr(postlist[i]['block'])))
- auxfuncs.debugoptions=options['debug']
- f90mod_rules.options=options
- auxfuncs.wrapfuncs=options['wrapfuncs']
+ errmess(
+ 'Tip: If your original code is Fortran source then you must use -m option.\n')
+ raise TypeError('All blocks must be python module blocks but got %s' % (
+ repr(postlist[i]['block'])))
+ auxfuncs.debugoptions = options['debug']
+ f90mod_rules.options = options
+ auxfuncs.wrapfuncs = options['wrapfuncs']
- ret=buildmodules(postlist)
+ ret = buildmodules(postlist)
for mn in ret.keys():
- dict_append(ret[mn], {'csrc':fobjcsrc,'h':fobjhsrc})
+ dict_append(ret[mn], {'csrc': fobjcsrc, 'h': fobjhsrc})
return ret
-def filter_files(prefix,suffix,files,remove_prefix=None):
+
+def filter_files(prefix, suffix, files, remove_prefix=None):
"""
Filter files by prefix and suffix.
"""
filtered, rest = [], []
- match = re.compile(prefix+r'.*'+suffix+r'\Z').match
+ match = re.compile(prefix + r'.*' + suffix + r'\Z').match
if remove_prefix:
ind = len(prefix)
else:
ind = 0
for file in [x.strip() for x in files]:
- if match(file): filtered.append(file[ind:])
- else: rest.append(file)
+ if match(file):
+ filtered.append(file[ind:])
+ else:
+ rest.append(file)
return filtered, rest
+
def get_prefix(module):
p = os.path.dirname(os.path.dirname(module.__file__))
return p
+
def run_compile():
"""
Do it all in one call!
@@ -416,11 +477,13 @@ def run_compile():
del sys.argv[i]
remove_build_dir = 0
- try: i = sys.argv.index('--build-dir')
- except ValueError: i=None
+ try:
+ i = sys.argv.index('--build-dir')
+ except ValueError:
+ i = None
if i is not None:
- build_dir = sys.argv[i+1]
- del sys.argv[i+1]
+ build_dir = sys.argv[i + 1]
+ del sys.argv[i + 1]
del sys.argv[i]
else:
remove_build_dir = 1
@@ -432,7 +495,8 @@ def run_compile():
if sysinfo_flags:
sysinfo_flags = [f[7:] for f in sysinfo_flags]
- _reg2 = re.compile(r'[-][-]((no[-]|)(wrap[-]functions|lower)|debug[-]capi|quiet)|[-]include')
+ _reg2 = re.compile(
+ r'[-][-]((no[-]|)(wrap[-]functions|lower)|debug[-]capi|quiet)|[-]include')
f2py_flags = [_m for _m in sys.argv[1:] if _reg2.match(_m)]
sys.argv = [_m for _m in sys.argv if _m not in f2py_flags]
f2py_flags2 = []
@@ -440,19 +504,21 @@ def run_compile():
for a in sys.argv[1:]:
if a in ['only:', 'skip:']:
fl = 1
- elif a==':':
+ elif a == ':':
fl = 0
- if fl or a==':':
+ if fl or a == ':':
f2py_flags2.append(a)
- if f2py_flags2 and f2py_flags2[-1]!=':':
+ if f2py_flags2 and f2py_flags2[-1] != ':':
f2py_flags2.append(':')
f2py_flags.extend(f2py_flags2)
sys.argv = [_m for _m in sys.argv if _m not in f2py_flags2]
- _reg3 = re.compile(r'[-][-]((f(90)?compiler([-]exec|)|compiler)=|help[-]compiler)')
+ _reg3 = re.compile(
+ r'[-][-]((f(90)?compiler([-]exec|)|compiler)=|help[-]compiler)')
flib_flags = [_m for _m in sys.argv[1:] if _reg3.match(_m)]
sys.argv = [_m for _m in sys.argv if _m not in flib_flags]
- _reg4 = re.compile(r'[-][-]((f(77|90)(flags|exec)|opt|arch)=|(debug|noopt|noarch|help[-]fcompiler))')
+ _reg4 = re.compile(
+ r'[-][-]((f(77|90)(flags|exec)|opt|arch)=|(debug|noopt|noarch|help[-]fcompiler))')
fc_flags = [_m for _m in sys.argv[1:] if _reg4.match(_m)]
sys.argv = [_m for _m in sys.argv if _m not in fc_flags]
@@ -460,13 +526,13 @@ def run_compile():
del_list = []
for s in flib_flags:
v = '--fcompiler='
- if s[:len(v)]==v:
+ if s[:len(v)] == v:
from numpy.distutils import fcompiler
fcompiler.load_all_fcompiler_classes()
allowed_keys = list(fcompiler.fcompiler_class.keys())
nv = ov = s[len(v):].lower()
if ov not in allowed_keys:
- vmap = {} # XXX
+ vmap = {} # XXX
try:
nv = vmap[ov]
except KeyError:
@@ -479,7 +545,7 @@ def run_compile():
for s in del_list:
i = flib_flags.index(s)
del flib_flags[i]
- assert len(flib_flags)<=2, repr(flib_flags)
+ assert len(flib_flags) <= 2, repr(flib_flags)
_reg5 = re.compile(r'[-][-](verbose)')
setup_flags = [_m for _m in sys.argv[1:] if _reg5.match(_m)]
@@ -493,15 +559,15 @@ def run_compile():
for optname in ['--include_paths', '--include-paths']:
if optname in sys.argv:
- i = sys.argv.index (optname)
- f2py_flags.extend (sys.argv[i:i+2])
- del sys.argv[i+1], sys.argv[i]
+ i = sys.argv.index(optname)
+ f2py_flags.extend(sys.argv[i:i + 2])
+ del sys.argv[i + 1], sys.argv[i]
sources = sys.argv[1:]
if '-m' in sys.argv:
i = sys.argv.index('-m')
- modulename = sys.argv[i+1]
- del sys.argv[i+1], sys.argv[i]
+ modulename = sys.argv[i + 1]
+ del sys.argv[i + 1], sys.argv[i]
sources = sys.argv[1:]
else:
from numpy.distutils.command.build_src import get_f2py_modulename
@@ -518,27 +584,18 @@ def run_compile():
libraries, sources = filter_files('-l', '', sources, remove_prefix=1)
undef_macros, sources = filter_files('-U', '', sources, remove_prefix=1)
define_macros, sources = filter_files('-D', '', sources, remove_prefix=1)
- using_numarray = 0
- using_numeric = 0
for i in range(len(define_macros)):
name_value = define_macros[i].split('=', 1)
- if len(name_value)==1:
+ if len(name_value) == 1:
name_value.append(None)
- if len(name_value)==2:
+ if len(name_value) == 2:
define_macros[i] = tuple(name_value)
else:
print('Invalid use of -D:', name_value)
from numpy.distutils.system_info import get_info
- num_include_dir = None
num_info = {}
- #import numpy
- #n = 'numpy'
- #p = get_prefix(numpy)
- #from numpy.distutils.misc_util import get_numpy_include_dirs
- #num_info = {'include_dirs': get_numpy_include_dirs()}
-
if num_info:
include_dirs.extend(num_info.get('include_dirs', []))
@@ -558,9 +615,9 @@ def run_compile():
for n in sysinfo_flags:
i = get_info(n)
if not i:
- outmess('No %s resources found in system'\
+ outmess('No %s resources found in system'
' (try `f2py --help-link`)\n' % (repr(n)))
- dict_append(ext_args,**i)
+ dict_append(ext_args, **i)
ext = Extension(**ext_args)
sys.argv = [sys.argv[0]] + setup_flags
@@ -569,17 +626,18 @@ def run_compile():
'--build-base', build_dir,
'--build-platlib', '.'])
if fc_flags:
- sys.argv.extend(['config_fc']+fc_flags)
+ sys.argv.extend(['config_fc'] + fc_flags)
if flib_flags:
- sys.argv.extend(['build_ext']+flib_flags)
+ sys.argv.extend(['build_ext'] + flib_flags)
- setup(ext_modules = [ext])
+ setup(ext_modules=[ext])
if remove_build_dir and os.path.exists(build_dir):
import shutil
- outmess('Removing build directory %s\n'%(build_dir))
+ outmess('Removing build directory %s\n' % (build_dir))
shutil.rmtree(build_dir)
+
def main():
if '--help-link' in sys.argv[1:]:
sys.argv.remove('--help-link')
@@ -591,7 +649,7 @@ def main():
else:
run_main(sys.argv[1:])
-#if __name__ == "__main__":
+# if __name__ == "__main__":
# main()
diff --git a/numpy/f2py/f90mod_rules.py b/numpy/f2py/f90mod_rules.py
index 758cad58a..21e1bd4a9 100644
--- a/numpy/f2py/f90mod_rules.py
+++ b/numpy/f2py/f90mod_rules.py
@@ -19,14 +19,13 @@ __version__ = "$Revision: 1.27 $"[10:-1]
f2py_version='See `f2py -v`'
-import pprint
-import sys
-errmess=sys.stderr.write
-outmess=sys.stdout.write
-show=pprint.pprint
-
-from .auxfuncs import *
import numpy as np
+
+from .auxfuncs import (
+ applyrules, dictappend, hasbody,hasnote, isallocatable, isfunction,
+ isintent_hide, ismodule, isprivate, isroutine,isstringarray, l_or,
+ outmess
+)
from . import capi_maps
from . import func2subr
from .crackfortran import undo_rmbadname, undo_rmbadname1
diff --git a/numpy/f2py/func2subr.py b/numpy/f2py/func2subr.py
index 22f60851d..39410feef 100644
--- a/numpy/f2py/func2subr.py
+++ b/numpy/f2py/func2subr.py
@@ -17,16 +17,17 @@ from __future__ import division, absolute_import, print_function
__version__ = "$Revision: 1.16 $"[10:-1]
-f2py_version='See `f2py -v`'
+f2py_version = 'See `f2py -v`'
-import pprint
import copy
-import sys
-errmess=sys.stderr.write
-outmess=sys.stdout.write
-show=pprint.pprint
-from .auxfuncs import *
+from .auxfuncs import (
+ getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in,
+ isintent_out, islogicalfunction,ismoduleroutine, isscalar,
+ issubroutine, issubroutine_wrap, outmess, show
+)
+
+
def var2fixfortran(vars,a,fa=None,f90mode=None):
if fa is None:
fa = a
@@ -108,9 +109,7 @@ def createfuncwrapper(rout,signature=0):
args = [newname]+rout['args']
l = var2fixfortran(vars, name, newname, f90mode)
- return_char_star = 0
if l[:13]=='character*(*)':
- return_char_star = 1
if f90mode: l = 'character(len=10)'+l[13:]
else: l = 'character*10'+l[13:]
charselect = vars[name]['charselector']
diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py
index 52679966b..fb76e032a 100644
--- a/numpy/f2py/rules.py
+++ b/numpy/f2py/rules.py
@@ -57,24 +57,34 @@ __version__ = "$Revision: 1.129 $"[10:-1]
from . import __version__
f2py_version = __version__.version
-import pprint
-import sys
+import os
import time
import copy
-from .auxfuncs import *
+from .auxfuncs import (
+ applyrules, debugcapi, dictappend, errmess, gentitle, getargs2,
+ hascallstatement, hasexternals, hasinitvalue, hasnote, hasresultnote,
+ isarray, isarrayofstrings, iscomplex, iscomplexarray,
+ iscomplexfunction, iscomplexfunction_warn, isdummyroutine, isexternal,
+ isfunction, isfunction_wrap, isint1array, isintent_aux, isintent_c,
+ isintent_callback, isintent_copy, isintent_hide, isintent_inout,
+ isintent_nothide, isintent_out, isintent_overwrite, islogical,
+ islong_complex, islong_double, islong_doublefunction, islong_long,
+ islong_longfunction, ismoduleroutine, isoptional, isrequired, isscalar,
+ issigned_long_longarray, isstring, isstringarray, isstringfunction,
+ issubroutine, issubroutine_wrap, isthreadsafe, isunsigned,
+ isunsigned_char, isunsigned_chararray, isunsigned_long_long,
+ isunsigned_long_longarray, isunsigned_short, isunsigned_shortarray,
+ l_and, l_not, l_or, outmess, replace, stripcomma,
+)
+
from . import capi_maps
-from .capi_maps import *
from . import cfuncs
from . import common_rules
from . import use_rules
from . import f90mod_rules
from . import func2subr
-errmess = sys.stderr.write
-outmess = sys.stdout.write
-show = pprint.pprint
-
options={}
sepdict={}
#for k in ['need_cfuncs']: sepdict[k]=','
@@ -1165,7 +1175,7 @@ def buildmodule(m, um):
outmess('\tBuilding module "%s"...\n'%(m['name']))
ret = {}
mod_rules=defmod_rules[:]
- vrd=modsign2map(m)
+ vrd = capi_maps.modsign2map(m)
rd=dictappend({'f2py_version':f2py_version}, vrd)
funcwrappers = []
funcwrappers2 = [] # F90 codes
@@ -1330,14 +1340,14 @@ def buildapi(rout):
args, depargs=getargs2(rout)
capi_maps.depargs=depargs
var=rout['vars']
- auxvars = [a for a in var.keys() if isintent_aux(var[a])]
+ # auxvars = [a for a in var.keys() if isintent_aux(var[a])]
if ismoduleroutine(rout):
outmess('\t\t\tConstructing wrapper function "%s.%s"...\n'%(rout['modulename'], rout['name']))
else:
outmess('\t\tConstructing wrapper function "%s"...\n'%(rout['name']))
# Routine
- vrd=routsign2map(rout)
+ vrd = capi_maps.routsign2map(rout)
rd=dictappend({}, vrd)
for r in rout_rules:
if ('_check' in r and r['_check'](rout)) or ('_check' not in r):
@@ -1348,7 +1358,7 @@ def buildapi(rout):
nth, nthk=0, 0
savevrd={}
for a in args:
- vrd=sign2map(a, var[a])
+ vrd=capi_maps.sign2map(a, var[a])
if isintent_aux(var[a]):
_rules = aux_rules
else:
diff --git a/numpy/f2py/use_rules.py b/numpy/f2py/use_rules.py
index 6fd72bd77..8c87de745 100644
--- a/numpy/f2py/use_rules.py
+++ b/numpy/f2py/use_rules.py
@@ -21,14 +21,11 @@ __version__ = "$Revision: 1.3 $"[10:-1]
f2py_version='See `f2py -v`'
-import pprint
-import sys
-errmess=sys.stderr.write
-outmess=sys.stdout.write
-show=pprint.pprint
-from .auxfuncs import *
-##############
+from .auxfuncs import (
+ applyrules,dictappend, gentitle, hasnote, outmess
+)
+
usemodule_rules={
'body':"""
@@ -100,10 +97,10 @@ def buildusevar(name, realname, vars, usemodulename):
vrd['texnamename']=name
for i in nummap.keys():
vrd['texnamename']=vrd['texnamename'].replace(repr(i), nummap[i])
- if hasnote(vars[realname]): vrd['note']=vars[realname]['note']
- rd=dictappend({}, vrd)
- var=vars[realname]
+ if hasnote(vars[realname]):
+ vrd['note']=vars[realname]['note']
+ rd = dictappend({}, vrd)
print(name, realname, vars[realname])
- ret=applyrules(usemodule_rules, rd)
+ ret = applyrules(usemodule_rules, rd)
return ret