summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2020-10-29 10:11:06 +0000
committerEric Wieser <wieser.eric@gmail.com>2020-10-29 10:11:06 +0000
commit48a9a519cc7a4d52ff85577efee0048350d07254 (patch)
treef92b16ae72a142e8f3fd5d3fb0d696afcfc07708 /numpy/f2py
parentff26a55e7855f24f065714253fdc5de1c0df9eab (diff)
downloadnumpy-48a9a519cc7a4d52ff85577efee0048350d07254.tar.gz
DOC: f2py: Add a docstring for getarrlen
The API of this function is awful, and I still have no idea what it does. Maybe someone reading the docstring will be able to work it out.
Diffstat (limited to 'numpy/f2py')
-rwxr-xr-xnumpy/f2py/crackfortran.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py
index 1fe2ca037..2e95e4596 100755
--- a/numpy/f2py/crackfortran.py
+++ b/numpy/f2py/crackfortran.py
@@ -2187,6 +2187,37 @@ _varname_match = re.compile(r'\A[a-z]\w*\Z').match
def getarrlen(dl, args, star='*'):
+ """
+ Parameters
+ ----------
+ dl : sequence of two str objects
+ dimensions of the array
+ args : Iterable[str]
+ symbols used in the expression
+ star : Any
+ unused
+
+ Returns
+ -------
+ expr : str
+ Some numeric expression as a string
+ arg : Optional[str]
+ If understood, the argument from `args` present in `expr`
+ expr2 : Optional[str]
+ If understood, an expression fragment that should be used as
+ ``"(%s%s".format(something, expr2)``.
+
+ Examples
+ --------
+ >>> getarrlen(['10*x + 20', '40*x'], {'x'})
+ ('30 * x - 19', 'x', '+19)/(30)')
+ >>> getarrlen(['1', '10*x + 20'], {'x'})
+ ('10 * x + 20', 'x', '-20)/(10)')
+ >>> getarrlen(['10*x + 20', '1'], {'x'})
+ ('-10 * x - 18', 'x', '+18)/(-10)')
+ >>> getarrlen(['20', '1'], {'x'})
+ ('-18', None, None)
+ """
edl = []
try:
edl.append(myeval(dl[0], {}, {}))