diff options
author | John L. Villalovos <john@sodarock.com> | 2021-04-24 12:24:49 -0700 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-04-24 12:26:46 -0700 |
commit | 89331131b3337308bacb0c4013e80a4809f3952c (patch) | |
tree | 7cbe735bba997e61294df720db03616763787a8d /gitlab/v4/cli.py | |
parent | cfc42d246a4fc9a9afa9a676efcac0774e909aab (diff) | |
download | gitlab-89331131b3337308bacb0c4013e80a4809f3952c.tar.gz |
chore: make ListMixin._list_filters always present
Always create ListMixin._list_filters attribute with a default value
of tuple().
This way we don't need to use hasattr() and we will know the type of
the attribute.
Diffstat (limited to 'gitlab/v4/cli.py')
-rw-r--r-- | gitlab/v4/cli.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py index d036d12..705916e 100644 --- a/gitlab/v4/cli.py +++ b/gitlab/v4/cli.py @@ -145,13 +145,10 @@ def _populate_sub_parser_by_class(cls, sub_parser): ) if action_name == "list": - if hasattr(mgr_cls, "_list_filters"): - [ - sub_parser_action.add_argument( - "--%s" % x.replace("_", "-"), required=False - ) - for x in mgr_cls._list_filters - ] + for x in mgr_cls._list_filters: + sub_parser_action.add_argument( + "--%s" % x.replace("_", "-"), required=False + ) sub_parser_action.add_argument("--page", required=False) sub_parser_action.add_argument("--per-page", required=False) |