Skip to content

Commit

Permalink
#20 Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
kwabenantim committed Nov 26, 2024
1 parent e340e85 commit 60f0e3b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cppwg/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion cppwg/writers/constructor_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion cppwg/writers/free_function_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 3 additions & 1 deletion cppwg/writers/method_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 60f0e3b

Please sign in to comment.