Skip to content

Commit d7acaf8

Browse files
committed
Updating the changes specifix to multi dimension
1 parent ea9242d commit d7acaf8

File tree

14 files changed

+137
-127
lines changed

14 files changed

+137
-127
lines changed

build/helper/codegen_helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def get_ctype_variable_declaration_snippet(parameter, parameters, ivi_dance_step
257257
module_name = '_visatype'
258258

259259
# Use _complextype.py file for complex parameter
260-
if parameter.get('complex_array_representation') is not None:
260+
if parameter['complex_type'] is not None:
261261
module_name = '_complextype'
262262

263263
if parameter['is_string'] is True:
@@ -368,7 +368,7 @@ def _get_ctype_variable_definition_snippet_for_scalar(parameter, parameters, ivi
368368
# Parameter denotes the size of another (the "corresponding") parameter.
369369
# Interleaved array length is going to be double the length of number of samples.
370370
# This is used for complex waveforms, where the real and imaginary parts are interleaved in the array.
371-
if corresponding_buffer_parameters[0].get('complex_array_representation') == 'interleaved_real_number_array':
371+
if corresponding_buffer_parameters[0]['complex_type'] == 'interleaved':
372372
definitions.append(parameter['ctypes_variable_name'] + ' = {0}.{1}(0 if {2} is None else len({2}) // 2) # case S160'.format(module_name, parameter['ctypes_type'], corresponding_buffer_parameters[0]['python_name']))
373373
else:
374374
definitions.append(parameter['ctypes_variable_name'] + ' = {0}.{1}(0 if {2} is None else len({2})) # case S160'.format(module_name, parameter['ctypes_type'], corresponding_buffer_parameters[0]['python_name']))
@@ -435,7 +435,7 @@ def _get_ctype_variable_definition_snippet_for_buffers(parameter, parameters, iv
435435
definition = None
436436

437437
if parameter['numpy'] is True and use_numpy_array is True:
438-
if parameter.get('complex_array_representation') is None:
438+
if parameter['complex_type'] is None:
439439
definition = '_get_ctypes_pointer_for_buffer(value={}) # case B510'.format(parameter['python_name'])
440440
else:
441441
definition = '_get_ctypes_pointer_for_buffer(value={}, library_type={}.{}) # case B510'.format(parameter['python_name'], module_name, parameter['ctypes_type'])

build/helper/metadata_add_all.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ def _add_ctypes_type(parameter, config):
126126
parameter['ctypes_type_library_call'] = module_name + parameter['ctypes_type']
127127

128128

129-
def _add_complex_array_representation(parameter):
130-
'''Adds a complex_array_representation parameter to the metadata for complex numbers'''
131-
if 'complex_array_representation' not in parameter:
132-
parameter['complex_array_representation'] = None
129+
def _add_complex_type(parameter):
130+
'''Adds a complex_type parameter to the metadata for complex numbers'''
131+
if 'complex_type' not in parameter:
132+
parameter['complex_type'] = None
133133

134134

135135
def _add_array_dimensions(parameter):
@@ -462,7 +462,7 @@ def add_all_function_metadata(functions, config):
462462
_add_python_type(p, config)
463463
_add_ctypes_variable_name(p)
464464
_add_ctypes_type(p, config)
465-
_add_complex_array_representation(p)
465+
_add_complex_type(p)
466466
_add_array_dimensions(p)
467467
_add_numpy_info(p, functions[f]['parameters'], config)
468468
_add_default_value_name(p)

build/unit_tests/test_metadata_add_all.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def _compare_dicts(actual, expected):
259259
'grpc_request_snippet': 'vi=self._vi',
260260
'use_in_python_api': True,
261261
'python_name_or_default_for_init': 'vi',
262-
'complex_array_representation': None,
262+
'complex_type': None,
263263
'array_dimensions': 1,
264264
},
265265
{
@@ -294,7 +294,7 @@ def _compare_dicts(actual, expected):
294294
'grpc_request_snippet': 'name=name',
295295
'use_in_python_api': True,
296296
'python_name_or_default_for_init': 'name',
297-
'complex_array_representation': None,
297+
'complex_type': None,
298298
'array_dimensions': 1,
299299
},
300300
{
@@ -332,7 +332,7 @@ def _compare_dicts(actual, expected):
332332
'grpc_request_snippet': 'pin_data_buffer_size=pin_data_buffer_size',
333333
'use_in_python_api': False,
334334
'python_name_or_default_for_init': 'pin_data_buffer_size',
335-
'complex_array_representation': None,
335+
'complex_type': None,
336336
'array_dimensions': 1,
337337
},
338338
{
@@ -370,7 +370,7 @@ def _compare_dicts(actual, expected):
370370
'grpc_request_snippet': 'python_code_input=2 ** 14',
371371
'use_in_python_api': True,
372372
'python_name_or_default_for_init': 'python_code_input',
373-
'complex_array_representation': None,
373+
'complex_type': None,
374374
'array_dimensions': 1,
375375
},
376376
{
@@ -408,7 +408,7 @@ def _compare_dicts(actual, expected):
408408
'grpc_request_snippet': 'actual_num_pin_data=actual_num_pin_data',
409409
'use_in_python_api': False,
410410
'python_name_or_default_for_init': 'actual_num_pin_data',
411-
'complex_array_representation': None,
411+
'complex_type': None,
412412
'array_dimensions': 1,
413413
},
414414
{
@@ -448,7 +448,7 @@ def _compare_dicts(actual, expected):
448448
'grpc_request_snippet': 'expected_pin_states=expected_pin_states',
449449
'use_in_python_api': True,
450450
'python_name_or_default_for_init': 'expected_pin_states',
451-
'complex_array_representation': None,
451+
'complex_type': None,
452452
'array_dimensions': 1,
453453
},
454454
{
@@ -486,7 +486,7 @@ def _compare_dicts(actual, expected):
486486
'grpc_request_snippet': 'custom_type_input=custom_type_input._create_copy(grpc_types.CustomStruct)',
487487
'use_in_python_api': True,
488488
'python_name_or_default_for_init': 'custom_type_input',
489-
'complex_array_representation': None,
489+
'complex_type': None,
490490
'array_dimensions': 1,
491491
},
492492
{
@@ -524,7 +524,7 @@ def _compare_dicts(actual, expected):
524524
'grpc_request_snippet': 'custom_type_output=custom_type_output._create_copy(grpc_types.CustomStruct)',
525525
'use_in_python_api': True,
526526
'python_name_or_default_for_init': 'custom_type_output',
527-
'complex_array_representation': None,
527+
'complex_type': None,
528528
'array_dimensions': 1,
529529
},
530530
{
@@ -562,7 +562,7 @@ def _compare_dicts(actual, expected):
562562
'grpc_request_snippet': 'custom_type_without_struct_prefix_input=custom_type_without_struct_prefix_input._create_copy(grpc_types.CustomStruct)',
563563
'use_in_python_api': True,
564564
'python_name_or_default_for_init': 'custom_type_without_struct_prefix_input',
565-
'complex_array_representation': None,
565+
'complex_type': None,
566566
'array_dimensions': 1,
567567
},
568568
{
@@ -600,7 +600,7 @@ def _compare_dicts(actual, expected):
600600
'grpc_request_snippet': 'custom_type_without_struct_prefix_output=custom_type_without_struct_prefix_output._create_copy(grpc_types.CustomStruct)',
601601
'use_in_python_api': True,
602602
'python_name_or_default_for_init': 'custom_type_without_struct_prefix_output',
603-
'complex_array_representation': None,
603+
'complex_type': None,
604604
'array_dimensions': 1,
605605
},
606606
],
@@ -649,7 +649,7 @@ def _compare_dicts(actual, expected):
649649
'grpc_request_snippet': 'vi=self._vi',
650650
'use_in_python_api': True,
651651
'python_name_or_default_for_init': 'vi',
652-
'complex_array_representation': None,
652+
'complex_type': None,
653653
'array_dimensions': 1,
654654
},
655655
{
@@ -687,7 +687,7 @@ def _compare_dicts(actual, expected):
687687
'grpc_request_snippet': 'status=status',
688688
'use_in_python_api': True,
689689
'python_name_or_default_for_init': 'status',
690-
'complex_array_representation': None,
690+
'complex_type': None,
691691
'array_dimensions': 1,
692692
},
693693
{
@@ -725,7 +725,7 @@ def _compare_dicts(actual, expected):
725725
'grpc_request_snippet': 'data_buffer_size=data_buffer_size',
726726
'use_in_python_api': False,
727727
'python_name_or_default_for_init': 'data_buffer_size',
728-
'complex_array_representation': None,
728+
'complex_type': None,
729729
'array_dimensions': 1,
730730
},
731731
{
@@ -764,7 +764,7 @@ def _compare_dicts(actual, expected):
764764
'grpc_request_snippet': 'data=data',
765765
'use_in_python_api': True,
766766
'python_name_or_default_for_init': 'data',
767-
'complex_array_representation': None,
767+
'complex_type': None,
768768
'array_dimensions': 1,
769769
},
770770
],

