diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-04-17 17:21:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-17 17:21:51 +0200 |
commit | d1697d4458d40a726fdf2629735deda211be8f38 (patch) | |
tree | 6adfce79726b11f48fc2303f8280d2803f39eac3 /gitlab/v4/objects/projects.py | |
parent | a6d35568fbeb44855469279ea14b6b7d53aac37f (diff) | |
parent | aee1f496c1f414c1e30909767d53ae624fe875e7 (diff) | |
download | gitlab-d1697d4458d40a726fdf2629735deda211be8f38.tar.gz |
Merge pull request #1366 from JohnVillalovos/jlvillal/create_attrs
chore: have _create_attrs & _update_attrs be a namedtuple
Diffstat (limited to 'gitlab/v4/objects/projects.py')
-rw-r--r-- | gitlab/v4/objects/projects.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py index f4de18d..c78c8c9 100644 --- a/gitlab/v4/objects/projects.py +++ b/gitlab/v4/objects/projects.py @@ -1,6 +1,6 @@ from gitlab import cli, types, utils from gitlab import exceptions as exc -from gitlab.base import RESTManager, RESTObject +from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import ( CRUDMixin, CreateMixin, @@ -558,9 +558,8 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO class ProjectManager(CRUDMixin, RESTManager): _path = "/projects" _obj_cls = Project - _create_attrs = ( - tuple(), - ( + _create_attrs = RequiredOptional( + optional=( "name", "path", "namespace_id", @@ -617,9 +616,8 @@ class ProjectManager(CRUDMixin, RESTManager): "packages_enabled", ), ) - _update_attrs = ( - tuple(), - ( + _update_attrs = RequiredOptional( + optional=( "name", "path", "default_branch", @@ -919,7 +917,7 @@ class ProjectForkManager(CreateMixin, ListMixin, RESTManager): "with_issues_enabled", "with_merge_requests_enabled", ) - _create_attrs = (tuple(), ("namespace",)) + _create_attrs = RequiredOptional(optional=("namespace",)) def create(self, data, **kwargs): """Creates a new object. @@ -949,5 +947,7 @@ class ProjectRemoteMirrorManager(ListMixin, CreateMixin, UpdateMixin, RESTManage _path = "/projects/%(project_id)s/remote_mirrors" _obj_cls = ProjectRemoteMirror _from_parent_attrs = {"project_id": "id"} - _create_attrs = (("url",), ("enabled", "only_protected_branches")) - _update_attrs = (tuple(), ("enabled", "only_protected_branches")) + _create_attrs = RequiredOptional( + required=("url",), optional=("enabled", "only_protected_branches") + ) + _update_attrs = RequiredOptional(optional=("enabled", "only_protected_branches")) |