diff options
| author | John L. Villalovos <john@sodarock.com> | 2022-05-31 17:54:59 -0700 |
|---|---|---|
| committer | John L. Villalovos <john@sodarock.com> | 2022-05-31 17:54:59 -0700 |
| commit | 9d629bb97af1e14ce8eb4679092de2393e1e3a05 (patch) | |
| tree | 19c442b982350c63c4077e001562d311062d7180 /gitlab/v4 | |
| parent | 0c5a1213ba3bb3ec4ed5874db4588d21969e9e80 (diff) | |
| download | gitlab-9d629bb97af1e14ce8eb4679092de2393e1e3a05.tar.gz | |
chore: move `utils._validate_attrs` inside `types.RequiredOptional`
Move the `validate_attrs` function to be inside the `RequiredOptional`
class. It makes sense for it to be part of the class as it is working
on data related to the class.
Diffstat (limited to 'gitlab/v4')
| -rw-r--r-- | gitlab/v4/objects/epics.py | 4 | ||||
| -rw-r--r-- | gitlab/v4/objects/files.py | 4 | ||||
| -rw-r--r-- | gitlab/v4/objects/issues.py | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/gitlab/v4/objects/epics.py b/gitlab/v4/objects/epics.py index f9b110b..c92420c 100644 --- a/gitlab/v4/objects/epics.py +++ b/gitlab/v4/objects/epics.py @@ -1,7 +1,7 @@ from typing import Any, cast, Dict, Optional, TYPE_CHECKING, Union from gitlab import exceptions as exc -from gitlab import types, utils +from gitlab import types from gitlab.base import RESTManager, RESTObject from gitlab.mixins import ( CreateMixin, @@ -107,7 +107,7 @@ class GroupEpicIssueManager( """ if TYPE_CHECKING: assert data is not None - utils._validate_attrs(data=data, attributes=self._create_attrs) + self._create_attrs.validate_attrs(data=data) path = f"{self.path}/{data.pop('issue_id')}" server_data = self.gitlab.http_post(path, **kwargs) if TYPE_CHECKING: diff --git a/gitlab/v4/objects/files.py b/gitlab/v4/objects/files.py index b80d129..894195c 100644 --- a/gitlab/v4/objects/files.py +++ b/gitlab/v4/objects/files.py @@ -145,7 +145,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa if TYPE_CHECKING: assert data is not None - utils._validate_attrs(data=data, attributes=self._create_attrs) + self._create_attrs.validate_attrs(data=data) new_data = data.copy() file_path = utils.EncodedId(new_data.pop("file_path")) path = f"{self.path}/{file_path}" @@ -179,7 +179,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa file_path = utils.EncodedId(file_path) data["file_path"] = file_path path = f"{self.path}/{file_path}" - utils._validate_attrs(data=data, attributes=self._update_attrs) + self._update_attrs.validate_attrs(data=data) result = self.gitlab.http_put(path, post_data=data, **kwargs) if TYPE_CHECKING: assert isinstance(result, dict) diff --git a/gitlab/v4/objects/issues.py b/gitlab/v4/objects/issues.py index f4da4b1..736bb5c 100644 --- a/gitlab/v4/objects/issues.py +++ b/gitlab/v4/objects/issues.py @@ -2,7 +2,7 @@ from typing import Any, cast, Dict, Tuple, TYPE_CHECKING, Union from gitlab import cli from gitlab import exceptions as exc -from gitlab import types, utils +from gitlab import types from gitlab.base import RESTManager, RESTObject from gitlab.mixins import ( CreateMixin, @@ -272,7 +272,7 @@ class ProjectIssueLinkManager(ListMixin, CreateMixin, DeleteMixin, RESTManager): GitlabAuthenticationError: If authentication is not correct GitlabCreateError: If the server cannot perform the request """ - utils._validate_attrs(data=data, attributes=self._create_attrs) + self._create_attrs.validate_attrs(data=data) if TYPE_CHECKING: assert self.path is not None server_data = self.gitlab.http_post(self.path, post_data=data, **kwargs) |
