Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/helper/documentation_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def format_type_for_rst_documentation(param, numpy, config):
if numpy and param['numpy']:
p_type = param['numpy_type']
elif param['enum'] is not None:
p_type = ':py:data:`{}.{}`'.format(config['module_name'], param['enum'])
p_type = ':py:data:`{}.{}`'.format(config['module_name'], config['enums'][param['enum']]['python_name'])
else:
p_type = param['type_in_documentation']

Expand Down
17 changes: 9 additions & 8 deletions build/helper/metadata_add_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,28 +678,29 @@ def _add_enum_value_python_name(enum_info, config):


def fixup_enum_names(config):
'''Fix enum types for private enums
'''Fix enum types in attributes and functions to use the enum's python_name

Now that we have all the metadata calculated, we need to fix any enum types in attributes and functions
where the underlying enum is private. At the time the 'python_type' was set, we hadn't yet calculated
whether the enum would be private or not. We couldn't because we needed to process all the functions and
attributes first.
to reference the underlying enum's 'python_name'. At the time the
'python_type' was set, 'config['enums']' wasn't populated yet, so we couldn't look this up.
'''
# Check all the functions that will be code generated
for f in config['functions']:
if config['functions'][f]['codegen_method'] != 'no':
for p in config['functions'][f]['parameters']:
if p['enum'] is not None and config['enums'][p['enum']]['codegen_method'] == 'private':
# We need to update the python type since the enum is private
if p['enum'] is not None:
p['python_type'] = 'enums.' + config['enums'][p['enum']]['python_name']
if p['type_in_documentation_was_calculated']:
p['type_in_documentation'] = p['python_type']

# Check all attributes that will be code generated
for a in config['attributes']:
attr = config['attributes'][a]
if attr['codegen_method'] != 'no':
if attr['enum'] is not None and config['enums'][attr['enum']]['codegen_method'] == 'private':
# We need to update the python type since the enum is private
if attr['enum'] is not None:
attr['python_type'] = 'enums.' + config['enums'][attr['enum']]['python_name']
if attr['type_in_documentation_was_calculated']:
attr['type_in_documentation'] = attr['python_type']


def add_all_enum_metadata(enums, config):
Expand Down
2 changes: 1 addition & 1 deletion build/templates/enums.rst.mako
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ${helper.get_rst_header_snippet(enums[enum_name]['python_name'], '-')}
.. py:class:: ${enums[enum_name]['python_name']}
% for enum_value in enums[enum_name]['values']:

.. py:attribute:: ${enum_name}.${enum_value['python_name']}
.. py:attribute:: ${enums[enum_name]['python_name']}.${enum_value['python_name']}

${helper.get_documentation_for_node_rst(enum_value, config, indent=8)}
% endfor
Expand Down
50 changes: 25 additions & 25 deletions docs/nirfsa/enums.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,31 @@ IFfilterSelection



IqInPortTerminalConfiguration
-----------------------------

.. py:class:: IqInPortTerminalConfiguration

.. py:attribute:: IqInPortTerminalConfiguration.DIFFERENTIAL



Sets the terminal configuration to differential.





.. py:attribute:: IqInPortTerminalConfiguration.SINGLE_ENDED



Sets the terminal configuration to single-ended.





IfConditioningDownConversionEnabled
-----------------------------------

Expand Down Expand Up @@ -1321,31 +1346,6 @@ InputPort



IqInPortTerminalConfiguration
-----------------------------

.. py:class:: IqInPortTerminalConfiguration

.. py:attribute:: IqInPortTerminalConfiguration.DIFFERENTIAL



Sets the terminal configuration to differential.





.. py:attribute:: IqInPortTerminalConfiguration.SINGLE_ENDED



Sets the terminal configuration to single-ended.





LinearInterpolationFormat
-------------------------

Expand Down
2 changes: 1 addition & 1 deletion generated/nidigital/nidigital/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -2691,7 +2691,7 @@ def _get_site_results_site_numbers(self, site_result_type):
Example: :py:meth:`my_session._get_site_results_site_numbers`

Args:
site_result_type (enums.SiteResultType): The type of data specified in the results array.
site_result_type (enums._SiteResultType): The type of data specified in the results array.

- _SiteResultType.PASS_FAIL: Get site numbers for pass/fail data.
- _SiteResultType.CAPTURE_WAVEFORM: Get site numbers for capture waveforms.
Expand Down
22 changes: 11 additions & 11 deletions generated/nirfsa/nirfsa/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,17 @@ class IFfilterSelection(Enum):
'''


class IqInPortTerminalConfiguration(Enum):
DIFFERENTIAL = 2100
r'''
Sets the terminal configuration to differential.
'''
SINGLE_ENDED = 2101
r'''
Sets the terminal configuration to single-ended.
'''


class IfConditioningDownConversionEnabled(Enum):
DISABLED = 1900
r'''
Expand Down Expand Up @@ -560,17 +571,6 @@ class InputPort(Enum):
'''


class IqInPortTerminalConfiguration(Enum):
DIFFERENTIAL = 2100
r'''
Sets the terminal configuration to differential.
'''
SINGLE_ENDED = 2101
r'''
Sets the terminal configuration to single-ended.
'''


class LinearInterpolationFormat(Enum):
MAGNITUDE_AND_PHASE = 4001
r'''
Expand Down
2 changes: 1 addition & 1 deletion generated/niscope/niscope/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4223,7 +4223,7 @@ def _cal_fetch_date(self, which_one):
TBD

Args:
which_one (enums.CalibrationTypes):
which_one (enums._CalibrationTypes):


Returns:
Expand Down
4 changes: 2 additions & 2 deletions src/nirfsa/metadata/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2353,7 +2353,7 @@
'Description'
]
},
'enum': 'ReferenceTriggerIqPowerEdgeSlope',
'enum': 'ReferenceTriggerIQPowerEdgeSlope',
'lv_property': 'Triggers:Ref:IQ Power Edge:Slope',
'name': 'IQ_POWER_EDGE_REF_TRIGGER_SLOPE',
'type': 'ViInt32'
Expand Down Expand Up @@ -3346,7 +3346,7 @@
'Description'
]
},
'enum': 'IqInPortTerminalConfiguration',
'enum': 'IQInPortTerminalConfiguration',
'lv_property': 'Device Specific:Vector Signal Transceiver:IQ In Port:Terminal Configuration',
'name': 'IQ_IN_PORT_TERMINAL_CONFIGURATION',
'type': 'ViInt32'
Expand Down
6 changes: 4 additions & 2 deletions src/nirfsa/metadata/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,8 +1005,9 @@
}
]
},
'IqInPortTerminalConfiguration': {
'IQInPortTerminalConfiguration': {
'codegen_method': 'public',
'python_name': 'IqInPortTerminalConfiguration',
'values': [
{
'documentation': {
Expand Down Expand Up @@ -1853,8 +1854,9 @@
}
]
},
'ReferenceTriggerIqPowerEdgeSlope': {
'ReferenceTriggerIQPowerEdgeSlope': {
'codegen_method': 'public',
'python_name': 'ReferenceTriggerIqPowerEdgeSlope',
'values': [
{
'documentation': {
Expand Down
2 changes: 1 addition & 1 deletion src/nirfsa/metadata/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@
'documentation': {
'description': 'Specifies whether the device detects a positive or negative slope on the trigger signal. The default value is NIRFSA_VAL_RISING_SLOPE.\n\n| Value | Description |\n|:--------------------------------|:-------------------------------------------------|\n| NIRFSA_VAL_RISING_SLOPE (1000) | NI-RFSA detects a rising edge (positive slope). |\n| NIRFSA_VAL_FALLING_SLOPE (1001) | NI-RFSA detects a falling edge (negative slope). |',
},
'enum' : 'ReferenceTriggerIqPowerEdgeSlope',
'enum' : 'ReferenceTriggerIQPowerEdgeSlope',
'name': 'slope',
'type': 'ViInt32',
'use_array': False,
Expand Down
Loading