MCPcopy Create free account
hub / github.com/numpy/numpy / load_f2cmap_file

Function load_f2cmap_file

numpy/f2py/capi_maps.py:138–161  ·  view source on GitHub ↗
(f2cmap_file)

Source from the content-addressed store, hash-verified

136f2cmap_mapped = []
137
138def load_f2cmap_file(f2cmap_file):
139 global f2cmap_all, f2cmap_mapped
140
141 f2cmap_all = copy.deepcopy(f2cmap_default)
142
143 if f2cmap_file is None:
144 # Default value
145 f2cmap_file = '.f2py_f2cmap'
146 if not os.path.isfile(f2cmap_file):
147 return
148
149 # User defined additions to f2cmap_all.
150 # f2cmap_file must contain a dictionary of dictionaries, only. For
151 # example, {'real':{'low':'float'}} means that Fortran 'real(low)' is
152 # interpreted as C 'float'. This feature is useful for F90/95 users if
153 # they use PARAMETERS in type specifications.
154 try:
155 outmess('Reading f2cmap from {!r} ...\n'.format(f2cmap_file))
156 with open(f2cmap_file) as f:
157 d = eval(f.read().lower(), {}, {})
158 f2cmap_all, f2cmap_mapped = process_f2cmap_dict(f2cmap_all, d, c2py_map, True)
159 outmess('Successfully applied user defined f2cmap changes\n')
160 except Exception as msg:
161 errmess('Failed to apply user defined f2cmap changes: %s. Skipping.\n' % (msg))
162
163
164cformat_map = {'double': '%g',

Callers

nothing calls this directly

Calls 5

openFunction · 0.85
process_f2cmap_dictFunction · 0.85
lowerMethod · 0.80
outmessFunction · 0.70
readMethod · 0.45

Tested by

no test coverage detected