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

fix: correct some type-hints in gitlab/mixins.py#1398

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
max-wittig merged 1 commit intopython-gitlab:masterfromJohnVillalovos:jlvillal/mypy_mixins
Apr 20, 2021
Merged
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
50 changes: 26 additions & 24 deletionsgitlab/mixins.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -75,8 +75,8 @@ class GetMixin(_RestManagerBase):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
gitlab: gitlab.Gitlab

Expand DownExpand Up@@ -119,8 +119,8 @@ class GetWithoutIdMixin(_RestManagerBase):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
gitlab: gitlab.Gitlab

Expand DownExpand Up@@ -188,8 +188,8 @@ class ListMixin(_RestManagerBase):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
gitlab: gitlab.Gitlab

Expand DownExpand Up@@ -248,8 +248,8 @@ class RetrieveMixin(ListMixin, GetMixin):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
gitlab: gitlab.Gitlab

Expand All@@ -260,8 +260,8 @@ class CreateMixin(_RestManagerBase):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
gitlab: gitlab.Gitlab

Expand DownExpand Up@@ -328,8 +328,8 @@ class UpdateMixin(_RestManagerBase):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
_update_uses_post: bool = False
gitlab: gitlab.Gitlab
Expand DownExpand Up@@ -422,8 +422,8 @@ class SetMixin(_RestManagerBase):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
gitlab: gitlab.Gitlab

Expand DownExpand Up@@ -456,8 +456,8 @@ class DeleteMixin(_RestManagerBase):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
gitlab: gitlab.Gitlab

Expand DownExpand Up@@ -486,8 +486,8 @@ class CRUDMixin(GetMixin, ListMixin, CreateMixin, UpdateMixin, DeleteMixin):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
gitlab: gitlab.Gitlab

Expand All@@ -498,8 +498,8 @@ class NoUpdateMixin(GetMixin, ListMixin, CreateMixin, DeleteMixin):
_computed_path: Optional[str]
_from_parent_attrs: Dict[str, Any]
_obj_cls: Optional[Type[base.RESTObject]]
_parent = Optional[base.RESTObject]
_parent_attrs = Dict[str, Any]
_parent: Optional[base.RESTObject]
_parent_attrs: Dict[str, Any]
_path: Optional[str]
gitlab: gitlab.Gitlab

Expand All@@ -509,13 +509,12 @@ class NoUpdateMixin(GetMixin, ListMixin, CreateMixin, DeleteMixin):
class SaveMixin(_RestObjectBase):
"""Mixin for RESTObject's that can be updated."""

manager: UpdateMixin

_id_attr: Optional[str]
_attrs: Dict[str, Any]
_module: ModuleType
_parent_attrs: Dict[str, Any]
_updated_attrs: Dict[str, Any]
manager: base.RESTManager

def _get_updated_data(self) -> Dict[str, Any]:
updated_data = {}
Expand DownExpand Up@@ -546,6 +545,8 @@ def save(self, **kwargs: Any) -> None:

# call the manager
obj_id = self.get_id()
if TYPE_CHECKING:
assert isinstance(self.manager, UpdateMixin)
server_data = self.manager.update(obj_id, updated_data, **kwargs)
if server_data is not None:
self._update_attrs(server_data)
Expand All@@ -554,13 +555,12 @@ def save(self, **kwargs: Any) -> None:
class ObjectDeleteMixin(_RestObjectBase):
"""Mixin for RESTObject's that can be deleted."""

manager: DeleteMixin

_id_attr: Optional[str]
_attrs: Dict[str, Any]
_module: ModuleType
_parent_attrs: Dict[str, Any]
_updated_attrs: Dict[str, Any]
manager: base.RESTManager

def delete(self, **kwargs: Any) -> None:
"""Delete the object from the server.
Expand All@@ -572,6 +572,8 @@ def delete(self, **kwargs: Any) -> None:
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: If the server cannot perform the request
"""
if TYPE_CHECKING:
assert isinstance(self.manager, DeleteMixin)
self.manager.delete(self.get_id())


Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp