diff --git a/build/helper/documentation_helper.py b/build/helper/documentation_helper.py index 5c60c11e6..c376864cd 100644 --- a/build/helper/documentation_helper.py +++ b/build/helper/documentation_helper.py @@ -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'] diff --git a/build/helper/metadata_add_all.py b/build/helper/metadata_add_all.py index f28de7d9d..3d85e7f97 100644 --- a/build/helper/metadata_add_all.py +++ b/build/helper/metadata_add_all.py @@ -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): diff --git a/build/templates/enums.rst.mako b/build/templates/enums.rst.mako index b5cfaa372..14aebb8cc 100644 --- a/build/templates/enums.rst.mako +++ b/build/templates/enums.rst.mako @@ -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 diff --git a/docs/nirfsa/enums.rst b/docs/nirfsa/enums.rst index b335800e1..9122e80bc 100644 --- a/docs/nirfsa/enums.rst +++ b/docs/nirfsa/enums.rst @@ -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 ----------------------------------- @@ -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 ------------------------- diff --git a/generated/nidigital/nidigital/session.py b/generated/nidigital/nidigital/session.py index 858375095..5e2ca29c3 100644 --- a/generated/nidigital/nidigital/session.py +++ b/generated/nidigital/nidigital/session.py @@ -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. diff --git a/generated/nirfsa/nirfsa/enums.py b/generated/nirfsa/nirfsa/enums.py index e0a6b7dc0..db345e3fc 100644 --- a/generated/nirfsa/nirfsa/enums.py +++ b/generated/nirfsa/nirfsa/enums.py @@ -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''' @@ -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''' diff --git a/generated/niscope/niscope/session.py b/generated/niscope/niscope/session.py index c89ddc81b..641be56f2 100644 --- a/generated/niscope/niscope/session.py +++ b/generated/niscope/niscope/session.py @@ -4223,7 +4223,7 @@ def _cal_fetch_date(self, which_one): TBD Args: - which_one (enums.CalibrationTypes): + which_one (enums._CalibrationTypes): Returns: diff --git a/src/nirfsa/metadata/attributes.py b/src/nirfsa/metadata/attributes.py index 16673ede1..6f9f78611 100644 --- a/src/nirfsa/metadata/attributes.py +++ b/src/nirfsa/metadata/attributes.py @@ -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' @@ -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' diff --git a/src/nirfsa/metadata/enums.py b/src/nirfsa/metadata/enums.py index eb61071b4..cebe3d6c5 100644 --- a/src/nirfsa/metadata/enums.py +++ b/src/nirfsa/metadata/enums.py @@ -1005,8 +1005,9 @@ } ] }, - 'IqInPortTerminalConfiguration': { + 'IQInPortTerminalConfiguration': { 'codegen_method': 'public', + 'python_name': 'IqInPortTerminalConfiguration', 'values': [ { 'documentation': { @@ -1853,8 +1854,9 @@ } ] }, - 'ReferenceTriggerIqPowerEdgeSlope': { + 'ReferenceTriggerIQPowerEdgeSlope': { 'codegen_method': 'public', + 'python_name': 'ReferenceTriggerIqPowerEdgeSlope', 'values': [ { 'documentation': { diff --git a/src/nirfsa/metadata/functions.py b/src/nirfsa/metadata/functions.py index 18aea8b00..5d0eee1ae 100644 --- a/src/nirfsa/metadata/functions.py +++ b/src/nirfsa/metadata/functions.py @@ -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,