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

chore: Remove trivial get methods in preparation for generic Get mixin#3110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletionsgitlab/client.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -397,10 +397,11 @@ def auth(self) -> None:
The `user` attribute will hold a `gitlab.objects.CurrentUser` object on
success.
"""
self.user = self._objects.CurrentUserManager(self).get()
# pylint: disable=line-too-long
self.user = self._objects.CurrentUserManager(self).get() # type: ignore[assignment]

if hasattr(self.user, "web_url") and hasattr(self.user, "username"):
self._check_url(self.user.web_url, path=self.user.username)
self._check_url(self.user.web_url, path=self.user.username) # type: ignore[union-attr]

def version(self) -> Tuple[str, str]:
"""Returns the version and revision of the gitlab server.
Expand Down
5 changes: 1 addition & 4 deletionsgitlab/v4/objects/appearance.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
from typing import Any,cast,Dict, Optional, Union
from typing import Any, Dict, Optional, Union

from gitlab import exceptions as exc
from gitlab.base import RESTManager, RESTObject
Expand DownExpand Up@@ -58,6 +58,3 @@ def update(
new_data = new_data or {}
data = new_data.copy()
return super().update(id, data, **kwargs)

def get(self, **kwargs: Any) -> ApplicationAppearance:
return cast(ApplicationAppearance, super().get(**kwargs))
15 changes: 0 additions & 15 deletionsgitlab/v4/objects/audit_events.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,8 +3,6 @@
https://docs.gitlab.com/ee/api/audit_events.html
"""

from typing import Any, cast, Union

from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import RetrieveMixin

Expand All@@ -29,9 +27,6 @@ class AuditEventManager(RetrieveMixin, RESTManager):
_obj_cls = AuditEvent
_list_filters = ("created_after", "created_before", "entity_type", "entity_id")

def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> AuditEvent:
return cast(AuditEvent, super().get(id=id, lazy=lazy, **kwargs))


class GroupAuditEvent(RESTObject):
_id_attr = "id"
Expand All@@ -43,11 +38,6 @@ class GroupAuditEventManager(RetrieveMixin, RESTManager):
_from_parent_attrs = {"group_id": "id"}
_list_filters = ("created_after", "created_before")

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> GroupAuditEvent:
return cast(GroupAuditEvent, super().get(id=id, lazy=lazy, **kwargs))


class ProjectAuditEvent(RESTObject):
_id_attr = "id"
Expand All@@ -59,11 +49,6 @@ class ProjectAuditEventManager(RetrieveMixin, RESTManager):
_from_parent_attrs = {"project_id": "id"}
_list_filters = ("created_after", "created_before")

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectAuditEvent:
return cast(ProjectAuditEvent, super().get(id=id, lazy=lazy, **kwargs))


class ProjectAudit(ProjectAuditEvent):
pass
Expand Down
48 changes: 0 additions & 48 deletionsgitlab/v4/objects/award_emojis.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
from typing import Any, cast, Union

from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin
from gitlab.types import RequiredOptional
Expand DownExpand Up@@ -34,11 +32,6 @@ class GroupEpicAwardEmojiManager(NoUpdateMixin, RESTManager):
_from_parent_attrs = {"group_id": "group_id", "epic_iid": "iid"}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> GroupEpicAwardEmoji:
return cast(GroupEpicAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))


class GroupEpicNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
Expand All@@ -54,11 +47,6 @@ class GroupEpicNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> GroupEpicNoteAwardEmoji:
return cast(GroupEpicNoteAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))


class ProjectIssueAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
Expand All@@ -70,11 +58,6 @@ class ProjectIssueAwardEmojiManager(NoUpdateMixin, RESTManager):
_from_parent_attrs = {"project_id": "project_id", "issue_iid": "iid"}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectIssueAwardEmoji:
return cast(ProjectIssueAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))


class ProjectIssueNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
Expand All@@ -90,11 +73,6 @@ class ProjectIssueNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectIssueNoteAwardEmoji:
return cast(ProjectIssueNoteAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))


class ProjectMergeRequestAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
Expand All@@ -106,13 +84,6 @@ class ProjectMergeRequestAwardEmojiManager(NoUpdateMixin, RESTManager):
_from_parent_attrs = {"project_id": "project_id", "mr_iid": "iid"}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectMergeRequestAwardEmoji:
return cast(
ProjectMergeRequestAwardEmoji, super().get(id=id, lazy=lazy, **kwargs)
)


class ProjectMergeRequestNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
Expand All@@ -128,13 +99,6 @@ class ProjectMergeRequestNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectMergeRequestNoteAwardEmoji:
return cast(
ProjectMergeRequestNoteAwardEmoji, super().get(id=id, lazy=lazy, **kwargs)
)


class ProjectSnippetAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
Expand All@@ -146,11 +110,6 @@ class ProjectSnippetAwardEmojiManager(NoUpdateMixin, RESTManager):
_from_parent_attrs = {"project_id": "project_id", "snippet_id": "id"}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectSnippetAwardEmoji:
return cast(ProjectSnippetAwardEmoji, super().get(id=id, lazy=lazy, **kwargs))


class ProjectSnippetNoteAwardEmoji(ObjectDeleteMixin, RESTObject):
pass
Expand All@@ -165,10 +124,3 @@ class ProjectSnippetNoteAwardEmojiManager(NoUpdateMixin, RESTManager):
"note_id": "id",
}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectSnippetNoteAwardEmoji:
return cast(
ProjectSnippetNoteAwardEmoji, super().get(id=id, lazy=lazy, **kwargs)
)
10 changes: 0 additions & 10 deletionsgitlab/v4/objects/badges.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
from typing import Any, cast, Union

from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import BadgeRenderMixin, CRUDMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional
Expand All@@ -23,9 +21,6 @@ class GroupBadgeManager(BadgeRenderMixin, CRUDMixin, RESTManager):
_create_attrs = RequiredOptional(required=("link_url", "image_url"))
_update_attrs = RequiredOptional(optional=("link_url", "image_url"))

def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> GroupBadge:
return cast(GroupBadge, super().get(id=id, lazy=lazy, **kwargs))


class ProjectBadge(SaveMixin, ObjectDeleteMixin, RESTObject):
pass
Expand All@@ -37,8 +32,3 @@ class ProjectBadgeManager(BadgeRenderMixin, CRUDMixin, RESTManager):
_from_parent_attrs = {"project_id": "id"}
_create_attrs = RequiredOptional(required=("link_url", "image_url"))
_update_attrs = RequiredOptional(optional=("link_url", "image_url"))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectBadge:
return cast(ProjectBadge, super().get(id=id, lazy=lazy, **kwargs))
20 changes: 0 additions & 20 deletionsgitlab/v4/objects/boards.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
from typing import Any, cast, Union

from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional
Expand DownExpand Up@@ -29,11 +27,6 @@ class GroupBoardListManager(CRUDMixin, RESTManager):
)
_update_attrs = RequiredOptional(required=("position",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> GroupBoardList:
return cast(GroupBoardList, super().get(id=id, lazy=lazy, **kwargs))


class GroupBoard(SaveMixin, ObjectDeleteMixin, RESTObject):
lists: GroupBoardListManager
Expand All@@ -45,9 +38,6 @@ class GroupBoardManager(CRUDMixin, RESTManager):
_from_parent_attrs = {"group_id": "id"}
_create_attrs = RequiredOptional(required=("name",))

def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> GroupBoard:
return cast(GroupBoard, super().get(id=id, lazy=lazy, **kwargs))


class ProjectBoardList(SaveMixin, ObjectDeleteMixin, RESTObject):
pass
Expand All@@ -62,11 +52,6 @@ class ProjectBoardListManager(CRUDMixin, RESTManager):
)
_update_attrs = RequiredOptional(required=("position",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectBoardList:
return cast(ProjectBoardList, super().get(id=id, lazy=lazy, **kwargs))


class ProjectBoard(SaveMixin, ObjectDeleteMixin, RESTObject):
lists: ProjectBoardListManager
Expand All@@ -77,8 +62,3 @@ class ProjectBoardManager(CRUDMixin, RESTManager):
_obj_cls = ProjectBoard
_from_parent_attrs = {"project_id": "id"}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectBoard:
return cast(ProjectBoard, super().get(id=id, lazy=lazy, **kwargs))
12 changes: 0 additions & 12 deletionsgitlab/v4/objects/branches.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
from typing import Any, cast, Union

from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
CRUDMixin,
Expand DownExpand Up@@ -28,11 +26,6 @@ class ProjectBranchManager(NoUpdateMixin, RESTManager):
_from_parent_attrs = {"project_id": "id"}
_create_attrs = RequiredOptional(required=("branch", "ref"))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectBranch:
return cast(ProjectBranch, super().get(id=id, lazy=lazy, **kwargs))


class ProjectProtectedBranch(SaveMixin, ObjectDeleteMixin, RESTObject):
_id_attr = "name"
Expand All@@ -56,8 +49,3 @@ class ProjectProtectedBranchManager(CRUDMixin, RESTManager):
),
)
_update_method = UpdateMethod.PATCH

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectProtectedBranch:
return cast(ProjectProtectedBranch, super().get(id=id, lazy=lazy, **kwargs))
7 changes: 0 additions & 7 deletionsgitlab/v4/objects/broadcast_messages.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
from typing import Any, cast, Union

from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import ArrayAttribute, RequiredOptional
Expand DownExpand Up@@ -33,8 +31,3 @@ class BroadcastMessageManager(CRUDMixin, RESTManager):
)
)
_types = {"target_access_levels": ArrayAttribute}

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> BroadcastMessage:
return cast(BroadcastMessage, super().get(id=id, lazy=lazy, **kwargs))
10 changes: 0 additions & 10 deletionsgitlab/v4/objects/bulk_imports.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
from typing import Any, cast, Union

from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CreateMixin, ListMixin, RefreshMixin, RetrieveMixin
from gitlab.types import RequiredOptional
Expand All@@ -24,9 +22,6 @@ class BulkImportManager(CreateMixin, RetrieveMixin, RESTManager):
_create_attrs = RequiredOptional(required=("configuration", "entities"))
_list_filters = ("sort", "status")

def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> BulkImport:
return cast(BulkImport, super().get(id=id, lazy=lazy, **kwargs))


class BulkImportEntity(RefreshMixin, RESTObject):
pass
Expand All@@ -38,11 +33,6 @@ class BulkImportEntityManager(RetrieveMixin, RESTManager):
_from_parent_attrs = {"bulk_import_id": "id"}
_list_filters = ("sort", "status")

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> BulkImportEntity:
return cast(BulkImportEntity, super().get(id=id, lazy=lazy, **kwargs))


class BulkImportAllEntity(RESTObject):
pass
Expand Down
5 changes: 1 addition & 4 deletionsgitlab/v4/objects/ci_lint.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@
https://docs.gitlab.com/ee/api/lint.html
"""

from typing import Any, cast
from typing import Any

from gitlab.base import RESTManager, RESTObject
from gitlab.cli import register_custom_action
Expand DownExpand Up@@ -59,9 +59,6 @@ class ProjectCiLintManager(GetWithoutIdMixin, CreateMixin, RESTManager):
required=("content",), optional=("dry_run", "include_jobs", "ref")
)

def get(self, **kwargs: Any) -> ProjectCiLint:
return cast(ProjectCiLint, super().get(**kwargs))

@register_custom_action(
cls_names="ProjectCiLintManager",
required=("content",),
Expand Down
7 changes: 0 additions & 7 deletionsgitlab/v4/objects/cluster_agents.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
from typing import Any, cast, Union

from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional
Expand All@@ -19,8 +17,3 @@ class ProjectClusterAgentManager(NoUpdateMixin, RESTManager):
_obj_cls = ProjectClusterAgent
_from_parent_attrs = {"project_id": "id"}
_create_attrs = RequiredOptional(required=("name",))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectClusterAgent:
return cast(ProjectClusterAgent, super().get(id=id, lazy=lazy, **kwargs))
12 changes: 1 addition & 11 deletionsgitlab/v4/objects/clusters.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
from typing import Any, cast, Dict, Optional, Union
from typing import Any, cast, Dict, Optional

from gitlab import exceptions as exc
from gitlab.base import RESTManager, RESTObject
Expand DownExpand Up@@ -58,11 +58,6 @@ def create(
path = f"{self.path}/user"
return cast(GroupCluster, CreateMixin.create(self, data, path=path, **kwargs))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> GroupCluster:
return cast(GroupCluster, super().get(id=id, lazy=lazy, **kwargs))


class ProjectCluster(SaveMixin, ObjectDeleteMixin, RESTObject):
pass
Expand DownExpand Up@@ -108,8 +103,3 @@ def create(
"""
path = f"{self.path}/user"
return cast(ProjectCluster, CreateMixin.create(self, data, path=path, **kwargs))

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectCluster:
return cast(ProjectCluster, super().get(id=id, lazy=lazy, **kwargs))
5 changes: 0 additions & 5 deletionsgitlab/v4/objects/commits.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,11 +189,6 @@ class ProjectCommitManager(RetrieveMixin, CreateMixin, RESTManager):
"trailers",
)

def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectCommit:
return cast(ProjectCommit, super().get(id=id, lazy=lazy, **kwargs))


class ProjectCommitComment(RESTObject):
_id_attr = None
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp