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

Commitd652133

Browse files
nejchJohnVillalovos
authored andcommitted
refactor: do not recommend plain gitlab.const constants
1 parentf185b17 commitd652133

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

‎gitlab/__init__.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def __getattr__(name: str) -> Any:
4343
ifnameingitlab.const._DEPRECATED:
4444
_utils.warn(
4545
message=(
46-
f"\nDirect access to 'gitlab.{name}' is deprecated and will be "
47-
f"removed in a future major python-gitlab release. Please "
48-
f"use'gitlab.const.{name}' instead."
46+
f"\nDirect access toconstants as'gitlab.{name}' is deprecated and "
47+
f"will beremoved in a future major python-gitlab release. Please "
48+
f"see the usage of constants in the'gitlab.const' module instead."
4949
),
5050
category=DeprecationWarning,
5151
)

‎gitlab/const.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
]
5757

5858

59+
classGitlabEnum(str,Enum):
60+
"""An enum mixed in with str to make it JSON-serializable."""
61+
62+
5963
# https://gitlab.com/gitlab-org/gitlab/-/blob/e97357824bedf007e75f8782259fe07435b64fbb/lib/gitlab/access.rb#L12-18
6064
classAccessLevel(IntEnum):
6165
NO_ACCESS:int=0
@@ -69,13 +73,13 @@ class AccessLevel(IntEnum):
6973

7074

7175
# https://gitlab.com/gitlab-org/gitlab/-/blob/e97357824bedf007e75f8782259fe07435b64fbb/lib/gitlab/visibility_level.rb#L23-25
72-
classVisibility(Enum):
76+
classVisibility(GitlabEnum):
7377
PRIVATE:str="private"
7478
INTERNAL:str="internal"
7579
PUBLIC:str="public"
7680

7781

78-
classNotificationLevel(Enum):
82+
classNotificationLevel(GitlabEnum):
7983
DISABLED:str="disabled"
8084
PARTICIPATING:str="participating"
8185
WATCH:str="watch"
@@ -85,7 +89,7 @@ class NotificationLevel(Enum):
8589

8690

8791
# https://gitlab.com/gitlab-org/gitlab/-/blob/e97357824bedf007e75f8782259fe07435b64fbb/app/views/search/_category.html.haml#L10-37
88-
classSearchScope(Enum):
92+
classSearchScope(GitlabEnum):
8993
# all scopes (global, group and project)
9094
PROJECTS:str="projects"
9195
ISSUES:str="issues"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp