From 89331131b3337308bacb0c4013e80a4809f3952c Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Sat, 24 Apr 2021 12:24:49 -0700 Subject: 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. --- gitlab/v4/cli.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'gitlab/v4/cli.py') 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) -- cgit v1.2.1