Skip to content

Commit b0faaaa

Browse files
authored
ref(scm): Move protocol definitions to types.py (#111705)
Protocol definitions are expected to be imported by the end-user. They should be in a public module. `types.py` makes the most sense.
1 parent 939e726 commit b0faaaa

File tree

7 files changed

+606
-641
lines changed

7 files changed

+606
-641
lines changed

src/sentry/scm/actions.py

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,20 @@
1313
map_repository_model_to_repository,
1414
)
1515
from sentry.scm.private.ipc import record_count_metric
16-
from sentry.scm.private.provider import (
16+
from sentry.scm.private.rate_limit import RateLimitProvider
17+
from sentry.scm.types import (
1718
ALL_PROTOCOLS,
19+
SHA,
20+
ActionResult,
21+
ArchiveFormat,
22+
ArchiveLink,
23+
BranchName,
24+
BuildConclusion,
25+
BuildStatus,
26+
CheckRun,
27+
CheckRunOutput,
28+
Comment,
29+
Commit,
1830
CompareCommitsProtocol,
1931
CreateBranchProtocol,
2032
CreateCheckRunProtocol,
@@ -38,6 +50,7 @@
3850
DeletePullRequestCommentProtocol,
3951
DeletePullRequestCommentReactionProtocol,
4052
DeletePullRequestReactionProtocol,
53+
FileContent,
4154
GetArchiveLinkProtocol,
4255
GetBranchProtocol,
4356
GetCheckRunProtocol,
@@ -58,34 +71,15 @@
5871
GetPullRequestReactionsProtocol,
5972
GetPullRequestsProtocol,
6073
GetTreeProtocol,
61-
MinimizeCommentProtocol,
62-
Provider,
63-
RequestReviewProtocol,
64-
UpdateBranchProtocol,
65-
UpdateCheckRunProtocol,
66-
UpdatePullRequestProtocol,
67-
)
68-
from sentry.scm.private.rate_limit import RateLimitProvider
69-
from sentry.scm.types import (
70-
SHA,
71-
ActionResult,
72-
ArchiveFormat,
73-
ArchiveLink,
74-
BranchName,
75-
BuildConclusion,
76-
BuildStatus,
77-
CheckRun,
78-
CheckRunOutput,
79-
Comment,
80-
Commit,
81-
FileContent,
8274
GitBlob,
8375
GitCommitObject,
8476
GitRef,
8577
GitTree,
8678
InputTreeEntry,
79+
MinimizeCommentProtocol,
8780
PaginatedActionResult,
8881
PaginationParams,
82+
Provider,
8983
PullRequest,
9084
PullRequestCommit,
9185
PullRequestFile,
@@ -96,12 +90,16 @@
9690
Repository,
9791
RepositoryId,
9892
RequestOptions,
93+
RequestReviewProtocol,
9994
ResourceId,
10095
Review,
10196
ReviewComment,
10297
ReviewCommentInput,
10398
ReviewEvent,
10499
ReviewSide,
100+
UpdateBranchProtocol,
101+
UpdateCheckRunProtocol,
102+
UpdatePullRequestProtocol,
105103
)
106104

107105

src/sentry/scm/private/facade.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
from sentry.scm.private.helpers import exec_provider_fn
88
from sentry.scm.private.ipc import record_count_metric
9-
from sentry.scm.private.provider import ALL_PROTOCOLS, Provider
10-
from sentry.scm.types import Referrer
9+
from sentry.scm.types import ALL_PROTOCOLS, Provider, Referrer
1110

1211

1312
def _delegating_method(name: str) -> Callable[..., Any]:

src/sentry/scm/private/helpers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
from sentry.models.repository import Repository as RepositoryModel
99
from sentry.scm.errors import SCMCodedError, SCMError, SCMUnhandledException
1010
from sentry.scm.private.ipc import record_count_metric
11-
from sentry.scm.private.provider import Provider
1211
from sentry.scm.private.providers.github import GitHubProvider
1312
from sentry.scm.private.providers.gitlab import GitLabProvider
1413
from sentry.scm.private.rate_limit import RateLimitProvider, RedisRateLimitProvider
15-
from sentry.scm.types import ExternalId, ProviderName, Referrer, Repository, RepositoryId
14+
from sentry.scm.types import ExternalId, Provider, ProviderName, Referrer, Repository, RepositoryId
1615

1716

1817
def map_integration_to_provider(

0 commit comments

Comments
 (0)