@@ -69,7 +69,7 @@ def do_custom(self):
69
69
# Get the object (lazy), then act
70
70
if in_obj :
71
71
data = {}
72
- if hasattr ( self .mgr , " _from_parent_attrs" ) :
72
+ if self .mgr . _from_parent_attrs :
73
73
for k in self .mgr ._from_parent_attrs :
74
74
data [k ] = self .args [k ]
75
75
if gitlab .mixins .GetWithoutIdMixin not in inspect .getmro (self .cls ):
@@ -138,13 +138,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
138
138
139
139
sub_parser_action = sub_parser .add_parser (action_name )
140
140
sub_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 :
143
143
sub_parser_action .add_argument (
144
144
"--%s" % x .replace ("_" , "-" ), required = True
145
145
)
146
- for x in mgr_cls ._from_parent_attrs
147
- ]
148
146
149
147
if action_name == "list" :
150
148
if hasattr (mgr_cls , "_list_filters" ):
@@ -221,13 +219,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
221
219
for action_name in cli .custom_actions [name ]:
222
220
sub_parser_action = sub_parser .add_parser (action_name )
223
221
# 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 :
226
224
sub_parser_action .add_argument (
227
225
"--%s" % x .replace ("_" , "-" ), required = True
228
226
)
229
- for x in mgr_cls ._from_parent_attrs
230
- ]
231
227
sub_parser_action .add_argument ("--sudo" , required = False )
232
228
233
229
# We need to get the object somehow
@@ -256,13 +252,11 @@ def _populate_sub_parser_by_class(cls, sub_parser):
256
252
name = mgr_cls .__name__
257
253
for action_name in cli .custom_actions [name ]:
258
254
sub_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 :
261
257
sub_parser_action .add_argument (
262
258
"--%s" % x .replace ("_" , "-" ), required = True
263
259
)
264
- for x in mgr_cls ._from_parent_attrs
265
- ]
266
260
sub_parser_action .add_argument ("--sudo" , required = False )
267
261
268
262
required , optional , dummy = cli .custom_actions [name ][action_name ]
0 commit comments