diff options
author | John L. Villalovos <john@sodarock.com> | 2021-11-24 17:43:46 -0800 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-11-24 20:41:36 -0800 |
commit | 308210b3dee15c844cd5db4ddd8c7404bb188990 (patch) | |
tree | 4df88a7a967e209afcf2efea9efc5fd8be358128 /gitlab/v4 | |
parent | ab82fd84ba3cecf766915112dcb46fdfab383e73 (diff) | |
download | gitlab-jlvillal/mypy_strict.tar.gz |
WIP: work on enable mypy 'strict' modejlvillal/mypy_strict
Diffstat (limited to 'gitlab/v4')
-rw-r--r-- | gitlab/v4/objects/files.py | 5 | ||||
-rw-r--r-- | gitlab/v4/objects/keys.py | 2 | ||||
-rw-r--r-- | gitlab/v4/objects/packages.py | 2 | ||||
-rw-r--r-- | gitlab/v4/objects/projects.py | 6 | ||||
-rw-r--r-- | gitlab/v4/objects/users.py | 1 |
5 files changed, 10 insertions, 6 deletions
diff --git a/gitlab/v4/objects/files.py b/gitlab/v4/objects/files.py index ce7317d..fa4d744 100644 --- a/gitlab/v4/objects/files.py +++ b/gitlab/v4/objects/files.py @@ -76,7 +76,10 @@ class ProjectFile(SaveMixin, ObjectDeleteMixin, RESTObject): GitlabAuthenticationError: If authentication is not correct GitlabDeleteError: If the server cannot perform the request """ - file_path = self.get_id().replace("/", "%2F") + id_val = self.get_id() + if TYPE_CHECKING: + assert isinstance(id_val, str) + file_path = id_val.replace("/", "%2F") self.manager.delete(file_path, branch, commit_message, **kwargs) diff --git a/gitlab/v4/objects/keys.py b/gitlab/v4/objects/keys.py index 46f6894..c03dced 100644 --- a/gitlab/v4/objects/keys.py +++ b/gitlab/v4/objects/keys.py @@ -31,4 +31,4 @@ class KeyManager(GetMixin, RESTManager): server_data = self.gitlab.http_get(self.path, **kwargs) if TYPE_CHECKING: assert isinstance(server_data, dict) - return cast(Key, self._obj_cls(self, server_data)) + return self._obj_cls(self, server_data) diff --git a/gitlab/v4/objects/packages.py b/gitlab/v4/objects/packages.py index 0062067..55e45a3 100644 --- a/gitlab/v4/objects/packages.py +++ b/gitlab/v4/objects/packages.py @@ -103,7 +103,7 @@ class GenericPackageManager(RESTManager): package_version: str, file_name: str, streamed: bool = False, - action: Optional[Callable] = None, + action: Optional[Callable[[bytes], None]] = None, chunk_size: int = 1024, **kwargs: Any, ) -> Optional[bytes]: diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py index c5ce717..6fd60f4 100644 --- a/gitlab/v4/objects/projects.py +++ b/gitlab/v4/objects/projects.py @@ -436,7 +436,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO self, wiki: bool = False, streamed: bool = False, - action: Optional[Callable] = None, + action: Optional[Callable[[bytes], None]] = None, chunk_size: int = 1024, **kwargs: Any, ) -> Optional[bytes]: @@ -531,7 +531,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO ref_name: str, job: str, streamed: bool = False, - action: Optional[Callable] = None, + action: Optional[Callable[[bytes], None]] = None, chunk_size: int = 1024, **kwargs: Any, ) -> Optional[bytes]: @@ -574,7 +574,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO artifact_path: str, job: str, streamed: bool = False, - action: Optional[Callable] = None, + action: Optional[Callable[[bytes], None]] = None, chunk_size: int = 1024, **kwargs: Any, ) -> Optional[bytes]: diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py index bf7d283..bced3fc 100644 --- a/gitlab/v4/objects/users.py +++ b/gitlab/v4/objects/users.py @@ -181,6 +181,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject): """ path = f"/users/{self.id}/block" server_data = self.manager.gitlab.http_post(path, **kwargs) + print(type(server_data)) if server_data is True: self._attrs["state"] = "blocked" return server_data |