diff --git a/cppwg/utils/utils.py b/cppwg/utils/utils.py index 4232a6a..1a6e379 100644 --- a/cppwg/utils/utils.py +++ b/cppwg/utils/utils.py @@ -172,7 +172,7 @@ def read_source_file( return source -def str_to_num(expr: str, integer:bool = False) -> Number: +def str_to_num(expr: str, integer: bool = False) -> Number: """ Convert a literal string expression to a number e.g. "(-1)" to -1. diff --git a/cppwg/writers/constructor_writer.py b/cppwg/writers/constructor_writer.py index 6fa47a4..e1cb032 100644 --- a/cppwg/writers/constructor_writer.py +++ b/cppwg/writers/constructor_writer.py @@ -188,7 +188,9 @@ def generate_wrapper(self) -> str: ): # Try to convert "(-1)" to "-1" etc. default_value = str(arg.default_value) - value = utils.str_to_num(default_value, integer="int" in str(arg.decl_type)) + value = utils.str_to_num( + default_value, integer="int" in str(arg.decl_type) + ) if value is not None: default_value = str(value) diff --git a/cppwg/writers/free_function_writer.py b/cppwg/writers/free_function_writer.py index 5c77bb9..1681110 100644 --- a/cppwg/writers/free_function_writer.py +++ b/cppwg/writers/free_function_writer.py @@ -54,7 +54,9 @@ def generate_wrapper(self) -> str: if arg.default_value is not None: # Try to convert "(-1)" to "-1" etc. default_value = str(arg.default_value) - value = utils.str_to_num(default_value, integer="int" in str(arg.decl_type)) + value = utils.str_to_num( + default_value, integer="int" in str(arg.decl_type) + ) if value is not None: default_value = str(value) default_args += f" = {default_value}" diff --git a/cppwg/writers/method_writer.py b/cppwg/writers/method_writer.py index c91cf68..07cd99b 100644 --- a/cppwg/writers/method_writer.py +++ b/cppwg/writers/method_writer.py @@ -158,7 +158,9 @@ def generate_wrapper(self) -> str: ): # Try to convert "(-1)" to "-1" etc. default_value = str(arg.default_value) - value = utils.str_to_num(default_value, integer="int" in str(arg.decl_type)) + value = utils.str_to_num( + default_value, integer="int" in str(arg.decl_type) + ) if value is not None: default_value = str(value)