generated/nifake/nifake/_grpc_stub_interpreter.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ def function_with_3d_numpy_array_of_numpy_complex128_input_parameter(self, multi
148148
raise NotImplementedError('numpy-specific methods are not supported over gRPC')
149149

150150
def function_with_intflag_parameter(self, flag): # noqa: N802
151-
raise NotImplementedError('function_with_intflag_parameter is not supported over gRPC')
151+
self._invoke(
152+
self._client.FunctionWithIntflagParameter,
153+
grpc_types.FunctionWithIntflagParameterRequest(vi=self._vi, flag=flag.value),
154+
)
152155

153156
def function_with_repeated_capability_type(self, site_list): # noqa: N802
154157
raise NotImplementedError('function_with_repeated_capability_type is not supported over gRPC')

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-
E = 1073741824
66+
C = 9223372036854775808
6767
r'''
68-
Flag E option.
68+
Flag C option.
6969
'''
7070

7171

generated/nifake/nifake/session.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,6 @@ def fetch_waveform_into(self, waveform_data):
945945
raise TypeError('waveform_data must be numpy.ndarray of dtype=float64, is ' + str(waveform_data.dtype))
946946
self._interpreter.fetch_waveform_into(waveform_data)
947947

948-
@ivi_synchronized
949948
def function_with_3d_numpy_array_of_numpy_complex128_input_parameter(self, multidimensional_array):
950949
r'''function_with_3d_numpy_array_of_numpy_complex128_input_parameter
951950
@@ -1712,10 +1711,10 @@ def write_waveform_numpy(self, waveform):
17121711
def write_waveform_numpy_complex128(self, waveform_data_array):
17131712
r'''write_waveform_numpy_complex128
17141713
1715-
A method that writes a waveform of numpy complex128 samples.
1714+
A method that writes a waveform of numpy complex128 numbers.
17161715
17171716
Args:
1718-
waveform_data_array (numpy.array(dtype=numpy.complex128)): Specifies the array of data to load into the waveform.
1717+
waveform_data_array (numpy.array(dtype=numpy.complex128)): Specifies the array of data to load into the waveform. Array should be numberOfSamples big.
17191718
17201719
'''
17211720
import numpy
@@ -1734,10 +1733,10 @@ def write_waveform_numpy_complex128(self, waveform_data_array):
17341733
def write_waveform_numpy_complex64(self, waveform_data_array):
17351734
r'''write_waveform_numpy_complex64
17361735
1737-
A method that writes a waveform of numpy complex64 samples.
1736+
A method that writes a waveform of numpy complex64 numbers.
17381737
17391738
Args:
1740-
waveform_data_array (numpy.array(dtype=numpy.complex64)): Specifies the array of data to load into the waveform.
1739+
waveform_data_array (numpy.array(dtype=numpy.complex64)): Specifies the array of data to load into the waveform. Array should be numberOfSamples big.
17411740
17421741
'''
17431742
import numpy
@@ -1756,10 +1755,10 @@ def write_waveform_numpy_complex64(self, waveform_data_array):
17561755
def write_waveform_numpy_complex_interleaved_i16(self, waveform_data_array):
17571756
r'''write_waveform_numpy_complex_interleaved_i16
17581757
1759-
A method that writes a waveform of numpy complex i16 samples.
1758+
A method that writes a waveform of numpy complex i16 numbers.
17601759
17611760
Args:
1762-
waveform_data_array (numpy.array(dtype=numpy.int16)): Specifies the array of data to load into the waveform.
1761+
waveform_data_array (numpy.array(dtype=numpy.int16)): Specifies the array of data to load into the waveform. Array should be numberOfSamples big.
17631762
17641763
'''
17651764
import numpy

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.E | nifake.IntFlagEnum.A
842+
flags = nifake.IntFlagEnum.C | 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(1073741825)
847+
self.patched_library_interpreter.function_with_intflag_parameter.assert_called_once_with(9223372036854775809)
848848

849849
def test_with_intflag_parameter_invalid(self):
850850
invalid_flag = 5

src/nifake/metadata/attributes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# This file is generated from NI-FAKE API metadata version 25.8.0d9999
2+
# This file is generated from NI-FAKE API metadata version 24.8.0f100
33
attributes = {
44
1000000: {
55
'access': 'read-write',

src/nifake/metadata/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
# This file is generated from NI-FAKE API metadata version 25.8.0d9999
2+
# This file is generated from NI-FAKE API metadata version 24.8.0f100
33
config = {
4-
'api_version': '25.8.0d9999',
4+
'api_version': '24.8.0f100',
55
'c_function_prefix': 'niFake_',
66
'close_function': 'close',
77
'context_manager_name': {

src/nifake/metadata/enums.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# This file is generated from NI-FAKE API metadata version 25.8.0d9999
2+
# This file is generated from NI-FAKE API metadata version 24.8.0f100
33
enums = {
44
'AltColor': {
55
'values': [
@@ -200,18 +200,6 @@
200200
}
201201
]
202202
},
203-
'ExtCalParts': {
204-
'values': [
205-
{
206-
'name': 'NIFAKE_EXTCAL_PART1',
207-
'value': 1
208-
},
209-
{
210-
'name': 'NIFAKE_EXTCAL_PART2',
211-
'value': 2
212-
}
213-
]
214-
},
215203
'FloatEnum': {
216204
'values': [
217205
{
@@ -252,8 +240,8 @@
252240
]
253241
},
254242
'IntFlagEnum': {
255-
'class': 'IntFlag',
256243
'codegen_method': 'public',
244+
'enum_class': 'IntFlag',
257245
'values': [
258246
{
259247
'documentation': {
@@ -271,10 +259,10 @@
271259
},
272260
{
273261
'documentation': {
274-
'description': 'Flag E option.'
262+
'description': 'Flag C option.'
275263
},
276-
'name': 'NIFAKE_VAL_FLAG_E',
277-
'value': 1073741824
264+
'name': 'NIFAKE_VAL_FLAG_C',
265+
'value': 9223372036854775808
278266
}
279267
]
280268
},

0 commit comments

Comments
 (0)