Skip to content

Commit a844cc9

Browse files
updated niFake metadata files and session mako template
1 parent 1e05db7 commit a844cc9

File tree

7 files changed

+317
-66
lines changed

7 files changed

+317
-66
lines changed

build/templates/session.py.mako

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ class _Lock(object):
9191
% endif
9292
% if len(config['repeated_capabilities']) > 0:
9393

94-
% if config['rep_cap_expansion'] == 'custom':
94+
% if config.get('repeated_capability_object_type', {}).get('python', 'session') == 'custom':
9595
# Dynamically handle repeated capabilities
9696
% for rep_cap in config['repeated_capabilities']:
9797

98-
class _RepCap${rep_cap['python_name'].capitalize()}(object):
98+
class _RepeatedCapability${rep_cap['python_name'].capitalize()}(object):
9999
% for attribute in helper.sorted_attrs(helper.filter_rep_cap_supported_attributes(attributes, rep_cap['python_name'])):
100100
<%
101101
helper.add_attribute_rep_cap_tip(attributes[attribute], config)
@@ -219,7 +219,7 @@ class _SessionBase(object):
219219
# Skip attributes with repeated capability expansion set to "custom"
220220
if 'repeated_capability_type' in attributes[attribute]:
221221
rep_cap_type = attributes[attribute]['repeated_capability_type']
222-
if any(rep_cap.get('python_name') == rep_cap_type and config['rep_cap_expansion'] == 'custom' for rep_cap in config['repeated_capabilities']):
222+
if any(rep_cap.get('python_name') == rep_cap_type and config['repeated_capability_object_type'] == 'custom' for rep_cap in config['repeated_capabilities']):
223223
continue
224224
helper.add_attribute_rep_cap_tip(attributes[attribute], config)
225225
%>\
@@ -263,8 +263,8 @@ constructor_params = helper.filter_parameters(init_function['parameters'], helpe
263263
% if len(config['repeated_capabilities']) > 0:
264264
# Instantiate any repeated capability objects
265265
% for rep_cap in config['repeated_capabilities']:
266-
% if config['rep_cap_expansion'] == 'custom':
267-
self.${rep_cap['python_name']} = _RepCap${rep_cap['python_name'].capitalize()}(self, repeated_capability_list)
266+
% if config.get('repeated_capability_object_type', {}).get('python', 'session') == 'custom':
267+
self.${rep_cap['python_name']} = _RepeatedCapability${rep_cap['python_name'].capitalize()}(self, repeated_capability_list)
268268
% else:
269269
self.${rep_cap['python_name']} = _RepeatedCapabilities(self, '${rep_cap["prefix"]}', repeated_capability_list)
270270
% endif

generated/nirfsg/nirfsg/session.py

Lines changed: 298 additions & 55 deletions
Large diffs are not rendered by default.

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 24.8.0f100
2+
# This file is generated from NI-FAKE API metadata version 25.5.0d9999
33
attributes = {
44
1000000: {
55
'access': 'read-write',

src/nifake/metadata/config.py

Lines changed: 8 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 24.8.0f100
2+
# This file is generated from NI-FAKE API metadata version 25.5.0d9999
33
config = {
4-
'api_version': '24.8.0f100',
4+
'api_version': '25.5.0d9999',
55
'c_function_prefix': 'niFake_',
66
'close_function': 'close',
77
'context_manager_name': {
@@ -30,6 +30,9 @@
3030
}
3131
],
3232
'driver_name': 'NI-FAKE',
33+
'enable_warning_events': {
34+
'python': True
35+
},
3336
'enum_whitelist_suffix': [
3437
'_POINT_FIVE'
3538
],
@@ -72,6 +75,9 @@
7275
'python_name': 'instruments'
7376
}
7477
],
78+
'repeated_capability_object_type': {
79+
'python': 'session'
80+
},
7581
'session_class_description': 'An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation',
7682
'session_handle_parameter_name': 'vi',
7783
'uses_nitclk': True

src/nifake/metadata/enums.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 24.8.0f100
2+
# This file is generated from NI-FAKE API metadata version 25.5.0d9999
33
enums = {
44
'AltColor': {
55
'values': [

src/nifake/metadata/functions.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 24.8.0f100
2+
# This file is generated from NI-FAKE API metadata version 25.5.0d9999
33
functions = {
44
'Abort': {
55
'codegen_method': 'public',

src/nirfsg/metadata/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
}
4040
},
4141
'module_name': 'nirfsg',
42-
'rep_cap_expansion': 'custom',
42+
'repeated_capability_object_type': {
43+
'python': 'custom'
44+
},
4345
'repeated_capabilities': [
4446
{
4547
'prefix': 'marker',

0 commit comments

Comments
 (0)