GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor: do not recommend plain gitlab.const constants · python-gitlab/python-gitlab@d652133

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • gitlab
    • __init__.py
    • const.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎gitlab/__init__.py‎

Copy file name to clipboardExpand all lines: gitlab/__init__.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def __getattr__(name: str) -> Any:
4343
if name in gitlab.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 to constants as 'gitlab.{name}' is deprecated and "
47+
f"will be removed 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
)
Collapse file

‎gitlab/const.py‎

Copy file name to clipboardExpand all lines: gitlab/const.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
]
5757

5858

59+
class GitlabEnum(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
class AccessLevel(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-
class Visibility(Enum):
76+
class Visibility(GitlabEnum):
7377
PRIVATE: str = "private"
7478
INTERNAL: str = "internal"
7579
PUBLIC: str = "public"
7680

7781

78-
class NotificationLevel(Enum):
82+
class NotificationLevel(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-
class SearchScope(Enum):
92+
class SearchScope(GitlabEnum):
8993
# all scopes (global, group and project)
9094
PROJECTS: str = "projects"
9195
ISSUES: str = "issues"

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.