parse_yaml.py: fix issue with typeguard #154
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Seems like more modern typeguard throws here. This is a fix like already introduced in PR #149.
Fixes this error: (never mind the path names, I changed them)
Traceback (most recent call last):
| File "/usr/bin/generate_parameter_library_cpp", line 8, in
| sys.exit(main())
| ^^^^^^
| File "/usr/lib/python3.11/site-packages/generate_parameter_library_py/generate_cpp_header.py", line 66, in main
| run(output_file, yaml_file, validate_header)
| File "/usr/lib/python3.11/site-packages/generate_parameter_library_py/generate_cpp_header.py", line 45, in run
| gen_param_struct.parse(yaml_file, validate_header)
| File "/usr/lib/python3.11/site-packages/generate_parameter_library_py/parse_yaml.py", line 733, in parse
| self.parse_dict(self.namespace, doc[self.namespace], [])
| File "/usr/lib/python3.11/site-packages/generate_parameter_library_py/parse_yaml.py", line 831, in parse_dict
| self.parse_dict(key, root_map[key], nested_name)
| File "/usr/lib/python3.11/site-packages/generate_parameter_library_py/parse_yaml.py", line 837, in parse_dict
| self.parse_params(name, root_map, nested_name)
| File "/usr/lib/python3.11/site-packages/generate_parameter_library_py/parse_yaml.py", line 741, in parse_params
| ) = preprocess_inputs(self.language, name, value, nested_name_list)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/usr/lib/python3.11/site-packages/generate_parameter_library_py/parse_yaml.py", line 677, in preprocess_inputs
| validations.append(ValidationFunction(func_name, args, code_gen_variable))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/usr/lib/python3.11/site-packages/generate_parameter_library_py/parse_yaml.py", line 310, in init
| def init(
| File "/usr/lib/python3.11/site-packages/typeguard/_functions.py", line 113, in check_argument_types
| check_type_internal(value, expected_type, memo=memo)
| File "/usr/lib/python3.11/site-packages/typeguard/_checkers.py", line 676, in check_type_internal
| checker(value, origin_type, args, memo)
| File "/usr/lib/python3.11/site-packages/typeguard/checkers.py", line 377, in check_union
| check_type_internal(value, type, memo)
| File "/usr/lib/python3.11/site-packages/typeguard/_checkers.py", line 676, in check_type_internal
| checker(value, origin_type, args, memo)
| File "/usr/lib/python3.11/site-packages/typeguard/_checkers.py", line 273, in check_list
| check_type_internal(v, args[0], memo)
| File "/usr/lib/python3.11/site-packages/typeguard/_checkers.py", line 679, in check_type_internal
| if not isinstance(value, origin_type):
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union