Skip to content

Commit

Permalink
Normalize strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankpatibandla committed Feb 2, 2024
1 parent 7c70259 commit dd23c0f
Show file tree
Hide file tree
Showing 80 changed files with 1,721 additions and 1,721 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
rev: 24.1.1
hooks:
- id: black
args: ["--skip-string-normalization", "--line-length=120"]
args: ["--line-length=120"]
- repo: local
hooks:
- id: pylint
Expand Down
2 changes: 1 addition & 1 deletion install_requires.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
with open('requirements.txt') as reqs:
with open("requirements.txt") as reqs:
install_requires = [req.strip() for req in reqs.readlines()]
30 changes: 15 additions & 15 deletions pros/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def build_cli():
pass


@build_cli.command(aliases=['build', 'm'])
@build_cli.command(aliases=["build", "m"])
@project_option()
@click.argument('build-args', nargs=-1)
@click.argument("build-args", nargs=-1)
@default_options
def make(project: c.Project, build_args):
"""
Expand All @@ -25,13 +25,13 @@ def make(project: c.Project, build_args):
analytics.send("make")
exit_code = project.compile(build_args)
if exit_code != 0:
logger(__name__).error(f'Failed to make project: Exit Code {exit_code}', extra={'sentry': False})
raise click.ClickException('Failed to build')
logger(__name__).error(f"Failed to make project: Exit Code {exit_code}", extra={"sentry": False})
raise click.ClickException("Failed to build")
return exit_code


@build_cli.command('make-upload', aliases=['mu'], hidden=True)
@click.option('build_args', '--make', '-m', multiple=True, help='Send arguments to make (e.g. compile target)')
@build_cli.command("make-upload", aliases=["mu"], hidden=True)
@click.option("build_args", "--make", "-m", multiple=True, help="Send arguments to make (e.g. compile target)")
@shadow_command(upload)
@project_option()
@click.pass_context
Expand All @@ -41,8 +41,8 @@ def make_upload(ctx, project: c.Project, build_args: List[str], **upload_args):
ctx.invoke(upload, project=project, **upload_args)


@build_cli.command('make-upload-terminal', aliases=['mut'], hidden=True)
@click.option('build_args', '--make', '-m', multiple=True, help='Send arguments to make (e.g. compile target)')
@build_cli.command("make-upload-terminal", aliases=["mut"], hidden=True)
@click.option("build_args", "--make", "-m", multiple=True, help="Send arguments to make (e.g. compile target)")
@shadow_command(upload)
@project_option()
@click.pass_context
Expand All @@ -55,14 +55,14 @@ def make_upload_terminal(ctx, project: c.Project, build_args, **upload_args):
ctx.invoke(terminal, port=project.target, request_banner=False)


@build_cli.command('build-compile-commands', hidden=True)
@build_cli.command("build-compile-commands", hidden=True)
@project_option()
@click.option(
'--suppress-output/--show-output', 'suppress_output', default=False, show_default=True, help='Suppress output'
"--suppress-output/--show-output", "suppress_output", default=False, show_default=True, help="Suppress output"
)
@click.option('--compile-commands', type=click.File('w'), default=None)
@click.option('--sandbox', default=False, is_flag=True)
@click.argument('build-args', nargs=-1)
@click.option("--compile-commands", type=click.File("w"), default=None)
@click.option("--sandbox", default=False, is_flag=True)
@click.argument("build-args", nargs=-1)
@default_options
def build_compile_commands(
project: c.Project, suppress_output: bool, compile_commands, sandbox: bool, build_args: List[str]
Expand All @@ -76,6 +76,6 @@ def build_compile_commands(
build_args, cdb_file=compile_commands, suppress_output=suppress_output, sandbox=sandbox
)
if exit_code != 0:
logger(__name__).error(f'Failed to make project: Exit Code {exit_code}', extra={'sentry': False})
raise click.ClickException('Failed to build')
logger(__name__).error(f"Failed to make project: Exit Code {exit_code}", extra={"sentry": False})
raise click.ClickException("Failed to build")
return exit_code
30 changes: 15 additions & 15 deletions pros/cli/click_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ def format_commands(self, ctx, formatter):
"""Extra format methods for multi methods that adds all the commands
after the options.
"""
if not hasattr(self, 'list_commands'):
if not hasattr(self, "list_commands"):
return
rows = []
for subcommand in self.list_commands(ctx):
cmd = self.get_command(ctx, subcommand)
# What is this, the tool lied about a command. Ignore it
if cmd is None:
continue
if hasattr(cmd, 'hidden') and cmd.hidden:
if hasattr(cmd, "hidden") and cmd.hidden:
continue

help = cmd.short_help or ''
help = cmd.short_help or ""
rows.append((subcommand, help))

if rows:
with formatter.section('Commands'):
with formatter.section("Commands"):
formatter.write_dl(rows)

def format_options(self, ctx, formatter):
Expand All @@ -46,15 +46,15 @@ def format_options(self, ctx, formatter):
for param in self.get_params(ctx):
rv = param.get_help_record(ctx)
if rv is not None:
if hasattr(param, 'group'):
if hasattr(param, "group"):
opts[param.group].append(rv)
else:
opts['Options'].append(rv)
opts["Options"].append(rv)

if len(opts['Options']) > 0:
with formatter.section('Options'):
formatter.write_dl(opts['Options'])
opts.pop('Options')
if len(opts["Options"]) > 0:
with formatter.section("Options"):
formatter.write_dl(opts["Options"])
opts.pop("Options")

for group, options in opts.items():
with formatter.section(group):
Expand All @@ -79,16 +79,16 @@ def __init__(self, *args, hidden: bool = False, group: str = None, **kwargs):
self.group = group

def get_help_record(self, ctx):
if hasattr(self, 'hidden') and self.hidden:
if hasattr(self, "hidden") and self.hidden:
return
return super().get_help_record(ctx)


class PROSDeprecated(click.Option):
def __init__(self, *args, replacement: str = None, **kwargs):
kwargs['help'] = "This option has been deprecated."
kwargs["help"] = "This option has been deprecated."
if not replacement == None:
kwargs['help'] += " Its replacement is '--{}'".format(replacement)
kwargs["help"] += " Its replacement is '--{}'".format(replacement)
super(PROSDeprecated, self).__init__(*args, **kwargs)
self.group = "Deprecated"
self.optiontype = "flag" if str(self.type) == "BOOL" else "switch"
Expand Down Expand Up @@ -116,7 +116,7 @@ def decorator(f):
for alias in aliases:
self.cmd_dict[alias] = f.__name__ if len(args) == 0 else args[0]

cmd = super(PROSGroup, self).command(*args, cls=kwargs.pop('cls', PROSCommand), **kwargs)(f)
cmd = super(PROSGroup, self).command(*args, cls=kwargs.pop("cls", PROSCommand), **kwargs)(f)
self.add_command(cmd)
return cmd

Expand All @@ -128,7 +128,7 @@ def group(self, aliases=None, *args, **kwargs):
def decorator(f):
for alias in aliases:
self.cmd_dict[alias] = f.__name__
cmd = super(PROSGroup, self).group(*args, cls=kwargs.pop('cls', PROSGroup), **kwargs)(f)
cmd = super(PROSGroup, self).group(*args, cls=kwargs.pop("cls", PROSGroup), **kwargs)(f)
self.add_command(cmd)
return cmd

Expand Down
Loading

0 comments on commit dd23c0f

Please sign in to comment.