Skip to content

Commit

Permalink
chore: fix pylint error "expression-not-assigned"
Browse files Browse the repository at this point in the history
Fix pylint error "expression-not-assigned" and remove check from the
disabled list.

And I personally think it is much more readable now and is less lines
of code.
  • Loading branch information
JohnVillalovos committed Dec 8, 2021
1 parent 3a7d6f6 commit a90eb23
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 deletions.
48 changes: 20 additions & 28 deletions gitlab/v4/cli.py
Expand Up @@ -266,20 +266,16 @@ def _populate_sub_parser_by_class(
sub_parser_action.add_argument(f"--{id_attr}", required=True)

required, optional, dummy = cli.custom_actions[name][action_name]
[
sub_parser_action.add_argument(
f"--{x.replace('_', '-')}", required=True
)
for x in required
if x != cls._id_attr
]
[
sub_parser_action.add_argument(
f"--{x.replace('_', '-')}", required=False
)
for x in optional
if x != cls._id_attr
]
for x in required:
if x != cls._id_attr:
sub_parser_action.add_argument(
f"--{x.replace('_', '-')}", required=True
)
for x in optional:
if x != cls._id_attr:
sub_parser_action.add_argument(
f"--{x.replace('_', '-')}", required=False
)

if mgr_cls.__name__ in cli.custom_actions:
name = mgr_cls.__name__
Expand All @@ -293,20 +289,16 @@ def _populate_sub_parser_by_class(
sub_parser_action.add_argument("--sudo", required=False)

required, optional, dummy = cli.custom_actions[name][action_name]
[
sub_parser_action.add_argument(
f"--{x.replace('_', '-')}", required=True
)
for x in required
if x != cls._id_attr
]
[
sub_parser_action.add_argument(
f"--{x.replace('_', '-')}", required=False
)
for x in optional
if x != cls._id_attr
]
for x in required:
if x != cls._id_attr:
sub_parser_action.add_argument(
f"--{x.replace('_', '-')}", required=True
)
for x in optional:
if x != cls._id_attr:
sub_parser_action.add_argument(
f"--{x.replace('_', '-')}", required=False
)


def extend_parser(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Expand Up @@ -55,7 +55,6 @@ disable = [
"consider-using-sys-exit",
"cyclic-import",
"duplicate-code",
"expression-not-assigned",
"fixme",
"implicit-str-concat",
"import-outside-toplevel",
Expand Down

0 comments on commit a90eb23

Please sign in to comment.