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

chore: moveRequiredOptional to thegitlab.types module#2039

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
nejch merged 1 commit intomainfromjlvillal/required_optional
May 31, 2022
Merged
Show file tree
Hide file tree
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
14 changes: 3 additions & 11 deletionsgitlab/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,9 +18,8 @@
import importlib
import pprint
import textwrap
from dataclasses import dataclass
from types import ModuleType
from typing import Any, Dict, Iterable, Optional,Tuple,Type, Union
from typing import Any, Dict, Iterable, Optional, Type, Union

import gitlab
from gitlab import types as g_types
Expand All@@ -29,7 +28,6 @@
from .client import Gitlab, GitlabList

__all__ = [
"RequiredOptional",
"RESTObject",
"RESTObjectList",
"RESTManager",
Expand DownExpand Up@@ -330,12 +328,6 @@ def total(self) -> Optional[int]:
return self._list.total


@dataclass(frozen=True)
class RequiredOptional:
required: Tuple[str, ...] = ()
optional: Tuple[str, ...] = ()


class RESTManager:
"""Base class for CRUD operations on objects.

Expand All@@ -345,8 +337,8 @@ class RESTManager:
``_obj_cls``: The class of objects that will be created
"""

_create_attrs: RequiredOptional = RequiredOptional()
_update_attrs: RequiredOptional = RequiredOptional()
_create_attrs:g_types.RequiredOptional =g_types.RequiredOptional()
_update_attrs:g_types.RequiredOptional =g_types.RequiredOptional()
_path: Optional[str] = None
_obj_cls: Optional[Type[RESTObject]] = None
_from_parent_attrs: Dict[str, Any] = {}
Expand Down
9 changes: 8 additions & 1 deletiongitlab/types.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,14 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from typing import Any, Optional, TYPE_CHECKING
import dataclasses
from typing import Any, Optional, Tuple, TYPE_CHECKING


@dataclasses.dataclass(frozen=True)
class RequiredOptional:
required: Tuple[str, ...] = ()
optional: Tuple[str, ...] = ()


class GitlabAttribute:
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/appearance.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
from typing import Any, cast, Dict, Optional, Union

from gitlab import exceptions as exc
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin
from gitlab.types import RequiredOptional

__all__ = [
"ApplicationAppearance",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/applications.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CreateMixin, DeleteMixin, ListMixin, ObjectDeleteMixin
from gitlab.types import RequiredOptional

__all__ = [
"Application",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/award_emojis.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
from typing import Any, cast, Union

from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin
from gitlab.types import RequiredOptional

__all__ = [
"GroupEpicAwardEmoji",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/badges.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
from typing import Any, cast, Union

from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import BadgeRenderMixin, CRUDMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional

__all__ = [
"GroupBadge",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/boards.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
from typing import Any, cast, Union

from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional

__all__ = [
"GroupBoardList",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/branches.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
from typing import Any, cast, Union

from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin
from gitlab.types import RequiredOptional

__all__ = [
"ProjectBranch",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/broadcast_messages.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
from typing import Any, cast, Union

from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional

__all__ = [
"BroadcastMessage",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/clusters.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
from typing import Any, cast, Dict, Optional, Union

from gitlab import exceptions as exc
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CreateMixin, CRUDMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional

__all__ = [
"GroupCluster",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/commits.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,8 +5,9 @@
import gitlab
from gitlab import cli
from gitlab import exceptions as exc
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CreateMixin, ListMixin, RefreshMixin, RetrieveMixin
from gitlab.types import RequiredOptional

from .discussions import ProjectCommitDiscussionManager # noqa: F401

Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/deploy_keys.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,9 @@

from gitlab import cli
from gitlab import exceptions as exc
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional

__all__ = [
"DeployKey",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/deploy_tokens.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
from typing import Any, cast, Union

from gitlab import types
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
CreateMixin,
DeleteMixin,
ListMixin,
ObjectDeleteMixin,
RetrieveMixin,
)
from gitlab.types import RequiredOptional

__all__ = [
"DeployToken",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/deployments.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
from typing import Any, cast, Union

from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CreateMixin, RetrieveMixin, SaveMixin, UpdateMixin
from gitlab.types import RequiredOptional

from .merge_requests import ProjectDeploymentMergeRequestManager # noqa: F401

Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/discussions.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
from typing import Any, cast, Union

from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CreateMixin, RetrieveMixin, SaveMixin, UpdateMixin
from gitlab.types import RequiredOptional

from .notes import ( # noqa: F401
ProjectCommitDiscussionNoteManager,
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/environments.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@

from gitlab import cli
from gitlab import exceptions as exc
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
CreateMixin,
DeleteMixin,
Expand All@@ -13,6 +13,7 @@
SaveMixin,
UpdateMixin,
)
from gitlab.types import RequiredOptional

__all__ = [
"ProjectEnvironment",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/epics.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@

from gitlab import exceptions as exc
from gitlab import types
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
CreateMixin,
CRUDMixin,
Expand All@@ -12,6 +12,7 @@
SaveMixin,
UpdateMixin,
)
from gitlab.types import RequiredOptional

from .events import GroupEpicResourceLabelEventManager # noqa: F401

Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/export_import.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
from typing import Any, cast, Optional, Union

from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CreateMixin, DownloadMixin, GetWithoutIdMixin, RefreshMixin
from gitlab.types import RequiredOptional

__all__ = [
"GroupExport",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/files.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@
from gitlab import cli
from gitlab import exceptions as exc
from gitlab import utils
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
CreateMixin,
DeleteMixin,
Expand All@@ -15,6 +15,7 @@
SaveMixin,
UpdateMixin,
)
from gitlab.types import RequiredOptional

__all__ = [
"ProjectFile",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/geo_nodes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,14 +2,15 @@

from gitlab import cli
from gitlab import exceptions as exc
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
DeleteMixin,
ObjectDeleteMixin,
RetrieveMixin,
SaveMixin,
UpdateMixin,
)
from gitlab.types import RequiredOptional

__all__ = [
"GeoNode",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/groups.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,8 +6,9 @@
from gitlab import cli
from gitlab import exceptions as exc
from gitlab import types
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional

from .access_requests import GroupAccessRequestManager # noqa: F401
from .audit_events import GroupAuditEventManager # noqa: F401
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/hooks.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
from typing import Any, cast, Union

from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import CRUDMixin, NoUpdateMixin, ObjectDeleteMixin, SaveMixin
from gitlab.types import RequiredOptional

__all__ = [
"Hook",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/issues.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@
from gitlab import cli
from gitlab import exceptions as exc
from gitlab import types
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
CreateMixin,
CRUDMixin,
Expand All@@ -18,6 +18,7 @@
TodoMixin,
UserAgentDetailMixin,
)
from gitlab.types import RequiredOptional

from .award_emojis import ProjectIssueAwardEmojiManager # noqa: F401
from .discussions import ProjectIssueDiscussionManager # noqa: F401
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/labels.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from typing import Any, cast, Dict, Optional, Union

from gitlab import exceptions as exc
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
CreateMixin,
DeleteMixin,
Expand All@@ -12,6 +12,7 @@
SubscribableMixin,
UpdateMixin,
)
from gitlab.types import RequiredOptional

__all__ = [
"GroupLabel",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/members.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from typing import Any, cast, Union

from gitlab import types
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
CRUDMixin,
DeleteMixin,
Expand All@@ -10,6 +10,7 @@
RetrieveMixin,
SaveMixin,
)
from gitlab.types import RequiredOptional

__all__ = [
"GroupBillableMember",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/merge_request_approvals.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from typing import Any, cast, Dict, List, Optional, TYPE_CHECKING, Union

from gitlab import exceptions as exc
from gitlab.base importRequiredOptional,RESTManager, RESTObject
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import (
CreateMixin,
DeleteMixin,
Expand All@@ -11,6 +11,7 @@
SaveMixin,
UpdateMixin,
)
from gitlab.types import RequiredOptional

__all__ = [
"ProjectApproval",
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/merge_requests.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,7 @@
from gitlab import cli
from gitlab import exceptions as exc
from gitlab import types
from gitlab.base importRequiredOptional,RESTManager, RESTObject, RESTObjectList
from gitlab.base import RESTManager, RESTObject, RESTObjectList
from gitlab.mixins import (
CRUDMixin,
ListMixin,
Expand All@@ -23,6 +23,7 @@
TimeTrackingMixin,
TodoMixin,
)
from gitlab.types import RequiredOptional

from .award_emojis import ProjectMergeRequestAwardEmojiManager # noqa: F401
from .commits import ProjectCommit, ProjectCommitManager
Expand Down
3 changes: 2 additions & 1 deletiongitlab/v4/objects/milestones.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,8 +3,9 @@
from gitlab import cli
from gitlab import exceptions as exc
from gitlab import types
from gitlab.base importRequiredOptional,RESTManager, RESTObject, RESTObjectList
from gitlab.base import RESTManager, RESTObject, RESTObjectList
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, PromoteMixin, SaveMixin
from gitlab.types import RequiredOptional

from .issues import GroupIssue, GroupIssueManager, ProjectIssue, ProjectIssueManager
from .merge_requests import (
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp