Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8933113

Browse files
chore: make ListMixin._list_filters always present
Always create ListMixin._list_filters attribute with a default valueof tuple().This way we don't need to use hasattr() and we will know the type ofthe attribute.
1 parentcfc42d2 commit8933113

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

‎gitlab/mixins.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
Dict,
2323
List,
2424
Optional,
25+
Tuple,
2526
Type,
2627
TYPE_CHECKING,
2728
Union,
@@ -186,6 +187,7 @@ def refresh(self, **kwargs: Any) -> None:
186187
classListMixin(_RestManagerBase):
187188
_computed_path:Optional[str]
188189
_from_parent_attrs:Dict[str,Any]
190+
_list_filters:Tuple[str, ...]= ()
189191
_obj_cls:Optional[Type[base.RESTObject]]
190192
_parent:Optional[base.RESTObject]
191193
_parent_attrs:Dict[str,Any]

‎gitlab/v4/cli.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,10 @@ def _populate_sub_parser_by_class(cls, sub_parser):
145145
)
146146

147147
ifaction_name=="list":
148-
ifhasattr(mgr_cls,"_list_filters"):
149-
[
150-
sub_parser_action.add_argument(
151-
"--%s"%x.replace("_","-"),required=False
152-
)
153-
forxinmgr_cls._list_filters
154-
]
148+
forxinmgr_cls._list_filters:
149+
sub_parser_action.add_argument(
150+
"--%s"%x.replace("_","-"),required=False
151+
)
155152

156153
sub_parser_action.add_argument("--page",required=False)
157154
sub_parser_action.add_argument("--per-page",required=False)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp