diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-02-03 10:17:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-03 10:17:48 -0700 |
commit | 2854d508d1c6d211f2ce99e8747eda1cb427a78a (patch) | |
tree | 358888f269b4a2861f3690bbdbd955a73b8704eb | |
parent | d1c66d0bb940025df384fca761f670112afe21af (diff) | |
parent | e3c74333eaf51bf8002d5bccfc97bd3fe8863e5c (diff) | |
download | numpy-2854d508d1c6d211f2ce99e8747eda1cb427a78a.tar.gz |
Merge pull request #10509 from eric-wieser/generate_umath-format-string
MAINT: Use new-style format strings for clarity
-rw-r--r-- | numpy/core/code_generators/generate_umath.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py index f9bf823c2..f418e4b47 100644 --- a/numpy/core/code_generators/generate_umath.py +++ b/numpy/core/code_generators/generate_umath.py @@ -1040,14 +1040,16 @@ def make_ufuncs(funcdict): # string literal in C code. We split at endlines because textwrap.wrap # do not play well with \n docstring = '\\n\"\"'.join(docstring.split(r"\n")) - mlist.append(textwrap.dedent("""\ - f = PyUFunc_FromFuncAndData(%s_functions, %s_data, %s_signatures, %d, - %d, %d, %s, "%s", - "%s", 0);""") % (name, name, name, - len(uf.type_descriptions), - uf.nin, uf.nout, - uf.identity, - name, docstring)) + fmt = textwrap.dedent("""\ + f = PyUFunc_FromFuncAndData( + {name}_functions, {name}_data, {name}_signatures, {nloops}, + {nin}, {nout}, {identity}, "{name}", + "{doc}", 0 + );""") + mlist.append(fmt.format( + name=name, nloops=len(uf.type_descriptions), + nin=uf.nin, nout=uf.nout, identity=uf.identity, doc=docstring + )) if uf.typereso is not None: mlist.append( r"((PyUFuncObject *)f)->type_resolver = &%s;" % uf.typereso) |