-
Notifications
You must be signed in to change notification settings - Fork 11
flake8: check for mutable function parameters #107
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
Changes from all commits
57512a7
141e0e1
d12f1d5
d5a3bba
c01c04d
d9ac834
0c94dc2
6ad523a
0a705c1
730dd57
e0b9b50
e6ce2d7
515419c
4e8d75c
9226c11
537f9eb
82636bf
08e8a93
abec92d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,10 +41,15 @@ | |
@click.pass_context | ||
@click.argument("props", nargs=-1) | ||
@click.argument("jail", nargs=1, required=True) | ||
def cli(ctx, props, jail): | ||
def cli( | ||
ctx: click.core.Context, | ||
props: typing.Tuple[str, ...], | ||
jail: str | ||
) -> None: | ||
"""Get a list of jails and print the property.""" | ||
|
||
logger = ctx.parent.logger | ||
parent: typing.Any = ctx.parent | ||
logger: iocage.lib.Logger.Logger = parent.logger | ||
host = iocage.lib.Host.HostGenerator(logger=logger) | ||
|
||
# Defaults | ||
|
@@ -66,15 +71,15 @@ def cli(ctx, props, jail): | |
|
||
updated_jail_count = 0 | ||
|
||
for jail in ioc_jails: | ||
for ioc_jail in ioc_jails: # type: iocage.lib.Jail.JailGenerator | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how the heck does that need a hint?? that feels like a bug in mypy There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can try to remove. Being explicit in other places should have fixed it anyway! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you're right |
||
|
||
updated_properties = set_properties(props, jail) | ||
updated_properties = set_properties(props, ioc_jail) | ||
|
||
if len(updated_properties) == 0: | ||
logger.screen(f"Jail '{jail.humanreadable_name}' unchanged") | ||
logger.screen(f"Jail '{ioc_jail.humanreadable_name}' unchanged") | ||
else: | ||
logger.screen( | ||
f"Jail '{jail.humanreadable_name}' updated: " + | ||
f"Jail '{ioc_jail.humanreadable_name}' updated: " + | ||
", ".join(updated_properties) | ||
) | ||
|
||
|
@@ -88,7 +93,7 @@ def cli(ctx, props, jail): | |
|
||
|
||
def set_properties( | ||
properties: typing.List[str], | ||
properties: typing.Iterable[str], | ||
target: 'iocage.lib.LaunchableResource.LaunchableResource' | ||
) -> set: | ||
|
||
|
@@ -107,6 +112,7 @@ def set_properties( | |
del target.config[key] | ||
updated_properties.add(key) | ||
except: | ||
raise | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this |
||
|
||
if len(updated_properties) > 0: | ||
|
@@ -115,5 +121,5 @@ def set_properties( | |
return updated_properties | ||
|
||
|
||
def _is_setter_property(property_string): | ||
return "=" in property_string | ||
def _is_setter_property(property_string: str) -> bool: | ||
return ("=" in property_string) |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole thing is amazing
thank you very much for the effort of typing this package! 💜