diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-04-26 12:27:09 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-05-01 15:39:41 +0200 |
commit | 64af3fdd0fac08e01877a56faff5f3c6d4ac3a1b (patch) | |
tree | 413c414b7ee69a3b52bfd70fc9ed9e40cc0779b0 | |
parent | 1eb08d5a99b815dc97e1fa5b42665d8a78202202 (diff) | |
download | numpy-64af3fdd0fac08e01877a56faff5f3c6d4ac3a1b.tar.gz |
MAINT: replace multiarray_global_vars_types by using tuples
-rw-r--r-- | numpy/core/code_generators/genapi.py | 4 | ||||
-rw-r--r-- | numpy/core/code_generators/generate_numpy_api.py | 13 | ||||
-rw-r--r-- | numpy/core/code_generators/numpy_api.py | 13 |
3 files changed, 11 insertions, 19 deletions
diff --git a/numpy/core/code_generators/genapi.py b/numpy/core/code_generators/genapi.py index b5e5246df..c73209d04 100644 --- a/numpy/core/code_generators/genapi.py +++ b/numpy/core/code_generators/genapi.py @@ -447,9 +447,7 @@ Same index has been used twice in api definition: %s raise ValueError(msg) # No 'hole' in the indexes may be allowed, and it must starts at 0 - indexes = set() - for v in d.values(): - indexes.add(v[0]) + indexes = set(v[0] for v in d.values()) expected = set(range(len(indexes))) if not indexes == expected: diff = expected.symmetric_difference(indexes) diff --git a/numpy/core/code_generators/generate_numpy_api.py b/numpy/core/code_generators/generate_numpy_api.py index 993049b44..a590cfb48 100644 --- a/numpy/core/code_generators/generate_numpy_api.py +++ b/numpy/core/code_generators/generate_numpy_api.py @@ -183,13 +183,11 @@ def do_generate_api(targets, sources): doc_file = targets[2] global_vars = sources[0] - global_vars_types = sources[1] - scalar_bool_values = sources[2] - types_api = sources[3] - multiarray_funcs = sources[4] + scalar_bool_values = sources[1] + types_api = sources[2] + multiarray_funcs = sources[3] - # Remove global_vars_type: not a api dict - multiarray_api = sources[:1] + sources[2:] + multiarray_api = sources[:] module_list = [] extension_list = [] @@ -215,8 +213,7 @@ def do_generate_api(targets, sources): f.args, api_name) for name, val in global_vars.items(): - type = global_vars_types[name][0] - index = val[0] + index, type = val multiarray_api_dict[name] = GlobalVarApi(name, index, type, api_name) for name, val in scalar_bool_values.items(): diff --git a/numpy/core/code_generators/numpy_api.py b/numpy/core/code_generators/numpy_api.py index 47691201d..cd6d2f176 100644 --- a/numpy/core/code_generators/numpy_api.py +++ b/numpy/core/code_generators/numpy_api.py @@ -16,20 +16,18 @@ from __future__ import division, absolute_import, print_function from code_generators.genapi import StealRef, NonNull +# index, type multiarray_global_vars = { - 'NPY_NUMUSERTYPES': (7,), - 'NPY_DEFAULT_ASSIGN_CASTING': (292,), -} - -multiarray_global_vars_types = { - 'NPY_NUMUSERTYPES': ('int',), - 'NPY_DEFAULT_ASSIGN_CASTING': ('NPY_CASTING',), + 'NPY_NUMUSERTYPES': (7, 'int'), + 'NPY_DEFAULT_ASSIGN_CASTING': (292, 'NPY_CASTING'), } multiarray_scalar_bool_values = { '_PyArrayScalar_BoolValues': (9,) } +# index, annotations +# please mark functions that have been checked to not need any annotations multiarray_types_api = { 'PyBigArray_Type': (1,), 'PyArray_Type': (2,), @@ -401,7 +399,6 @@ ufunc_funcs_api = { # XXX: DO NOT CHANGE THE ORDER OF TUPLES BELOW ! multiarray_api = ( multiarray_global_vars, - multiarray_global_vars_types, multiarray_scalar_bool_values, multiarray_types_api, multiarray_funcs_api, |