From f7e6cd94913e475b168e48a38745a90b80c6ed1c Mon Sep 17 00:00:00 2001 From: Sebastian Castro <4603398+sea-bass@users.noreply.github.com> Date: Sat, 11 Jan 2025 09:56:40 -0500 Subject: [PATCH] Fix conversion typos (#238) --- ...{cpp_convertions.py => cpp_conversions.py} | 2 +- .../parse_yaml.py | 50 +++++++++---------- ...n_convertions.py => python_conversions.py} | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) rename generate_parameter_library_py/generate_parameter_library_py/{cpp_convertions.py => cpp_conversions.py} (99%) rename generate_parameter_library_py/generate_parameter_library_py/{python_convertions.py => python_conversions.py} (99%) diff --git a/generate_parameter_library_py/generate_parameter_library_py/cpp_convertions.py b/generate_parameter_library_py/generate_parameter_library_py/cpp_conversions.py similarity index 99% rename from generate_parameter_library_py/generate_parameter_library_py/cpp_convertions.py rename to generate_parameter_library_py/generate_parameter_library_py/cpp_conversions.py index c1fa76d..4d69b7f 100644 --- a/generate_parameter_library_py/generate_parameter_library_py/cpp_convertions.py +++ b/generate_parameter_library_py/generate_parameter_library_py/cpp_conversions.py @@ -8,7 +8,7 @@ from yaml.scanner import ScannerError -class CPPConverstions: +class CPPConversions: def __init__(self): self.defined_type_to_lang_type = { 'none': lambda defined_type, templates: None, diff --git a/generate_parameter_library_py/generate_parameter_library_py/parse_yaml.py b/generate_parameter_library_py/generate_parameter_library_py/parse_yaml.py index bc7b020..aa90f3b 100644 --- a/generate_parameter_library_py/generate_parameter_library_py/parse_yaml.py +++ b/generate_parameter_library_py/generate_parameter_library_py/parse_yaml.py @@ -45,8 +45,8 @@ import os import yaml -from generate_parameter_library_py.cpp_convertions import CPPConverstions -from generate_parameter_library_py.python_convertions import PythonConvertions +from generate_parameter_library_py.cpp_conversions import CPPConversions +from generate_parameter_library_py.python_conversions import PythonConversions from generate_parameter_library_py.string_filters_cpp import ( valid_string_cpp, valid_string_python, @@ -162,13 +162,13 @@ def __init__( default_value: Any, ): if language == 'cpp': - self.conversation = CPPConverstions() + self.conversion = CPPConversions() elif language == 'rst' or language == 'markdown': # cpp is used here because it the desired style of the markdown, # e.g. "false" for C++ instead of "False" for Python - self.conversation = CPPConverstions() + self.conversion = CPPConversions() elif language == 'python': - self.conversation = PythonConvertions() + self.conversion = PythonConversions() else: raise compile_error( 'Invalid language, only c++ and python are currently supported.' @@ -181,21 +181,21 @@ def __init__( self.defined_type, template = self.process_type(defined_type) self.array_type = array_type(self.defined_type) - if self.defined_type not in self.conversation.defined_type_to_lang_type: + if self.defined_type not in self.conversion.defined_type_to_lang_type: allowed = ', '.join( - key for key in self.conversation.defined_type_to_lang_type + key for key in self.conversion.defined_type_to_lang_type ) raise compile_error( f'Invalid parameter type `{defined_type}` for parameter {param_name}. Allowed types are: ' + allowed ) - func = self.conversation.defined_type_to_lang_type[self.defined_type] + func = self.conversion.defined_type_to_lang_type[self.defined_type] self.lang_type = func(self.defined_type, template) tmp = defined_type.split('_') self.defined_base_type = tmp[0] - func = self.conversation.defined_type_to_lang_type[self.defined_base_type] + func = self.conversion.defined_type_to_lang_type[self.defined_base_type] self.lang_base_type = func(self.defined_base_type, template) - func = self.conversation.lang_str_value_func[self.defined_type] + func = self.conversion.lang_str_value_func[self.defined_type] try: self.lang_str_value = func(default_value) except TypeCheckError: @@ -204,18 +204,18 @@ def __init__( ) def parameter_as_function_str(self): - if self.defined_type not in self.conversation.yaml_type_to_as_function: + if self.defined_type not in self.conversion.yaml_type_to_as_function: raise compile_error('invalid yaml type: %s' % type(self.defined_type)) - return self.conversation.yaml_type_to_as_function[self.defined_type] + return self.conversion.yaml_type_to_as_function[self.defined_type] def get_python_val_to_str_func(self, arg): - return self.conversation.python_val_to_str_func[str(type(arg))] + return self.conversion.python_val_to_str_func[str(type(arg))] def get_yaml_type_from_python(self, arg): if isinstance(arg, list): - return self.conversation.python_list_to_yaml_type[str(type(arg[0]))] + return self.conversion.python_list_to_yaml_type[str(type(arg[0]))] else: - return self.conversation.python_val_to_yaml_type[str(type(arg[0]))] + return self.conversion.python_val_to_yaml_type[str(type(arg[0]))] def process_type(self, defined_type): raise NotImplemented() @@ -237,7 +237,7 @@ def process_type(self, defined_type): size = fixed_type_size(defined_type) tmp = defined_type.split('_') yaml_base_type = tmp[0] - func = self.conversation.defined_type_to_lang_type[yaml_base_type] + func = self.conversion.defined_type_to_lang_type[yaml_base_type] lang_base_type = func(yaml_base_type, None) defined_type = get_fixed_type(defined_type) return defined_type, (lang_base_type, size) @@ -335,11 +335,11 @@ def __init__( self.arguments = [] def __str__(self): - function_name = self.code_gen_variable.conversation.get_func_signature( + function_name = self.code_gen_variable.conversion.get_func_signature( self.function_name, self.code_gen_variable.lang_base_type ) - open_bracket = self.code_gen_variable.conversation.open_bracket - close_bracket = self.code_gen_variable.conversation.close_bracket + open_bracket = self.code_gen_variable.conversion.open_bracket + close_bracket = self.code_gen_variable.conversion.close_bracket code = function_name + '(param' for arg in self.arguments: @@ -511,7 +511,7 @@ def __str__(self): self.parameter_value = '' else: self.parameter_value = self.parameter_name - bool_to_str = self.code_gen_variable.conversation.bool_to_str + bool_to_str = self.code_gen_variable.conversion.bool_to_str parameter_validations = self.parameter_validations @@ -568,7 +568,7 @@ def __str__(self): else: default_value = 'non-empty' - bool_to_str = self.code_gen_variable.conversation.bool_to_str + bool_to_str = self.code_gen_variable.conversion.bool_to_str parameter_field = get_dynamic_parameter_field(self.parameter_name) mapped_params = get_dynamic_mapped_parameter(self.parameter_name) parameter_map = get_dynamic_parameter_map(self.parameter_name) @@ -790,16 +790,16 @@ def parse_params(self, name, value, nested_name_list): param_name = code_gen_variable.param_name update_parameter_invalid = ( - code_gen_variable.conversation.update_parameter_fail_validation() + code_gen_variable.conversion.update_parameter_fail_validation() ) update_parameter_valid = ( - code_gen_variable.conversation.update_parameter_pass_validation() + code_gen_variable.conversion.update_parameter_pass_validation() ) declare_parameter_invalid = ( - code_gen_variable.conversation.initialization_fail_validation(param_name) + code_gen_variable.conversion.initialization_fail_validation(param_name) ) declare_parameter_valid = ( - code_gen_variable.conversation.initialization_pass_validation(param_name) + code_gen_variable.conversion.initialization_pass_validation(param_name) ) # add variable to struct diff --git a/generate_parameter_library_py/generate_parameter_library_py/python_convertions.py b/generate_parameter_library_py/generate_parameter_library_py/python_conversions.py similarity index 99% rename from generate_parameter_library_py/generate_parameter_library_py/python_convertions.py rename to generate_parameter_library_py/generate_parameter_library_py/python_conversions.py index 0a09dd0..80971f2 100644 --- a/generate_parameter_library_py/generate_parameter_library_py/python_convertions.py +++ b/generate_parameter_library_py/generate_parameter_library_py/python_conversions.py @@ -8,7 +8,7 @@ from yaml.scanner import ScannerError -class PythonConvertions: +class PythonConversions: def __init__(self): self.defined_type_to_lang_type = { 'none': lambda defined_type, templates: None,