diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-04-17 23:12:36 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-02-02 01:10:29 -0800 |
commit | e3c74333eaf51bf8002d5bccfc97bd3fe8863e5c (patch) | |
tree | a4afe53921d3af2b641a357354c46265e9a87a4c | |
parent | f0f12f4419194867cc1d89ebf5c978ec62637c6a (diff) | |
download | numpy-e3c74333eaf51bf8002d5bccfc97bd3fe8863e5c.tar.gz |
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) |