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 empty collection comparisons w/ a more idiomatic unary operator #70

Merged
merged 5 commits into from
Jun 3, 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/fbuild/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ def _communicate(proc, stdout, stderr, print_output=True):
appendable.append(line)
# Streams are EOF when the line returned is empty. Once this occurs, we are responsible for closing the
# stream and thus closing the select loop. Empty strings need not be printed.
if line == "":
if not line:
key.fileobj.close()
continue
# Forwards output to screen. Assuming a PTY is used, then coloring highlights should be automatically
Expand Down
2 changes: 1 addition & 1 deletion src/fprime/fbuild/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def read_safe_path(
all_paths = parser.get(section, key, fallback="").split(":")
expanded = []
for path in all_paths:
if path == "" or path is None:
ThibFrgsGmz marked this conversation as resolved.
Show resolved Hide resolved
if not path:
continue
full_path = os.path.abspath(os.path.normpath(os.path.join(base_dir, path)))
if exists and not os.path.exists(full_path):
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 format_template == "" else "{:" + format_template + "}"
return "{}" if not format_template else "{:" + format_template + "}"

def convert_include_all(match_obj):
return convert(match_obj, ignore_int=False)
Expand Down