Skip to content

Commit

Permalink
refactor(api): explicitly export classes for star imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nejch committed Feb 7, 2021
1 parent a5a48ad commit f05c287
Show file tree
Hide file tree
Showing 56 changed files with 557 additions and 9 deletions.
7 changes: 7 additions & 0 deletions gitlab/base.py
Expand Up @@ -18,6 +18,13 @@
import importlib


__all__ = [
"RESTObject",
"RESTObjectList",
"RESTManager",
]


class RESTObject(object):
"""Represents an object built from server data.
Expand Down
25 changes: 25 additions & 0 deletions gitlab/mixins.py
Expand Up @@ -23,6 +23,31 @@
from gitlab import utils


__all__ = [
"GetMixin",
"GetWithoutIdMixin",
"RefreshMixin",
"ListMixin",
"RetrieveMixin",
"CreateMixin",
"UpdateMixin",
"SetMixin",
"DeleteMixin",
"CRUDMixin",
"NoUpdateMixin",
"SaveMixin",
"ObjectDeleteMixin",
"UserAgentDetailMixin",
"AccessRequestMixin",
"DownloadMixin",
"SubscribableMixin",
"TodoMixin",
"TimeTrackingMixin",
"ParticipantsMixin",
"BadgeRenderMixin",
]


class GetMixin(object):
@exc.on_http_error(exc.GitlabGetError)
def get(self, id, lazy=False, **kwargs):
Expand Down
8 changes: 8 additions & 0 deletions gitlab/v4/objects/access_requests.py
Expand Up @@ -2,6 +2,14 @@
from gitlab.mixins import * # noqa


__all__ = [
"GroupAccessRequest",
"GroupAccessRequestManager",
"ProjectAccessRequest",
"ProjectAccessRequestManager",
]


class GroupAccessRequest(AccessRequestMixin, ObjectDeleteMixin, RESTObject):
pass

Expand Down
6 changes: 6 additions & 0 deletions gitlab/v4/objects/appearance.py
Expand Up @@ -3,6 +3,12 @@
from gitlab.mixins import * # noqa


__all__ = [
"ApplicationAppearance",
"ApplicationAppearanceManager",
]


class ApplicationAppearance(SaveMixin, RESTObject):
_id_attr = None

Expand Down
5 changes: 5 additions & 0 deletions gitlab/v4/objects/applications.py
@@ -1,6 +1,11 @@
from gitlab.base import * # noqa
from gitlab.mixins import * # noqa

__all__ = [
"Application",
"ApplicationManager",
]


class Application(ObjectDeleteMixin, RESTObject):
_url = "/applications"
Expand Down
16 changes: 16 additions & 0 deletions gitlab/v4/objects/award_emojis.py
Expand Up @@ -2,6 +2,22 @@
from gitlab.mixins import * # noqa


__all__ = [
"ProjectIssueAwardEmoji",
"ProjectIssueAwardEmojiManager",
"ProjectIssueNoteAwardEmoji",
"ProjectIssueNoteAwardEmojiManager",
"ProjectMergeRequestAwardEmoji",
"ProjectMergeRequestAwardEmojiManager",
"ProjectMergeRequestNoteAwardEmoji",
"ProjectMergeRequestNoteAwardEmojiManager",
"ProjectSnippetAwardEmoji",
"ProjectSnippetAwardEmojiManager",
"ProjectSnippetNoteAwardEmoji",
"ProjectSnippetNoteAwardEmojiManager",
]


class ProjectIssueAwardEmoji(ObjectDeleteMixin, RESTObject):
pass

Expand Down
8 changes: 8 additions & 0 deletions gitlab/v4/objects/badges.py
Expand Up @@ -2,6 +2,14 @@
from gitlab.mixins import * # noqa


__all__ = [
"GroupBadge",
"GroupBadgeManager",
"ProjectBadge",
"ProjectBadgeManager",
]


class GroupBadge(SaveMixin, ObjectDeleteMixin, RESTObject):
pass

Expand Down
12 changes: 12 additions & 0 deletions gitlab/v4/objects/boards.py
Expand Up @@ -2,6 +2,18 @@
from gitlab.mixins import * # noqa


__all__ = [
"GroupBoardList",
"GroupBoardListManager",
"GroupBoard",
"GroupBoardManager",
"ProjectBoardList",
"ProjectBoardListManager",
"ProjectBoard",
"ProjectBoardManager",
]


class GroupBoardList(SaveMixin, ObjectDeleteMixin, RESTObject):
pass

Expand Down
8 changes: 8 additions & 0 deletions gitlab/v4/objects/branches.py
Expand Up @@ -4,6 +4,14 @@
from gitlab.mixins import * # noqa


__all__ = [
"ProjectBranch",
"ProjectBranchManager",
"ProjectProtectedBranch",
"ProjectProtectedBranchManager",
]


class ProjectBranch(ObjectDeleteMixin, RESTObject):
_id_attr = "name"

Expand Down
6 changes: 6 additions & 0 deletions gitlab/v4/objects/broadcast_messages.py
Expand Up @@ -2,6 +2,12 @@
from gitlab.mixins import * # noqa


__all__ = [
"BroadcastMessage",
"BroadcastMessageManager",
]


class BroadcastMessage(SaveMixin, ObjectDeleteMixin, RESTObject):
pass

Expand Down
8 changes: 8 additions & 0 deletions gitlab/v4/objects/clusters.py
Expand Up @@ -3,6 +3,14 @@
from gitlab.mixins import * # noqa


__all__ = [
"GroupCluster",
"GroupClusterManager",
"ProjectCluster",
"ProjectClusterManager",
]


class GroupCluster(SaveMixin, ObjectDeleteMixin, RESTObject):
pass

Expand Down
10 changes: 10 additions & 0 deletions gitlab/v4/objects/commits.py
Expand Up @@ -5,6 +5,16 @@
from .discussions import ProjectCommitDiscussionManager


__all__ = [
"ProjectCommit",
"ProjectCommitManager",
"ProjectCommitComment",
"ProjectCommitCommentManager",
"ProjectCommitStatus",
"ProjectCommitStatusManager",
]


class ProjectCommit(RESTObject):
_short_print_attr = "title"
_managers = (
Expand Down
8 changes: 8 additions & 0 deletions gitlab/v4/objects/container_registry.py
Expand Up @@ -4,6 +4,14 @@
from gitlab.mixins import * # noqa


__all__ = [
"ProjectRegistryRepository",
"ProjectRegistryRepositoryManager",
"ProjectRegistryTag",
"ProjectRegistryTagManager",
]


class ProjectRegistryRepository(ObjectDeleteMixin, RESTObject):
_managers = (("tags", "ProjectRegistryTagManager"),)

Expand Down
10 changes: 10 additions & 0 deletions gitlab/v4/objects/custom_attributes.py
Expand Up @@ -2,6 +2,16 @@
from gitlab.mixins import * # noqa


__all__ = [
"GroupCustomAttribute",
"GroupCustomAttributeManager",
"ProjectCustomAttribute",
"ProjectCustomAttributeManager",
"UserCustomAttribute",
"UserCustomAttributeManager",
]


class GroupCustomAttribute(ObjectDeleteMixin, RESTObject):
_id_attr = "key"

Expand Down
8 changes: 8 additions & 0 deletions gitlab/v4/objects/deploy_keys.py
Expand Up @@ -4,6 +4,14 @@
from gitlab.mixins import * # noqa


__all__ = [
"DeployKey",
"DeployKeyManager",
"ProjectKey",
"ProjectKeyManager",
]


class DeployKey(RESTObject):
pass

Expand Down
10 changes: 10 additions & 0 deletions gitlab/v4/objects/deploy_tokens.py
Expand Up @@ -2,6 +2,16 @@
from gitlab.mixins import * # noqa


__all__ = [
"DeployToken",
"DeployTokenManager",
"GroupDeployToken",
"GroupDeployTokenManager",
"ProjectDeployToken",
"ProjectDeployTokenManager",
]


class DeployToken(ObjectDeleteMixin, RESTObject):
pass

Expand Down
6 changes: 6 additions & 0 deletions gitlab/v4/objects/deployments.py
Expand Up @@ -2,6 +2,12 @@
from gitlab.mixins import * # noqa


__all__ = [
"ProjectDeployment",
"ProjectDeploymentManager",
]


class ProjectDeployment(RESTObject, SaveMixin):
pass

Expand Down
12 changes: 12 additions & 0 deletions gitlab/v4/objects/discussions.py
Expand Up @@ -8,6 +8,18 @@
)


__all__ = [
"ProjectCommitDiscussion",
"ProjectCommitDiscussionManager",
"ProjectIssueDiscussion",
"ProjectIssueDiscussionManager",
"ProjectMergeRequestDiscussion",
"ProjectMergeRequestDiscussionManager",
"ProjectSnippetDiscussion",
"ProjectSnippetDiscussionManager",
]


class ProjectCommitDiscussion(RESTObject):
_managers = (("notes", "ProjectCommitDiscussionNoteManager"),)

Expand Down
6 changes: 6 additions & 0 deletions gitlab/v4/objects/environments.py
Expand Up @@ -4,6 +4,12 @@
from gitlab.mixins import * # noqa


__all__ = [
"ProjectEnvironment",
"ProjectEnvironmentManager",
]


class ProjectEnvironment(SaveMixin, ObjectDeleteMixin, RESTObject):
@cli.register_custom_action("ProjectEnvironment")
@exc.on_http_error(exc.GitlabStopError)
Expand Down
8 changes: 8 additions & 0 deletions gitlab/v4/objects/epics.py
Expand Up @@ -5,6 +5,14 @@
from .events import GroupEpicResourceLabelEventManager


__all__ = [
"GroupEpic",
"GroupEpicManager",
"GroupEpicIssue",
"GroupEpicIssueManager",
]


class GroupEpic(ObjectDeleteMixin, SaveMixin, RESTObject):
_id_attr = "iid"
_managers = (
Expand Down
22 changes: 22 additions & 0 deletions gitlab/v4/objects/events.py
Expand Up @@ -3,6 +3,28 @@
from gitlab.mixins import * # noqa


__all__ = [
"Event",
"EventManager",
"AuditEvent",
"AuditEventManager",
"GroupEpicResourceLabelEvent",
"GroupEpicResourceLabelEventManager",
"ProjectEvent",
"ProjectEventManager",
"ProjectIssueResourceLabelEvent",
"ProjectIssueResourceLabelEventManager",
"ProjectIssueResourceMilestoneEvent",
"ProjectIssueResourceMilestoneEventManager",
"ProjectMergeRequestResourceLabelEvent",
"ProjectMergeRequestResourceLabelEventManager",
"ProjectMergeRequestResourceMilestoneEvent",
"ProjectMergeRequestResourceMilestoneEventManager",
"UserEvent",
"UserEventManager",
]


class Event(RESTObject):
_id_attr = None
_short_print_attr = "target_title"
Expand Down
12 changes: 12 additions & 0 deletions gitlab/v4/objects/export_import.py
Expand Up @@ -2,6 +2,18 @@
from gitlab.mixins import * # noqa


__all__ = [
"GroupExport",
"GroupExportManager",
"GroupImport",
"GroupImportManager",
"ProjectExport",
"ProjectExportManager",
"ProjectImport",
"ProjectImportManager",
]


class GroupExport(DownloadMixin, RESTObject):
_id_attr = None

Expand Down
7 changes: 7 additions & 0 deletions gitlab/v4/objects/features.py
@@ -1,8 +1,15 @@
from gitlab import utils
from gitlab import exceptions as exc
from gitlab.base import * # noqa
from gitlab.mixins import * # noqa


__all__ = [
"Feature",
"FeatureManager",
]


class Feature(ObjectDeleteMixin, RESTObject):
_id_attr = "name"

Expand Down

0 comments on commit f05c287

Please sign in to comment.