Skip to content

Commit 1372d26

Browse files
authored
Merge pull request numpy#19775 from HaoZeke/minor_typos_dated
MAINT,DOC: Readability improvements and cleanup for f2py
2 parents 66d33fa + d313d81 commit 1372d26

File tree

14 files changed

+27
-381
lines changed

14 files changed

+27
-381
lines changed

doc/source/f2py/distutils.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ Extensions to ``distutils``
6666
* When building Python packages containing Fortran sources, one
6767
can choose different Fortran compilers by using the ``build_ext``
6868
command option ``--fcompiler=<Vendor>``. Here ``<Vendor>`` can be one of the
69-
following names::
69+
following names (on ``linux`` systems)::
7070

71-
absoft sun mips intel intelv intele intelev nag compaq compaqv gnu vast pg hpux
71+
absoft compaq fujitsu g95 gnu gnu95 intel intele intelem lahey nag nagfor nv pathf95 pg vast
7272

7373
See ``numpy_distutils/fcompiler.py`` for an up-to-date list of
74-
supported compilers or run
74+
supported compilers for different platforms, or run
7575

7676
::
7777

numpy/f2py/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# See http://cens.ioc.ee/projects/f2py2e/
1+
# See:
2+
# https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e
23
from numpy.f2py.f2py2e import main
34

45
main()

numpy/f2py/auxfuncs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,9 @@ def iscomplexfunction_warn(rout):
347347
**************************************************************
348348
Warning: code with a function returning complex value
349349
may not work correctly with your Fortran compiler.
350-
Run the following test before using it in your applications:
351-
$(f2py install dir)/test-site/{b/runme_scalar,e/runme}
352-
When using GNU gcc/g77 compilers, codes should work correctly.
350+
When using GNU gcc/g77 compilers, codes should work
351+
correctly for callbacks with:
352+
f2py -c -DF2PY_CB_RETURNCOMPLEX
353353
**************************************************************\n""")
354354
return 1
355355
return 0

numpy/f2py/capi_maps.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
'unsigned_char': 'int', # forced casting
4949
'short': 'int', # forced casting
5050
'unsigned_short': 'int', # forced casting
51-
'int': 'int', # (forced casting)
51+
'int': 'int', # forced casting
5252
'long': 'int',
5353
'long_long': 'long',
5454
'unsigned': 'int', # forced casting
@@ -95,8 +95,8 @@
9595
'complex_double': 'NPY_CDOUBLE',
9696
'complex_long_double': 'NPY_CDOUBLE',
9797
'string':'NPY_STRING'
98-
9998
}
99+
100100
c2pycode_map = {'double': 'd',
101101
'float': 'f',
102102
'long_double': 'd', # forced casting
@@ -114,6 +114,7 @@
114114
'complex_long_double': 'D', # forced casting
115115
'string': 'c'
116116
}
117+
117118
if using_newcore:
118119
c2pycode_map = {'double': 'd',
119120
'float': 'f',
@@ -133,6 +134,7 @@
133134
'complex_double': 'D',
134135
'complex_long_double': 'G',
135136
'string': 'S'}
137+
136138
c2buildvalue_map = {'double': 'd',
137139
'float': 'f',
138140
'char': 'b',
@@ -146,10 +148,6 @@
146148
'complex_long_double': 'N',
147149
'string': 'y'}
148150

149-
if using_newcore:
150-
# c2buildvalue_map=???
151-
pass
152-
153151
f2cmap_all = {'real': {'': 'float', '4': 'float', '8': 'double',
154152
'12': 'long_double', '16': 'long_double'},
155153
'integer': {'': 'int', '1': 'signed_char', '2': 'short',
@@ -185,22 +183,22 @@ def load_f2cmap_file(f2cmap_file):
185183
return
186184

187185
# User defined additions to f2cmap_all.
188-
# f2cmap_file must contain a dictionary of dictionaries, only. For
186+
# f2cmap_file must contain a dictionary of dictionaries, only. For
189187
# example, {'real':{'low':'float'}} means that Fortran 'real(low)' is
190-
# interpreted as C 'float'. This feature is useful for F90/95 users if
191-
# they use PARAMETERSs in type specifications.
188+
# interpreted as C 'float'. This feature is useful for F90/95 users if
189+
# they use PARAMETERS in type specifications.
192190
try:
193191
outmess('Reading f2cmap from {!r} ...\n'.format(f2cmap_file))
194192
with open(f2cmap_file, 'r') as f:
195193
d = eval(f.read(), {}, {})
196-
for k, d1 in list(d.items()):
197-
for k1 in list(d1.keys()):
194+
for k, d1 in d.items():
195+
for k1 in d1.keys():
198196
d1[k1.lower()] = d1[k1]
199197
d[k.lower()] = d[k]
200-
for k in list(d.keys()):
198+
for k in d.keys():
201199
if k not in f2cmap_all:
202200
f2cmap_all[k] = {}
203-
for k1 in list(d[k].keys()):
201+
for k1 in d[k].keys():
204202
if d[k][k1] in c2py_map:
205203
if k1 in f2cmap_all[k]:
206204
outmess(
@@ -279,11 +277,9 @@ def getctype(var):
279277
errmess('getctype: "%s(kind=%s)" is mapped to C "%s" (to override define dict(%s = dict(%s="<C typespec>")) in %s/.f2py_f2cmap file).\n'
280278
% (typespec, var['kindselector']['kind'], ctype,
281279
typespec, var['kindselector']['kind'], os.getcwd()))
282-
283280
else:
284281
if not isexternal(var):
285-
errmess(
286-
'getctype: No C-type found in "%s", assuming void.\n' % var)
282+
errmess('getctype: No C-type found in "%s", assuming void.\n' % var)
287283
return ctype
288284

289285

@@ -523,7 +519,7 @@ def sign2map(a, var):
523519
if f(var):
524520
intent_flags.append('F2PY_%s' % s)
525521
if intent_flags:
526-
# XXX: Evaluate intent_flags here.
522+
# TODO: Evaluate intent_flags here.
527523
ret['intent'] = '|'.join(intent_flags)
528524
else:
529525
ret['intent'] = 'F2PY_INTENT_IN'

numpy/f2py/crackfortran.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ def outmess(line, flag=1):
245245
defaultimplicitrules[c] = {'typespec': 'real'}
246246
for c in "ijklmn":
247247
defaultimplicitrules[c] = {'typespec': 'integer'}
248-
del c
249248
badnames = {}
250249
invbadnames = {}
251250
for n in ['int', 'double', 'float', 'char', 'short', 'long', 'void', 'case', 'while',
@@ -3357,7 +3356,8 @@ def crack2fortran(block):
33573356
"""
33583357
footer = """
33593358
! This file was auto-generated with f2py (version:%s).
3360-
! See http://cens.ioc.ee/projects/f2py2e/
3359+
! See:
3360+
! https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e
33613361
""" % (f2py_version)
33623362
return header + pyf + footer
33633363

