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

Replace one if statement w/ if expr #129

Merged
merged 2 commits into from
Apr 24, 2023
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/fpp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FppMissingSupportFiles(FprimeException):

def __init__(self, file):
super().__init__(
f"Current directory does not define any FPP files. Did you intend to run in the topology directory?"
"Current directory does not define any FPP files. Did you intend to run in the topology directory?"
)


Expand Down
5 changes: 1 addition & 4 deletions src/fprime/util/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ def utility_entry(args):
parsed, cmake_args, make_args, parser, runners = parse_args(args)

try:
if skip_build_loading(parsed):
build = None
else:
build = load_build(parsed)
build = None if skip_build_loading(parsed) else load_build(parsed)

# runners is a Dict[str, Callable] of {command_name: handler_functions} pairs
return runners[parsed.command](
Expand Down
2 changes: 1 addition & 1 deletion src/fprime/util/code_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def execute(
# Backup files unless --no-backup is requested
if self.backup:
for file in self._files_to_format:
shutil.copy2(file, file.parent / (file.stem + ".bak" + file.suffix))
shutil.copy2(file, file.parent / f"{file.stem}.bak{file.suffix}")
pass_through = args[1]
self._preprocess_files()
clang_args = [
Expand Down
6 changes: 3 additions & 3 deletions src/fprime/util/cookiecutter_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run_impl(build: Build, source_path: Path):
hpp_dest = hpp_files[0]
cpp_dest = common[0] if common else cpp_files[0]

if not confirm(f"Generate implementation files (yes/no)? "):
if not confirm("Generate implementation files (yes/no)? "):
return False
print(
"Refreshing cache and generating implementation files (ignore 'Stop' CMake warning)..."
Expand Down Expand Up @@ -320,7 +320,7 @@ def get_valid_input(prompt):
name = input(prompt)
char = is_valid_name(name)
if char != "valid":
print("'" + char + "' is not a valid character")
print(f"'{char}' is not a valid character")
else:
valid_name = True
return name
Expand Down Expand Up @@ -467,7 +467,7 @@ def new_deployment(parsed_args):
os.path.dirname(__file__)
+ "/../cookiecutter_templates/cookiecutter-fprime-deployment"
)
print(f"[INFO] Cookiecutter: using builtin template for new deployment")
print("[INFO] Cookiecutter: using builtin template for new deployment")
try:
gen_path = cookiecutter(source, overwrite_if_exists=parsed_args.overwrite)
except OutputDirExistsException as out_directory_error:
Expand Down