Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAQmx code generator for error_codes.py and constants.py using scrapigen metadata #215

Merged
merged 20 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
10b1bbd
Create error code mako with enums.py containing error codes and gener…
Mar 1, 2023
f2eb5aa
Add helper functions to format enums metadata
Mar 1, 2023
73e5565
Create constants mako file to generate constants.py file with the hel…
Mar 1, 2023
9e1b171
Generated out files for constants
Mar 1, 2023
f08d6fd
Merge branch 'master' of https://github.com/ni/nidaqmx-python into us…
Mar 14, 2023
5d19d59
Updated codegen import in constants.mako file
Mar 14, 2023
abd5f1b
Updated enums metadata in enums.py
Mar 14, 2023
5b3c035
Updated enumhelpers.py to generate expected constants.py file
Mar 14, 2023
53c3bf7
Generated constants and error codes after enums metadata from scrapigen
Mar 14, 2023
872fd8c
Moved NullHandler in logger to _init_.py and removed NullHandler addi…
Mounikabattu20 Mar 16, 2023
9e4b3f8
Removed unused logger
Mounikabattu20 Mar 16, 2023
d0d7f1e
Updated enums metadata from Scrapigen
Mounikabattu20 Mar 16, 2023
78a013d
Updated logic to produced expected constants.py
Mounikabattu20 Mar 16, 2023
8b0dacc
Generated constants.py file
Mounikabattu20 Mar 16, 2023
56db50d
Merge branch 'master' into users/vikram/generate-error-codes-py-file
MounikaBattu17 Mar 16, 2023
cb7788a
Added python_enum for Impedance1
Mounikabattu20 Mar 16, 2023
b8a0746
Fixed lint errors
Mounikabattu20 Mar 16, 2023
dc9b372
Updated enums metadata from Scrapigen
Mounikabattu20 Mar 17, 2023
626638b
Removed python_enum variable
Mounikabattu20 Mar 17, 2023
8c646a0
Fixed lint errors in attribute.py
Mounikabattu20 Mar 17, 2023
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
214 changes: 54 additions & 160 deletions generated/nidaqmx/constants.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions generated/nidaqmx/error_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@


class DAQmxErrors(IntEnum):
REMOTE_SENSE = -209888
OVER_TEMPERATURE_PROTECTION_ACTIVATED = -209887
vigkre marked this conversation as resolved.
Show resolved Hide resolved
MULTI_TASK_CFG_SAMP_RATE_NOT_SUPPORTED_WITH_PROP_SET = -209886
MULTI_TASK_CFG_SAMP_RATE_CONFLICTING_PROP = -209885
NO_COMMON_SAMP_RATE_FOUND_NO_REPEAT_SAMPS = -209884
Expand Down
1,032 changes: 526 additions & 506 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/codegen/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
"""NI-DAQmx code generator."""
import logging


_logger = logging.getLogger(__name__)
_logger.addHandler(logging.NullHandler())
1 change: 0 additions & 1 deletion src/codegen/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import codegen.generator as generator

_logger = logging.getLogger(__name__)
_logger.addHandler(logging.NullHandler())


def _get_logging_level(verbose, quiet):
Expand Down
5 changes: 4 additions & 1 deletion src/codegen/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


_logger = logging.getLogger(__name__)
_logger.addHandler(logging.NullHandler())


def _get_metadata():
Expand Down Expand Up @@ -44,3 +43,7 @@ def generate(dest):

for info in codegen_metadata["script_info"]["modules"]:
_generate_file(codegen_metadata, info["templateFile"], dest / info["relativeOutputPath"])

_generate_file(codegen_metadata["enums"], "error_codes.mako", dest / "error_codes.py")

_generate_file(codegen_metadata, "constants.mako", dest / "constants.py")
3 changes: 2 additions & 1 deletion src/codegen/metadata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .attributes import attributes
from .script_info import script_info
from .enums import enums

metadata = {"attributes": attributes, "script_info": script_info}
metadata = {"attributes": attributes, "script_info": script_info, "enums": enums}
4 changes: 2 additions & 2 deletions src/codegen/metadata/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@
'c_function_name': 'AIImpedance',
'calling_convention': 'StdCall',
'ctypes_data_type': 'ctypes.c_double',
'enum': 'Impedance1',
'handle_parameters': {
'channelHandle': {
'accessor': 'self._name',
Expand All @@ -295,6 +294,7 @@
'python_class_name': 'AIChannel',
'python_data_type': 'Impedance1',
'python_description': 'Specifies the input impedance of the channel.',
'python_enum': 'Impedance1',
'resettable': True,
'type': 'float64'
},
Expand Down Expand Up @@ -6325,7 +6325,7 @@
'name': 'CI_ENCODER_DECODING_TYPE',
'python_class_name': 'CIChannel',
'python_data_type': 'EncoderType2',
'python_description': 'Specifies how to count and interpret the pulses the encoder generates on signal A and signal B. **EncoderType2.X1**, **EncoderType2.X2**, and **EncoderType2.X4** are valid for quadrature encoders only. **EncoderType2.TWO_PULSE_COUNTING** is valid for two-pulse encoders only.',
'python_description': 'Specifies how to count and interpret the pulses the encoder generates on signal A and signal B. **EncoderType2.X_1**, **EncoderType2.X_2**, and **EncoderType2.X_4** are valid for quadrature encoders only. **EncoderType2.TWO_PULSE_COUNTING** is valid for two-pulse encoders only.',
'resettable': True,
'type': 'int32'
},
Expand Down
Loading