Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Aug 4, 2023
1 parent b2c2b85 commit b35ca61
Show file tree
Hide file tree
Showing 162 changed files with 1,210 additions and 2,035 deletions.
4 changes: 1 addition & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,7 @@


def do_not_skip_init(app, what, name, obj, would_skip, options):
if name == "__init__":
return False # never skip __init__ functions
return would_skip
return False if name == "__init__" else would_skip


# Problem: CSS files aren't copied after modifying them. Solution:
Expand Down
6 changes: 1 addition & 5 deletions pw_allocator/py/pw_allocator/heap_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,7 @@ def visualize(
except TypeError:
_exit_due_to_bad_heap_info()

if poison_enabled:
poison_offset = pointer_size
else:
poison_offset = 0

poison_offset = pointer_size if poison_enabled else 0
try:
allocation_dump = open(dump_file, 'r')
except (FileNotFoundError, TypeError):
Expand Down
30 changes: 14 additions & 16 deletions pw_arduino_build/py/pw_arduino_build/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,15 @@ def show_command(args, builder):
show_command_print_string_list(args, builder.core_cpp_files())

elif args.variant_c_files:
vfiles = builder.variant_c_files()
if vfiles:
if vfiles := builder.variant_c_files():
show_command_print_string_list(args, vfiles)

elif args.variant_s_files:
vfiles = builder.variant_s_files()
if vfiles:
if vfiles := builder.variant_s_files():
show_command_print_string_list(args, vfiles)

elif args.variant_cpp_files:
vfiles = builder.variant_cpp_files()
if vfiles:
if vfiles := builder.variant_cpp_files():
show_command_print_string_list(args, vfiles)


Expand All @@ -298,22 +295,22 @@ def add_common_parser_args(
parser.add_argument(
"--serial-port",
default=serial_port,
help="Serial port for flashing. Default: '{}'".format(serial_port),
help=f"Serial port for flashing. Default: '{serial_port}'",
)
parser.add_argument(
"--build-path",
default=build_path,
help="Build directory. Default: '{}'".format(build_path),
help=f"Build directory. Default: '{build_path}'",
)
parser.add_argument(
"--project-path",
default=project_path,
help="Project directory. Default: '{}'".format(project_path),
help=f"Project directory. Default: '{project_path}'",
)
parser.add_argument(
"--project-source-path",
default=project_source_path,
help="Project directory. Default: '{}'".format(project_source_path),
help=f"Project directory. Default: '{project_source_path}'",
)
parser.add_argument(
"--library-path",
Expand All @@ -325,7 +322,7 @@ def add_common_parser_args(
parser.add_argument(
"--build-project-name",
default=build_project_name,
help="Project name. Default: '{}'".format(build_project_name),
help=f"Project name. Default: '{build_project_name}'",
)
parser.add_argument(
"--board", required=True, help="Name of the board to use."
Expand Down Expand Up @@ -361,12 +358,13 @@ def check_for_missing_args(args):

# TODO(tonymd): These defaults don't make sense anymore and should be removed.
def get_default_options():
defaults = {}
defaults["build_path"] = os.path.realpath(
os.path.expanduser(
os.path.expandvars(os.path.join(os.getcwd(), "build"))
defaults = {
"build_path": os.path.realpath(
os.path.expanduser(
os.path.expandvars(os.path.join(os.getcwd(), "build"))
)
)
)
}
defaults["project_path"] = os.path.realpath(
os.path.expanduser(os.path.expandvars(os.getcwd()))
)
Expand Down
Loading

0 comments on commit b35ca61

Please sign in to comment.