Skip to content

Commit f2fc824

Browse files
committed
Updating default value of complext type as None rather than 'none'
1 parent e883c46 commit f2fc824

File tree

5 files changed

+56
-56
lines changed

5 files changed

+56
-56
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['complex_type'] != '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 'interleaved' in corresponding_buffer_parameters[0]['complex_type']:
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['complex_type'] == '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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _add_ctypes_type(parameter, config):
129129
def _add_complex_type(parameter):
130130
'''Adds a complex_type parameter to the metadata for complex numbers'''
131131
if 'complex_type' not in parameter:
132-
parameter['complex_type'] = 'none'
132+
parameter['complex_type'] = None
133133

134134

135135
def _add_numpy_info(parameter, parameters, config):

build/helper/metadata_filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def filter_parameters(parameters, parameter_usage_options):
384384
skip = False
385385
if not options_to_use['python_api_list'] and not x['use_in_python_api']:
386386
skip = True
387-
if options_to_use['skip_all_except_complex_type_parameters'] and x['complex_type'] == 'none':
387+
if options_to_use['skip_all_except_complex_type_parameters'] and x['complex_type'] is None:
388388
skip = True
389389
if not skip:
390390
parameters_to_use.append(x)

build/unit_tests/test_codegen_helper.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
'size': {'mechanism': 'fixed', 'value': 1},
4242
'type': 'ViSession',
4343
'numpy': False,
44-
'complex_type': 'none',
44+
'complex_type': None,
4545
'use_in_python_api': True,
4646
},
4747
{ # 1
@@ -70,7 +70,7 @@
7070
'size': {'mechanism': 'fixed', 'value': 1},
7171
'type': 'ViInt64',
7272
'numpy': False,
73-
'complex_type': 'none',
73+
'complex_type': None,
7474
'use_in_python_api': True,
7575
},
7676
{ # 2
@@ -98,7 +98,7 @@
9898
'size': {'mechanism': 'fixed', 'value': 256},
9999
'type': 'ViString',
100100
'numpy': False,
101-
'complex_type': 'none',
101+
'complex_type': None,
102102
'use_in_python_api': True,
103103
},
104104
{ # 3
@@ -127,7 +127,7 @@
127127
'size': {'mechanism': 'python-code', 'value': 'self.get_array_size_for_python_code()'},
128128
'type': 'custom_struct',
129129
'numpy': False,
130-
'complex_type': 'none',
130+
'complex_type': None,
131131
'use_in_python_api': True,
132132
},
133133
{ # 4
@@ -153,7 +153,7 @@
153153
'size': {'mechanism': 'fixed', 'value': 1},
154154
'type': 'ViInt32',
155155
'numpy': False,
156-
'complex_type': 'none',
156+
'complex_type': None,
157157
'use_in_python_api': True,
158158
},
159159
{ # 5
@@ -181,7 +181,7 @@
181181
'size': {'mechanism': 'passed-in', 'value': 'numberOfElements'},
182182
'type': 'ViInt16',
183183
'numpy': False,
184-
'complex_type': 'none',
184+
'complex_type': None,
185185
'use_in_python_api': True,
186186
},
187187
{ # 6
@@ -210,7 +210,7 @@
210210
'size': {'mechanism': 'fixed', 'value': 1},
211211
'type': 'ViInt16',
212212
'numpy': False,
213-
'complex_type': 'none',
213+
'complex_type': None,
214214
'use_in_python_api': True,
215215
},
216216
{ # 7
@@ -238,7 +238,7 @@
238238
'size': {'mechanism': 'passed-in', 'value': 'numberOfElements'},
239239
'type': 'ViInt64',
240240
'numpy': True,
241-
'complex_type': 'none',
241+
'complex_type': None,
242242
'numpy_type': 'int64',
243243
'numpy_type_library_call': 'numpy.int64',
244244
'use_in_python_api': True,
@@ -260,7 +260,7 @@
260260
'interpreter_method_call_snippet': 'number_of_elements_python_code',
261261
'name': 'numberOfElementsPythonCode',
262262
'numpy': False,
263-
'complex_type': 'none',
263+
'complex_type': None,
264264
'python_name': 'number_of_elements_python_code',
265265
'python_name_with_default': 'number_of_elements_python_code',
266266
'python_name_with_doc_default': 'number_of_elements_python_code',
@@ -286,7 +286,7 @@
286286
'interpreter_method_call_snippet': 'input',
287287
'name': 'input',
288288
'numpy': False,
289-
'complex_type': 'none',
289+
'complex_type': None,
290290
'python_name': 'input',
291291
'python_name_with_default': 'input',
292292
'python_name_with_doc_default': 'input',
@@ -315,7 +315,7 @@
315315
'interpreter_method_call_snippet': 'input_array',
316316
'name': 'inputArray',
317317
'numpy': False,
318-
'complex_type': 'none',
318+
'complex_type': None,
319319
'python_name': 'input_array',
320320
'python_name_with_default': 'input_array=None',
321321
'python_name_with_doc_default': 'input_array=None',
@@ -341,7 +341,7 @@
341341
'interpreter_method_call_snippet': 'input_array_size',
342342
'name': 'inputArraySize',
343343
'numpy': False,
344-
'complex_type': 'none',
344+
'complex_type': None,
345345
'python_name': 'input_array_size',
346346
'python_name_with_default': 'input_array_size',
347347
'python_name_with_doc_default': 'input_array_size',
@@ -367,7 +367,7 @@
367367
'interpreter_method_call_snippet': 'string_size',
368368
'name': 'stringSize',
369369
'numpy': False,
370-
'complex_type': 'none',
370+
'complex_type': None,
371371
'python_name': 'string_size',
372372
'python_name_with_default': 'string_size',
373373
'python_name_with_doc_default': 'string_size',
@@ -393,7 +393,7 @@
393393
'interpreter_method_call_snippet': 'a_string',
394394
'name': 'aString',
395395
'numpy': False,
396-
'complex_type': 'none',
396+
'complex_type': None,
397397
'python_name': 'a_string',
398398
'python_name_with_default': 'a_string',
399399
'python_name_with_doc_default': 'a_string',
@@ -420,7 +420,7 @@
420420
'interpreter_method_call_snippet': 'timeout',
421421
'name': 'Timeout',
422422
'numpy': False,
423-
'complex_type': 'none',
423+
'complex_type': None,
424424
'python_name': 'timeout',
425425
'python_name_with_default': 'timeout=1.0',
426426
'python_name_with_doc_default': 'timeout=1.0',
@@ -449,7 +449,7 @@
449449
'interpreter_method_call_snippet': 'self._repeated_capability',
450450
'name': 'channelList',
451451
'numpy': False,
452-
'complex_type': 'none',
452+
'complex_type': None,
453453
'original_type': 'ViChar[]',
454454
'python_name': 'channel_list',
455455
'python_name_with_default': 'channel_list',
@@ -476,7 +476,7 @@
476476
'interpreter_method_call_snippet': 'a_string',
477477
'name': 'aString',
478478
'numpy': False,
479-
'complex_type': 'none',
479+
'complex_type': None,
480480
'python_name': 'a_string',
481481
'python_name_with_default': 'a_string',
482482
'python_name_with_doc_default': 'a_string',
@@ -509,7 +509,7 @@
509509
'size': {'mechanism': 'len', 'value': 'array_in'},
510510
'type': 'custom_struct',
511511
'numpy': False,
512-
'complex_type': 'none',
512+
'complex_type': None,
513513
'use_in_python_api': True,
514514
},
515515
{ # 18
@@ -539,7 +539,7 @@
539539
'size': {'mechanism': 'fixed', 'value': 256},
540540
'type': 'ViInt16',
541541
'numpy': False,
542-
'complex_type': 'none',
542+
'complex_type': None,
543543
'use_in_python_api': True,
544544
},
545545
{ # 19
@@ -559,7 +559,7 @@
559559
'interpreter_method_call_snippet': 'a_string_2',
560560
'name': 'aString2',
561561
'numpy': False,
562-
'complex_type': 'none',
562+
'complex_type': None,
563563
'python_name': 'a_string_2',
564564
'python_name_with_default': 'a_string_2',
565565
'python_name_with_doc_default': 'a_string_2',
@@ -585,7 +585,7 @@
585585
'interpreter_method_call_snippet': 'a_string_3',
586586
'name': 'aStrin3g',
587587
'numpy': False,
588-
'complex_type': 'none',
588+
'complex_type': None,
589589
'python_name': 'a_string_3',
590590
'python_name_with_default': 'a_string_3',
591591
'python_name_with_doc_default': 'a_string_3',
@@ -611,7 +611,7 @@
611611
'interpreter_method_call_snippet': 'a_string_twist',
612612
'name': 'aStringTwist',
613613
'numpy': False,
614-
'complex_type': 'none',
614+
'complex_type': None,
615615
'python_name': 'a_string_twist',
616616
'python_name_with_default': 'a_string_twist',
617617
'python_name_with_doc_default': 'a_string_twist',
@@ -646,7 +646,7 @@
646646
'size': {'mechanism': 'fixed', 'value': 1},
647647
'type': 'ViInt64',
648648
'numpy': False,
649-
'complex_type': 'none',
649+
'complex_type': None,
650650
'use_in_python_api': True,
651651
},
652652
{ # 23
@@ -666,7 +666,7 @@
666666
'interpreter_method_call_snippet': 'string_size_twist',
667667
'name': 'stringSizeTwist',
668668
'numpy': False,
669-
'complex_type': 'none',
669+
'complex_type': None,
670670
'python_name': 'string_size_twist',
671671
'python_name_with_default': 'string_size_twist',
672672
'python_name_with_doc_default': 'string_size_twist',
@@ -692,7 +692,7 @@
692692
'interpreter_method_call_snippet': 'a_buffer',
693693
'name': 'aBufferArray',
694694
'numpy': False,
695-
'complex_type': 'none',
695+
'complex_type': None,
696696
'python_name': 'a_buffer_array',
697697
'python_name_with_default': 'a_buffer_array',
698698
'python_name_with_doc_default': 'a_buffer_array',
@@ -720,7 +720,7 @@
720720
'interpreter_method_call_snippet': 'a_buffer',
721721
'name': 'aBufferList',
722722
'numpy': False,
723-
'complex_type': 'none',
723+
'complex_type': None,
724724
'python_name': 'a_buffer_list',
725725
'python_name_with_default': 'a_buffer_list',
726726
'python_name_with_doc_default': 'a_buffer_list',
@@ -748,7 +748,7 @@
748748
'interpreter_method_call_snippet': 'a_buffer',
749749
'name': 'aBufferTwistArray',
750750
'numpy': False,
751-
'complex_type': 'none',
751+
'complex_type': None,
752752
'python_name': 'a_buffer_twist_array',
753753
'python_name_with_default': 'a_buffer_twist_array',
754754
'python_name_with_doc_default': 'a_buffer_twist_array',
@@ -776,7 +776,7 @@
776776
'interpreter_method_call_snippet': 'a_buffer',
777777
'name': 'aBufferTwistList',
778778
'numpy': False,
779-
'complex_type': 'none',
779+
'complex_type': None,
780780
'python_name': 'a_buffer_twist_list',
781781
'python_name_with_default': 'a_buffer_twist_list',
782782
'python_name_with_doc_default': 'a_buffer_twist_list',
@@ -807,7 +807,7 @@
807807
'interpreter_method_call_snippet': 'input_array_2',
808808
'name': 'inputArray2',
809809
'numpy': False,
810-
'complex_type': 'none',
810+
'complex_type': None,
811811
'python_name': 'input_array_2',
812812
'python_name_with_default': 'input_array_2=None',
813813
'python_name_with_doc_default': 'input_array_2=None',
@@ -836,7 +836,7 @@
836836
'interpreter_method_call_snippet': 'input_array_2',
837837
'name': 'inputArray2',
838838
'numpy': False,
839-
'complex_type': 'none',
839+
'complex_type': None,
840840
'python_api_converter_name': 'convert_to_nitclk_session_num_list',
841841
'python_name': 'input_array_2',
842842
'python_name_with_default': 'input_array_2=None',
@@ -866,7 +866,7 @@
866866
'interpreter_method_call_snippet': 'input_array_3',
867867
'name': 'inputArray3',
868868
'numpy': False,
869-
'complex_type': 'none',
869+
'complex_type': None,
870870
'python_api_converter_name': 'convert_to_nitclk_session_num_list',
871871
'python_name': 'input_array_3',
872872
'python_name_with_default': 'input_array_3=None',
@@ -896,7 +896,7 @@
896896
'interpreter_method_call_snippet': 'input_array_3',
897897
'name': 'inputArray4',
898898
'numpy': False,
899-
'complex_type': 'none',
899+
'complex_type': None,
900900
'python_api_converter_name': 'convert_to_nitclk_session_num_list',
901901
'python_name': 'input_array_4',
902902
'python_name_with_default': 'input_array_4=None',
@@ -926,7 +926,7 @@
926926
'interpreter_method_call_snippet': 'input_array_3',
927927
'name': 'inputArray4',
928928
'numpy': False,
929-
'complex_type': 'none',
929+
'complex_type': None,
930930
'python_api_converter_name': 'convert_to_nitclk_session_num_list',
931931
'python_name': 'input_array_4',
932932
'python_name_with_default': 'input_array_4=None',
@@ -953,7 +953,7 @@
953953
'interpreter_method_call_snippet': 'a_string_enum',
954954
'name': 'aStringEnum',
955955
'numpy': False,
956-
'complex_type': 'none',
956+
'complex_type': None,
957957
'python_name': 'a_string_enum',
958958
'python_name_with_default': 'a_string_enum',
959959
'python_name_with_doc_default': 'a_string_enum',
@@ -981,7 +981,7 @@
981981
'interpreter_method_call_snippet': 'indices',
982982
'name': 'indices',
983983
'numpy': False,
984-
'complex_type': 'none',
984+
'complex_type': None,
985985
'original_type': 'ViChar[]',
986986
'python_api_converter_name': 'convert_repeated_capabilities_without_prefix',
987987
'python_name': 'indices',
@@ -1018,7 +1018,7 @@
10181018
'size': {'mechanism': 'passed-in', 'value': 'numberOfElements'},
10191019
'type': 'ViInt8',
10201020
'numpy': False,
1021-
'complex_type': 'none',
1021+
'complex_type': None,
10221022
'use_in_python_api': True,
10231023
},
10241024
]
@@ -1217,7 +1217,7 @@ def test_get_ctype_variable_declaration_snippet_case_s220():
12171217

12181218
def test_get_ctype_variable_declaration_snippet_case_b510():
12191219
snippet = get_ctype_variable_declaration_snippet(parameters_for_testing[7], parameters_for_testing, IviDanceStep.NOT_APPLICABLE, config_for_testing, use_numpy_array=True)
1220-
assert snippet == ["output_ctype = _get_ctypes_pointer_for_buffer(value=output) # case B510"]
1220+
assert snippet == ["output_ctype = _get_ctypes_pointer_for_buffer(value=output, library_type=numpy.ViInt64) # case B510"]
12211221

12221222

12231223
def test_get_ctype_variable_declaration_snippet_case_b540():

0 commit comments

Comments
 (0)