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

Refactoring by swapping if-expr to avoid negation #79

Merged
merged 6 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/fprime/common/models/serialize/serializable_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def formatted_val(self) -> dict:
Note 2: If a member is an array will call array formatted_val
:return a formatted dict
"""
result = dict()
result = {}
for member_name, _, member_format, _ in self.MEMBER_LIST:
value_object = self._val[member_name]
if isinstance(value_object, (array_type.ArrayType, SerializableType)):
Expand Down
12 changes: 7 additions & 5 deletions src/fprime/fbuild/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ def execute_known_target(
cmake_target = target
else:
module = self.get_cmake_module(path, build_dir)
cmake_target = (
module
if target == ""
else (f"{module}_{target}".lstrip("_") if not top_target else target)
)
if target == "":
cmake_target = module
elif top_target:
cmake_target = target
else:
cmake_target = f"{module}_{target}".lstrip("_")

run_args = ["--build", build_dir]
environment = {} if environment is None else copy.copy(environment)
if self.verbose:
Expand Down
2 changes: 1 addition & 1 deletion src/fprime/fbuild/gcovr.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def execute(
"--print-summary",
"--txt",
f"{coverage_output_dir}/summary.txt",
f"--html-details",
"--html-details",
f"{coverage_output_dir}/coverage{'-all' if self.scope == TargetScope.GLOBAL else ''}.html",
]
cli_args.extend(args[1])
Expand Down
2 changes: 1 addition & 1 deletion src/fprime/util/string_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def convert(match_obj, ignore_int):
elif all([not ignore_int, str(conversion_type).lower() == "d"]):
format_template += f"{conversion_type}"

return "{}" if not format_template else "{:" + format_template + "}"
return "{:" + format_template + "}" if format_template else "{}"

def convert_include_all(match_obj):
return convert(match_obj, ignore_int=False)
Expand Down
2 changes: 1 addition & 1 deletion test/fprime/common/models/serialize/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def test_serializable_basic_off_nominal():
("member2", StringType.construct_type("StringMember1", max_length=10), "%s"),
]
serializable_type = SerializableType.construct_type(
f"BasicInvalidSerializable", member_list
"BasicInvalidSerializable", member_list
)

invalid_values = [
Expand Down