Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit 8f93831

Browse files
committed
rename annotation to signature
1 parent c6e67f6 commit 8f93831

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

numba_typing/tests/test_type_annotations.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ def test_add_vals_to_signature(self):
108108
{'a': Dict[str, str], 'b': int}]
109109
vals = {'a': {'name': 3}, 'b': 3}
110110

111-
Annotations = namedtuple('Annotations', ['parameters', 'defaults'])
112-
113-
expected = Annotations(parameters=[{'a': Dict[float, int], 'b': int},
111+
expected = type_annotations.Signature(parameters=[{'a': Dict[float, int], 'b': int},
114112
{'a': Dict[str, int], 'b': int},
115113
{'a': Dict[float, str], 'b': int},
116114
{'a': Dict[str, str], 'b': int}],
@@ -179,9 +177,7 @@ def test_product_annotations(self):
179177
annotations = ({'a': [T], 'b': [Dict[T, S]],
180178
'c': [T, bool], 'd': [int]}, {'d': 3})
181179

182-
Annotations = namedtuple('Annotations', ['parameters', 'defaults'])
183-
184-
expected = Annotations(parameters=[{'a': int, 'b': Dict[int, float], 'c': int, 'd': int},
180+
expected = type_annotations.Signature(parameters=[{'a': int, 'b': Dict[int, float], 'c': int, 'd': int},
185181
{'a': str, 'b': Dict[str, float], 'c': str, 'd': int},
186182
{'a': int, 'b': Dict[int, bool], 'c': int, 'd': int},
187183
{'a': str, 'b': Dict[str, bool], 'c': str, 'd': int},

numba_typing/type_annotations.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from copy import deepcopy
55
from collections import namedtuple
66

7+
Signature = namedtuple('Signature', ['parameters', 'defaults'])
78

89
def get_func_annotations(func):
910
"""Get annotations and default values of the fuction parameters."""
@@ -53,12 +54,10 @@ def product_annotations(annotations):
5354
return add_vals_to_signature(signature, vals)
5455

5556

56-
def add_vals_to_signature(signature, vals):
57+
def add_vals_to_signature(sign, vals):
5758
'''Add default values ​​to all signatures'''
58-
Annotations = namedtuple('Annotations', ['parameters', 'defaults'])
59-
annotations = Annotations(signature, vals)
60-
61-
return annotations
59+
signature = Signature(sign, vals)
60+
return signature
6261

6362

6463
def convert_to_sig_list(types):

0 commit comments

Comments
 (0)