numpy/f2py/f2py2e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
Requires: Python 3.5 or higher.
169169
License: NumPy license (see LICENSE.txt in the NumPy source code)
170170
Copyright 1999 - 2011 Pearu Peterson all rights reserved.
171-
http://cens.ioc.ee/projects/f2py2e/"""
171+
https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e"""
172172

173173

174174
def scaninputline(inputline):

numpy/f2py/setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ def configuration(parent_package='', top_path=None):
3939
config = configuration(top_path='')
4040
config = config.todict()
4141

42-
config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\
43-
"/F2PY-2-latest.tar.gz"
4442
config['classifiers'] = [
4543
'Development Status :: 5 - Production/Stable',
4644
'Intended Audience :: Developers',
@@ -68,6 +66,7 @@ def configuration(parent_package='', top_path=None):
6866
wrapping Fortran 77/90/95 subroutines, accessing common blocks from
6967
Python, and calling Python functions from Fortran (call-backs).
7068
Interfacing subroutines/data from Fortran 90/95 modules is supported.""",
71-
url="http://cens.ioc.ee/projects/f2py2e/",
69+
url="https://web.archive.org/web/20140822061353/"\
70+
"http://cens.ioc.ee/projects/f2py2e/",
7271
keywords=['Fortran', 'f2py'],
7372
**config)

numpy/f2py/src/test/Makefile

Lines changed: 0 additions & 96 deletions
This file was deleted.

numpy/f2py/src/test/bar.f

Lines changed: 0 additions & 11 deletions
This file was deleted.

numpy/f2py/src/test/foo.f

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)