@@ -69,7 +69,7 @@ def do_custom(self):
6969# Get the object (lazy), then act
7070if in_obj :
7171data = {}
72- if hasattr ( self .mgr , " _from_parent_attrs" ) :
72+ if self .mgr . _from_parent_attrs :
7373for k in self .mgr ._from_parent_attrs :
7474data [k ]= self .args [k ]
7575if gitlab .mixins .GetWithoutIdMixin not in inspect .getmro (self .cls ):
@@ -138,13 +138,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
138138
139139sub_parser_action = sub_parser .add_parser (action_name )
140140sub_parser_action .add_argument ("--sudo" ,required = False )
141- if hasattr ( mgr_cls , " _from_parent_attrs" ) :
142- [
141+ if mgr_cls . _from_parent_attrs :
142+ for x in mgr_cls . _from_parent_attrs :
143143sub_parser_action .add_argument (
144144"--%s" % x .replace ("_" ,"-" ),required = True
145145 )
146- for x in mgr_cls ._from_parent_attrs
147- ]
148146
149147if action_name == "list" :
150148if hasattr (mgr_cls ,"_list_filters" ):
@@ -221,13 +219,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
221219for action_name in cli .custom_actions [name ]:
222220sub_parser_action = sub_parser .add_parser (action_name )
223221# Get the attributes for URL/path construction
224- if hasattr ( mgr_cls , " _from_parent_attrs" ) :
225- [
222+ if mgr_cls . _from_parent_attrs :
223+ for x in mgr_cls . _from_parent_attrs :
226224sub_parser_action .add_argument (
227225"--%s" % x .replace ("_" ,"-" ),required = True
228226 )
229- for x in mgr_cls ._from_parent_attrs
230- ]
231227sub_parser_action .add_argument ("--sudo" ,required = False )
232228
233229# We need to get the object somehow
@@ -256,13 +252,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
256252name = mgr_cls .__name__
257253for action_name in cli .custom_actions [name ]:
258254sub_parser_action = sub_parser .add_parser (action_name )
259- if hasattr ( mgr_cls , " _from_parent_attrs" ) :
260- [
255+ if mgr_cls . _from_parent_attrs :
256+ for x in mgr_cls . _from_parent_attrs :
261257sub_parser_action .add_argument (
262258"--%s" % x .replace ("_" ,"-" ),required = True
263259 )
264- for x in mgr_cls ._from_parent_attrs
265- ]
266260sub_parser_action .add_argument ("--sudo" ,required = False )
267261
268262required ,optional ,dummy = cli .custom_actions [name ][action_name ]