summaryrefslogtreecommitdiff
path: root/gitlab/v4
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-06-05 19:23:56 +0200
committerGitHub <noreply@github.com>2022-06-05 19:23:56 +0200
commit7a5923c8e77a41cb829a086a903aee4123ca4d14 (patch)
tree9d9129a8016e66ee397bcaab50ef22b08aea3d7e /gitlab/v4
parent61b8beb8bed0a9d7cd30450fefba0dd76c0d35d6 (diff)
parent1324ce1a439befb4620953a4df1f70b74bf70cbd (diff)
downloadgitlab-7a5923c8e77a41cb829a086a903aee4123ca4d14.tar.gz
Merge pull request #2051 from python-gitlab/jlvillal/more_more_pylint
chore: enable more pylint checks
Diffstat (limited to 'gitlab/v4')
-rw-r--r--gitlab/v4/cli.py10
-rw-r--r--gitlab/v4/objects/files.py2
-rw-r--r--gitlab/v4/objects/ldap.py3
-rw-r--r--gitlab/v4/objects/merge_request_approvals.py2
-rw-r--r--gitlab/v4/objects/packages.py4
5 files changed, 13 insertions, 8 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index da203ff..dac6ede 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -377,13 +377,14 @@ def get_dict(
class JSONPrinter:
- def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
+ @staticmethod
+ def display(d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
import json # noqa
print(json.dumps(d))
+ @staticmethod
def display_list(
- self,
data: List[Union[str, gitlab.base.RESTObject]],
fields: List[str],
**kwargs: Any,
@@ -394,7 +395,8 @@ class JSONPrinter:
class YAMLPrinter:
- def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
+ @staticmethod
+ def display(d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
try:
import yaml # noqa
@@ -406,8 +408,8 @@ class YAMLPrinter:
"to use the yaml output feature"
)
+ @staticmethod
def display_list(
- self,
data: List[Union[str, gitlab.base.RESTObject]],
fields: List[str],
**kwargs: Any,
diff --git a/gitlab/v4/objects/files.py b/gitlab/v4/objects/files.py
index 894195c..aa86704 100644
--- a/gitlab/v4/objects/files.py
+++ b/gitlab/v4/objects/files.py
@@ -26,6 +26,8 @@ __all__ = [
class ProjectFile(SaveMixin, ObjectDeleteMixin, RESTObject):
_id_attr = "file_path"
_repr_attr = "file_path"
+ branch: str
+ commit_message: str
file_path: str
manager: "ProjectFileManager"
diff --git a/gitlab/v4/objects/ldap.py b/gitlab/v4/objects/ldap.py
index 4a01061..053cd14 100644
--- a/gitlab/v4/objects/ldap.py
+++ b/gitlab/v4/objects/ldap.py
@@ -49,5 +49,4 @@ class LDAPGroupManager(RESTManager):
obj = self.gitlab.http_list(path, **data)
if isinstance(obj, list):
return [self._obj_cls(self, item) for item in obj]
- else:
- return RESTObjectList(self, self._obj_cls, obj)
+ return RESTObjectList(self, self._obj_cls, obj)
diff --git a/gitlab/v4/objects/merge_request_approvals.py b/gitlab/v4/objects/merge_request_approvals.py
index 36224d1..a22bd2b 100644
--- a/gitlab/v4/objects/merge_request_approvals.py
+++ b/gitlab/v4/objects/merge_request_approvals.py
@@ -168,6 +168,8 @@ class ProjectMergeRequestApprovalRule(SaveMixin, ObjectDeleteMixin, RESTObject):
_id_attr = "approval_rule_id"
_repr_attr = "approval_rule"
id: int
+ approval_rule_id: int
+ merge_request_iid: int
@exc.on_http_error(exc.GitlabUpdateError)
def save(self, **kwargs: Any) -> None:
diff --git a/gitlab/v4/objects/packages.py b/gitlab/v4/objects/packages.py
index 0461bdc..882cb1a 100644
--- a/gitlab/v4/objects/packages.py
+++ b/gitlab/v4/objects/packages.py
@@ -73,8 +73,8 @@ class GenericPackageManager(RESTManager):
try:
with open(path, "rb") as f:
file_data = f.read()
- except OSError:
- raise exc.GitlabUploadError(f"Failed to read package file {path}")
+ except OSError as e:
+ raise exc.GitlabUploadError(f"Failed to read package file {path}") from e
url = f"{self._computed_path}/{package_name}/{package_version}/{file_name}"
server_data = self.gitlab.http_put(url, post_data=file_data, raw=True, **kwargs)