Skip to content

Commit 69f02a3

Browse files
authored
enum updates as per AzDo for nirfsg and nifake (#2129)
* Matching the Azdo generated metadata for nifake * Updated metadata from AzDo * Revert "Updated metadata from AzDo" This reverts commit 1af4ab6. * Files generated from nirfsg AzDo exports * Matching the NiRFSG Metadata * making changes specific to enum * Updated Enum related changes
1 parent 4b9434f commit 69f02a3

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

build/templates/enums.py.mako

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ config = template_parameters['metadata'].config
66
enums = config['enums']
77
%>
88
from enum import Enum
9-
% if any(enums[e].get('enum_class', 'Enum') == 'IntFlag' for e in enums):
9+
% if any(enums[e].get('class', 'Enum') == 'IntFlag' for e in enums):
1010
from enum import IntFlag
1111
% endif
1212
% for enum_name in sorted(helper.filter_codegen_enums(enums)):
1313

1414

15-
class ${enums[enum_name]['python_name']}(${enums[enum_name].get('enum_class', 'Enum')}):
15+
class ${enums[enum_name]['python_name']}(${enums[enum_name].get('class', 'Enum')}):
1616
<%
1717
print_list = []
1818
%>\

generated/nifake/nifake/enums.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ class IntFlagEnum(IntFlag):
6363
r'''
6464
Flag B option.
6565
'''
66-
C = 9223372036854775808
66+
E = 1073741824
6767
r'''
68-
Flag C option.
68+
Flag E option.
6969
'''
7070

7171

generated/nifake/nifake/unit_tests/test_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,12 +839,12 @@ def test_return_timedeltas(self):
839839
self.patched_library_interpreter.return_list_of_durations_in_seconds.assert_called_once_with(len(time_values))
840840

841841
def test_with_valid_intflag_parameter(self):
842-
flags = nifake.IntFlagEnum.C | nifake.IntFlagEnum.A
842+
flags = nifake.IntFlagEnum.E | nifake.IntFlagEnum.A
843843
self.patched_library_interpreter.function_with_intflag_parameter.side_effect = None
844844
self.patched_library_interpreter.function_with_intflag_parameter.return_value = None
845845
with nifake.Session('dev1') as session:
846846
session.function_with_intflag_parameter(flags)
847-
self.patched_library_interpreter.function_with_intflag_parameter.assert_called_once_with(9223372036854775809)
847+
self.patched_library_interpreter.function_with_intflag_parameter.assert_called_once_with(1073741825)
848848

849849
def test_with_intflag_parameter_invalid(self):
850850
invalid_flag = 5

src/nifake/metadata/enums.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@
240240
]
241241
},
242242
'IntFlagEnum': {
243+
'class': 'IntFlag',
243244
'codegen_method': 'public',
244-
'enum_class': 'IntFlag',
245245
'values': [
246246
{
247247
'documentation': {
@@ -259,10 +259,10 @@
259259
},
260260
{
261261
'documentation': {
262-
'description': 'Flag C option.'
262+
'description': 'Flag E option.'
263263
},
264-
'name': 'NIFAKE_VAL_FLAG_C',
265-
'value': 9223372036854775808
264+
'name': 'NIFAKE_VAL_FLAG_E',
265+
'value': 1073741824
266266
}
267267
]
268268
},

src/nifake/unit_tests/test_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,12 +839,12 @@ def test_return_timedeltas(self):
839839
self.patched_library_interpreter.return_list_of_durations_in_seconds.assert_called_once_with(len(time_values))
840840

841841
def test_with_valid_intflag_parameter(self):
842-
flags = nifake.IntFlagEnum.C | nifake.IntFlagEnum.A
842+
flags = nifake.IntFlagEnum.E | nifake.IntFlagEnum.A
843843
self.patched_library_interpreter.function_with_intflag_parameter.side_effect = None
844844
self.patched_library_interpreter.function_with_intflag_parameter.return_value = None
845845
with nifake.Session('dev1') as session:
846846
session.function_with_intflag_parameter(flags)
847-
self.patched_library_interpreter.function_with_intflag_parameter.assert_called_once_with(9223372036854775809)
847+
self.patched_library_interpreter.function_with_intflag_parameter.assert_called_once_with(1073741825)
848848

849849
def test_with_intflag_parameter_invalid(self):
850850
invalid_flag = 5

src/nirfsg/metadata/enums.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@
958958
]
959959
},
960960
'ResetWithOptionsStepsToOmit': {
961-
'enum_class': 'IntFlag',
961+
'class': 'IntFlag',
962962
'values': [
963963
{
964964
'documentation': {
@@ -1066,7 +1066,7 @@
10661066
]
10671067
},
10681068
'SelfCalibrateRangeStepsToOmit': {
1069-
'enum_class': 'IntFlag',
1069+
'class': 'IntFlag',
10701070
'values': [
10711071
{
10721072
'documentation': {

0 commit comments

Comments
 (0)