PyGithub-asyncio 3.0.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- githubasyncio/AccessToken.py +159 -0
- githubasyncio/AdvisoryBase.py +163 -0
- githubasyncio/AdvisoryCredit.py +131 -0
- githubasyncio/AdvisoryCreditDetailed.py +110 -0
- githubasyncio/AdvisoryVulnerability.py +191 -0
- githubasyncio/AdvisoryVulnerabilityPackage.py +93 -0
- githubasyncio/AppAuthentication.py +58 -0
- githubasyncio/ApplicationOAuth.py +200 -0
- githubasyncio/Artifact.py +183 -0
- githubasyncio/Auth.py +560 -0
- githubasyncio/AuthenticatedUser.py +1251 -0
- githubasyncio/Authorization.py +192 -0
- githubasyncio/AuthorizationApplication.py +73 -0
- githubasyncio/Autolink.py +104 -0
- githubasyncio/Branch.py +689 -0
- githubasyncio/BranchProtection.py +224 -0
- githubasyncio/CVSS.py +83 -0
- githubasyncio/CWE.py +75 -0
- githubasyncio/CheckRun.py +315 -0
- githubasyncio/CheckRunAnnotation.py +134 -0
- githubasyncio/CheckRunOutput.py +108 -0
- githubasyncio/CheckSuite.py +319 -0
- githubasyncio/Clones.py +97 -0
- githubasyncio/CodeScanAlert.py +215 -0
- githubasyncio/CodeScanAlertInstance.py +134 -0
- githubasyncio/CodeScanAlertInstanceLocation.py +102 -0
- githubasyncio/CodeScanRule.py +134 -0
- githubasyncio/CodeScanTool.py +94 -0
- githubasyncio/CodeSecurityConfig.py +301 -0
- githubasyncio/CodeSecurityConfigRepository.py +70 -0
- githubasyncio/Commit.py +442 -0
- githubasyncio/CommitCombinedStatus.py +126 -0
- githubasyncio/CommitComment.py +270 -0
- githubasyncio/CommitStats.py +78 -0
- githubasyncio/CommitStatus.py +169 -0
- githubasyncio/Comparison.py +219 -0
- githubasyncio/Consts.py +197 -0
- githubasyncio/ContentFile.py +304 -0
- githubasyncio/Copilot.py +97 -0
- githubasyncio/CopilotSeat.py +132 -0
- githubasyncio/DefaultCodeSecurityConfig.py +93 -0
- githubasyncio/DependabotAlert.py +184 -0
- githubasyncio/DependabotAlertAdvisory.py +82 -0
- githubasyncio/DependabotAlertDependency.py +100 -0
- githubasyncio/DependabotAlertVulnerability.py +85 -0
- githubasyncio/Deployment.py +314 -0
- githubasyncio/DeploymentBranchPolicy.py +102 -0
- githubasyncio/DeploymentStatus.py +201 -0
- githubasyncio/DiscussionBase.py +140 -0
- githubasyncio/DiscussionCommentBase.py +140 -0
- githubasyncio/Download.py +256 -0
- githubasyncio/Enterprise.py +175 -0
- githubasyncio/EnterpriseConsumedLicenses.py +138 -0
- githubasyncio/Environment.py +354 -0
- githubasyncio/EnvironmentDeploymentBranchPolicy.py +87 -0
- githubasyncio/EnvironmentProtectionRule.py +117 -0
- githubasyncio/EnvironmentProtectionRuleReviewer.py +110 -0
- githubasyncio/Event.py +134 -0
- githubasyncio/File.py +142 -0
- githubasyncio/GeneratedReleaseNotes.py +68 -0
- githubasyncio/Gist.py +373 -0
- githubasyncio/GistComment.py +162 -0
- githubasyncio/GistFile.py +106 -0
- githubasyncio/GistHistoryState.py +245 -0
- githubasyncio/GitAuthor.py +94 -0
- githubasyncio/GitBlob.py +123 -0
- githubasyncio/GitCommit.py +208 -0
- githubasyncio/GitCommitVerification.py +103 -0
- githubasyncio/GitObject.py +84 -0
- githubasyncio/GitRef.py +122 -0
- githubasyncio/GitRelease.py +476 -0
- githubasyncio/GitReleaseAsset.py +232 -0
- githubasyncio/GitTag.py +143 -0
- githubasyncio/GitTree.py +113 -0
- githubasyncio/GitTreeElement.py +104 -0
- githubasyncio/GithubApp.py +236 -0
- githubasyncio/GithubException.py +226 -0
- githubasyncio/GithubIntegration.py +365 -0
- githubasyncio/GithubObject.py +910 -0
- githubasyncio/GithubRetry.py +253 -0
- githubasyncio/GitignoreTemplate.py +88 -0
- githubasyncio/GlobalAdvisory.py +141 -0
- githubasyncio/Hook.py +238 -0
- githubasyncio/HookDelivery.py +243 -0
- githubasyncio/HookDescription.py +85 -0
- githubasyncio/HookResponse.py +83 -0
- githubasyncio/InputFileContent.py +63 -0
- githubasyncio/InputGitAuthor.py +71 -0
- githubasyncio/InputGitTreeElement.py +79 -0
- githubasyncio/Installation.py +298 -0
- githubasyncio/InstallationAuthorization.py +138 -0
- githubasyncio/Invitation.py +171 -0
- githubasyncio/Issue.py +955 -0
- githubasyncio/IssueComment.py +309 -0
- githubasyncio/IssueDependenciesSummary.py +77 -0
- githubasyncio/IssueEvent.py +296 -0
- githubasyncio/IssuePullRequest.py +97 -0
- githubasyncio/IssueType.py +123 -0
- githubasyncio/Label.py +186 -0
- githubasyncio/License.py +169 -0
- githubasyncio/MainClass.py +1142 -0
- githubasyncio/Membership.py +154 -0
- githubasyncio/MergedUpstream.py +71 -0
- githubasyncio/Migration.py +281 -0
- githubasyncio/Milestone.py +255 -0
- githubasyncio/NamedEnterpriseUser.py +207 -0
- githubasyncio/NamedUser.py +841 -0
- githubasyncio/Notification.py +182 -0
- githubasyncio/NotificationSubject.py +96 -0
- githubasyncio/Organization.py +2462 -0
- githubasyncio/OrganizationCodeScanAlert.py +65 -0
- githubasyncio/OrganizationCustomProperty.py +215 -0
- githubasyncio/OrganizationDependabotAlert.py +75 -0
- githubasyncio/OrganizationSecret.py +191 -0
- githubasyncio/OrganizationSecretScanAlert.py +112 -0
- githubasyncio/OrganizationVariable.py +141 -0
- githubasyncio/PaginatedList.py +652 -0
- githubasyncio/Path.py +102 -0
- githubasyncio/Permissions.py +113 -0
- githubasyncio/Plan.py +108 -0
- githubasyncio/Project.py +286 -0
- githubasyncio/ProjectCard.py +257 -0
- githubasyncio/ProjectColumn.py +227 -0
- githubasyncio/PublicKey.py +138 -0
- githubasyncio/PullRequest.py +1202 -0
- githubasyncio/PullRequestComment.py +401 -0
- githubasyncio/PullRequestMergeStatus.py +89 -0
- githubasyncio/PullRequestPart.py +110 -0
- githubasyncio/PullRequestReview.py +214 -0
- githubasyncio/Rate.py +123 -0
- githubasyncio/RateLimit.py +210 -0
- githubasyncio/RateLimitOverview.py +104 -0
- githubasyncio/Reaction.py +128 -0
- githubasyncio/Referrer.py +94 -0
- githubasyncio/RepoCodeSecurityConfig.py +93 -0
- githubasyncio/Repository.py +5211 -0
- githubasyncio/RepositoryAdvisory.py +431 -0
- githubasyncio/RepositoryDiscussion.py +221 -0
- githubasyncio/RepositoryDiscussionCategory.py +150 -0
- githubasyncio/RepositoryDiscussionComment.py +159 -0
- githubasyncio/RepositoryKey.py +166 -0
- githubasyncio/RepositoryPreferences.py +82 -0
- githubasyncio/RepositoryRulesetBypassActor.py +75 -0
- githubasyncio/Requester.py +1518 -0
- githubasyncio/RequiredPullRequestReviews.py +269 -0
- githubasyncio/RequiredStatusChecks.py +153 -0
- githubasyncio/Rule.py +134 -0
- githubasyncio/Ruleset.py +292 -0
- githubasyncio/Secret.py +139 -0
- githubasyncio/SecretScanAlert.py +317 -0
- githubasyncio/SecretScanAlertInstance.py +128 -0
- githubasyncio/SecurityAndAnalysis.py +188 -0
- githubasyncio/SecurityAndAnalysisFeature.py +79 -0
- githubasyncio/SelfHostedActionsRunner.py +129 -0
- githubasyncio/SelfHostedActionsRunnerApplication.py +92 -0
- githubasyncio/SelfHostedActionsRunnerJitConfig.py +74 -0
- githubasyncio/SelfHostedActionsRunnerToken.py +118 -0
- githubasyncio/SourceImport.py +260 -0
- githubasyncio/Stargazer.py +88 -0
- githubasyncio/StatsCodeFrequency.py +81 -0
- githubasyncio/StatsCommitActivity.py +86 -0
- githubasyncio/StatsContributor.py +138 -0
- githubasyncio/StatsParticipation.py +78 -0
- githubasyncio/StatsPunchCard.py +76 -0
- githubasyncio/SubIssueSummary.py +70 -0
- githubasyncio/Tag.py +108 -0
- githubasyncio/Team.py +618 -0
- githubasyncio/TeamDiscussion.py +137 -0
- githubasyncio/TimelineEvent.py +164 -0
- githubasyncio/TimelineEventSource.py +81 -0
- githubasyncio/Topic.py +177 -0
- githubasyncio/Traffic.py +95 -0
- githubasyncio/UserKey.py +141 -0
- githubasyncio/Variable.py +155 -0
- githubasyncio/View.py +97 -0
- githubasyncio/Workflow.py +335 -0
- githubasyncio/WorkflowJob.py +253 -0
- githubasyncio/WorkflowRun.py +480 -0
- githubasyncio/WorkflowStep.py +118 -0
- githubasyncio/__init__.py +38 -0
- githubasyncio/compat/__init__.py +52 -0
- githubasyncio/requestlib/__init__.py +29 -0
- pygithub_asyncio-3.0.0b1.dist-info/METADATA +102 -0
- pygithub_asyncio-3.0.0b1.dist-info/RECORD +188 -0
- pygithub_asyncio-3.0.0b1.dist-info/WHEEL +5 -0
- pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING +674 -0
- pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING.LESSER +165 -0
- pygithub_asyncio-3.0.0b1.dist-info/top_level.txt +1 -0
githubasyncio/Commit.py
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
# FILE AUTO GENERATED DO NOT TOUCH
|
|
2
|
+
############################ Copyrights and license ############################
|
|
3
|
+
# #
|
|
4
|
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
5
|
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
|
6
|
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
|
7
|
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
8
|
+
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
|
9
|
+
# Copyright 2014 Andy Casey <acasey@mso.anu.edu.au> #
|
|
10
|
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
11
|
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
|
12
|
+
# Copyright 2016 John Eskew <jeskew@edx.org> #
|
|
13
|
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
|
14
|
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
|
15
|
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
|
16
|
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
|
17
|
+
# Copyright 2020 Danilo Martins <mawkee@gmail.com> #
|
|
18
|
+
# Copyright 2020 Dhruv Manilawala <dhruvmanila@gmail.com> #
|
|
19
|
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
|
20
|
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
|
21
|
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
|
22
|
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
|
23
|
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
24
|
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
|
25
|
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
|
26
|
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
27
|
+
# Copyright 2024 iarspider <iarspider@gmail.com> #
|
|
28
|
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
|
29
|
+
# Copyright 2025 xmo-odoo <xmo@odoo.com> #
|
|
30
|
+
# Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
|
|
31
|
+
# #
|
|
32
|
+
# This file is part of PyGithub. #
|
|
33
|
+
# http://pygithub.readthedocs.io/ #
|
|
34
|
+
# #
|
|
35
|
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
|
36
|
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
|
37
|
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
|
38
|
+
# any later version. #
|
|
39
|
+
# #
|
|
40
|
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
|
41
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
|
42
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
|
43
|
+
# details. #
|
|
44
|
+
# #
|
|
45
|
+
# You should have received a copy of the GNU Lesser General Public License #
|
|
46
|
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
|
47
|
+
# #
|
|
48
|
+
################################################################################
|
|
49
|
+
|
|
50
|
+
from __future__ import annotations
|
|
51
|
+
|
|
52
|
+
import re
|
|
53
|
+
import urllib.parse
|
|
54
|
+
from typing import TYPE_CHECKING, Any
|
|
55
|
+
|
|
56
|
+
import githubasyncio.Branch
|
|
57
|
+
import githubasyncio.CheckRun
|
|
58
|
+
import githubasyncio.CheckSuite
|
|
59
|
+
import githubasyncio.CommitCombinedStatus
|
|
60
|
+
import githubasyncio.CommitComment
|
|
61
|
+
import githubasyncio.CommitStats
|
|
62
|
+
import githubasyncio.CommitStatus
|
|
63
|
+
import githubasyncio.File
|
|
64
|
+
import githubasyncio.GitCommit
|
|
65
|
+
import githubasyncio.NamedUser
|
|
66
|
+
import githubasyncio.PaginatedList
|
|
67
|
+
import githubasyncio.PullRequest
|
|
68
|
+
import githubasyncio.Repository
|
|
69
|
+
from githubasyncio.GithubObject import Attribute, CompletableGithubObjectWithPaginatedProperty, NotSet, Opt, is_optional
|
|
70
|
+
from githubasyncio.PaginatedList import PaginatedList
|
|
71
|
+
|
|
72
|
+
if TYPE_CHECKING:
|
|
73
|
+
from githubasyncio.Branch import Branch
|
|
74
|
+
from githubasyncio.CheckRun import CheckRun
|
|
75
|
+
from githubasyncio.CheckSuite import CheckSuite
|
|
76
|
+
from githubasyncio.CommitCombinedStatus import CommitCombinedStatus
|
|
77
|
+
from githubasyncio.CommitComment import CommitComment
|
|
78
|
+
from githubasyncio.CommitStats import CommitStats
|
|
79
|
+
from githubasyncio.CommitStatus import CommitStatus
|
|
80
|
+
from githubasyncio.File import File
|
|
81
|
+
from githubasyncio.GitCommit import GitCommit
|
|
82
|
+
from githubasyncio.NamedUser import NamedUser
|
|
83
|
+
from githubasyncio.PullRequest import PullRequest
|
|
84
|
+
from githubasyncio.Repository import Repository
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class Commit(CompletableGithubObjectWithPaginatedProperty):
|
|
88
|
+
"""
|
|
89
|
+
This class represents Commits.
|
|
90
|
+
|
|
91
|
+
The reference can be found here
|
|
92
|
+
https://docs.github.com/en/rest/commits/commits#get-a-commit
|
|
93
|
+
|
|
94
|
+
This class has a `paginated property <https://pygithub.readthedocs.io/en/stable/utilities.html#classes-with-paginated-properties>`_.
|
|
95
|
+
For details, see :meth:`Commit.files` or :meth:`Commit.get_files`.
|
|
96
|
+
|
|
97
|
+
The OpenAPI schema can be found at
|
|
98
|
+
|
|
99
|
+
- /components/schemas/branch-short/properties/commit
|
|
100
|
+
- /components/schemas/commit
|
|
101
|
+
- /components/schemas/commit-search-result-item/properties/parents/items
|
|
102
|
+
- /components/schemas/commit/properties/parents/items
|
|
103
|
+
- /components/schemas/short-branch/properties/commit
|
|
104
|
+
- /components/schemas/tag/properties/commit
|
|
105
|
+
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
def _initAttributes(self) -> None:
|
|
109
|
+
super()._initAttributes()
|
|
110
|
+
self._author: Attribute[NamedUser] = NotSet
|
|
111
|
+
self._comments_url: Attribute[str] = NotSet
|
|
112
|
+
self._commit: Attribute[GitCommit] = NotSet
|
|
113
|
+
self._committer: Attribute[NamedUser] = NotSet
|
|
114
|
+
self._files: Attribute[list[File]] = NotSet
|
|
115
|
+
self._html_url: Attribute[str] = NotSet
|
|
116
|
+
self._node_id: Attribute[str] = NotSet
|
|
117
|
+
self._parents: Attribute[list[Commit]] = NotSet
|
|
118
|
+
self._repository: Attribute[Repository] = NotSet
|
|
119
|
+
self._sha: Attribute[str] = NotSet
|
|
120
|
+
self._stats: Attribute[CommitStats] = NotSet
|
|
121
|
+
self._text_matches: Attribute[dict[str, Any]] = NotSet
|
|
122
|
+
|
|
123
|
+
def __repr__(self) -> str:
|
|
124
|
+
return self.get__repr__({"sha": self._sha.value})
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
async def _identity(self) -> str:
|
|
128
|
+
return await self.sha
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
async def author(self) -> NamedUser:
|
|
132
|
+
await self._completeIfNotSet(self._author)
|
|
133
|
+
return self._author.value
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
async def comments_url(self) -> str:
|
|
137
|
+
await self._completeIfNotSet(self._comments_url)
|
|
138
|
+
return self._comments_url.value
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
async def commit(self) -> GitCommit:
|
|
142
|
+
await self._completeIfNotSet(self._commit)
|
|
143
|
+
return self._commit.value
|
|
144
|
+
|
|
145
|
+
@property
|
|
146
|
+
async def committer(self) -> NamedUser:
|
|
147
|
+
await self._completeIfNotSet(self._committer)
|
|
148
|
+
return self._committer.value
|
|
149
|
+
|
|
150
|
+
@property
|
|
151
|
+
async def files(self) -> PaginatedList[File]:
|
|
152
|
+
"""
|
|
153
|
+
This is a `paginated property <https://pygithub.readthedocs.io/en/stable/utilities.html#classes-with-paginated-properties>`_.
|
|
154
|
+
|
|
155
|
+
Iterating over this paginated list may fetch multiple pages. The size of these pages can be controlled via
|
|
156
|
+
the ``…_per_page`` parameter of :meth:`githubasyncio.Repository.Repository.get_commit`,
|
|
157
|
+
:meth:`Commit.get_files`, or :meth:`github.Github`.
|
|
158
|
+
|
|
159
|
+
If no ``per_page`` is given, the default page size is 300. The maximum is 300.
|
|
160
|
+
|
|
161
|
+
At most 3000 files can be retrieved.
|
|
162
|
+
"""
|
|
163
|
+
return PaginatedList(
|
|
164
|
+
githubasyncio.File.File,
|
|
165
|
+
self._requester,
|
|
166
|
+
await self.url,
|
|
167
|
+
self._pagination_parameters,
|
|
168
|
+
list_item="files",
|
|
169
|
+
total_count_item="total_files",
|
|
170
|
+
firstData=(await self.raw_data) if self.completed else None,
|
|
171
|
+
firstHeaders=(await self.raw_headers) if self.completed else None,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
@property
|
|
175
|
+
async def html_url(self) -> str:
|
|
176
|
+
await self._completeIfNotSet(self._html_url)
|
|
177
|
+
return self._html_url.value
|
|
178
|
+
|
|
179
|
+
@property
|
|
180
|
+
async def node_id(self) -> str:
|
|
181
|
+
await self._completeIfNotSet(self._node_id)
|
|
182
|
+
return self._node_id.value
|
|
183
|
+
|
|
184
|
+
@property
|
|
185
|
+
async def parents(self) -> list[Commit]:
|
|
186
|
+
await self._completeIfNotSet(self._parents)
|
|
187
|
+
return self._parents.value
|
|
188
|
+
|
|
189
|
+
@property
|
|
190
|
+
def repository(self) -> Repository:
|
|
191
|
+
# This attribute is not provided by the response, it is extracted from the URL,
|
|
192
|
+
# see _useAttributes(). Hence, no need to trigger _completeIfNotSet.
|
|
193
|
+
return self._repository.value
|
|
194
|
+
|
|
195
|
+
@property
|
|
196
|
+
async def sha(self) -> str:
|
|
197
|
+
await self._completeIfNotSet(self._sha)
|
|
198
|
+
return self._sha.value
|
|
199
|
+
|
|
200
|
+
@property
|
|
201
|
+
async def stats(self) -> CommitStats:
|
|
202
|
+
await self._completeIfNotSet(self._stats)
|
|
203
|
+
return self._stats.value
|
|
204
|
+
|
|
205
|
+
@property
|
|
206
|
+
async def text_matches(self) -> dict[str, Any]:
|
|
207
|
+
await self._completeIfNotSet(self._text_matches)
|
|
208
|
+
return self._text_matches.value
|
|
209
|
+
|
|
210
|
+
async def create_comment(
|
|
211
|
+
self,
|
|
212
|
+
body: str,
|
|
213
|
+
line: Opt[int] = NotSet,
|
|
214
|
+
path: Opt[str] = NotSet,
|
|
215
|
+
position: Opt[int] = NotSet,
|
|
216
|
+
) -> CommitComment:
|
|
217
|
+
"""
|
|
218
|
+
:calls: `POST /repos/{owner}/{repo}/commits/{commit_sha}/comments <https://docs.github.com/en/rest/reference/repos#comments>`_
|
|
219
|
+
"""
|
|
220
|
+
assert isinstance(body, str), body
|
|
221
|
+
assert is_optional(line, int), line
|
|
222
|
+
assert is_optional(path, str), path
|
|
223
|
+
assert is_optional(position, int), position
|
|
224
|
+
post_parameters = NotSet.remove_unset_items({"body": body, "line": line, "path": path, "position": position})
|
|
225
|
+
|
|
226
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
227
|
+
"POST", f"{await self.url}/comments", input=post_parameters
|
|
228
|
+
)
|
|
229
|
+
return githubasyncio.CommitComment.CommitComment(self._requester, headers, data, completed=True)
|
|
230
|
+
|
|
231
|
+
async def create_status(
|
|
232
|
+
self,
|
|
233
|
+
state: str,
|
|
234
|
+
target_url: Opt[str] = NotSet,
|
|
235
|
+
description: Opt[str] = NotSet,
|
|
236
|
+
context: Opt[str] = NotSet,
|
|
237
|
+
) -> CommitStatus:
|
|
238
|
+
"""
|
|
239
|
+
:calls: `POST /repos/{owner}/{repo}/statuses/{sha} <https://docs.github.com/en/rest/reference/repos#statuses>`_
|
|
240
|
+
"""
|
|
241
|
+
assert isinstance(state, str), state
|
|
242
|
+
assert is_optional(target_url, str), target_url
|
|
243
|
+
assert is_optional(description, str), description
|
|
244
|
+
assert is_optional(context, str), context
|
|
245
|
+
post_parameters = NotSet.remove_unset_items(
|
|
246
|
+
{
|
|
247
|
+
"state": state,
|
|
248
|
+
"target_url": target_url,
|
|
249
|
+
"description": description,
|
|
250
|
+
"context": context,
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
255
|
+
"POST",
|
|
256
|
+
f"{self._parentUrl(self._parentUrl(await self.url))}/statuses/{await self.sha}",
|
|
257
|
+
input=post_parameters,
|
|
258
|
+
)
|
|
259
|
+
return githubasyncio.CommitStatus.CommitStatus(self._requester, headers, data)
|
|
260
|
+
|
|
261
|
+
async def get_branches_where_head(self) -> list[Branch]:
|
|
262
|
+
"""
|
|
263
|
+
:calls: `GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head <https://docs.github.com/rest/commits/commits#list-branches-for-head-commit>`_
|
|
264
|
+
"""
|
|
265
|
+
headers, data = await self._requester.requestJsonAndCheck("GET", f"{await self.url}/branches-where-head")
|
|
266
|
+
return [githubasyncio.Branch.Branch(self._requester, headers, item) for item in data]
|
|
267
|
+
|
|
268
|
+
async def get_comments(self) -> PaginatedList[CommitComment]:
|
|
269
|
+
"""
|
|
270
|
+
:calls: `GET /repos/{owner}/{repo}/commits/{commit_sha}/comments <https://docs.github.com/en/rest/reference/repos#comments>`_
|
|
271
|
+
"""
|
|
272
|
+
return PaginatedList(
|
|
273
|
+
githubasyncio.CommitComment.CommitComment,
|
|
274
|
+
self._requester,
|
|
275
|
+
f"{await self.url}/comments",
|
|
276
|
+
None,
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
async def get_files(self, *, commit_files_per_page: int | None = None) -> PaginatedList[File]:
|
|
280
|
+
"""
|
|
281
|
+
:calls: `GET /repos/{owner}/{repo}/commits/{sha} <https://docs.github.com/en/rest/reference/repos#commits>`_
|
|
282
|
+
|
|
283
|
+
Identical to calling :meth:`Commit.files`, except that this uses the given ``per_page`` value.
|
|
284
|
+
|
|
285
|
+
For more details, see :meth:`Commit.files`.
|
|
286
|
+
|
|
287
|
+
:param commit_files_per_page: int Number of files retrieved per page.
|
|
288
|
+
Iterating over the files will fetch pages of this size. The default page size is 300, the maximum is 300.
|
|
289
|
+
At most 3000 files can be retrieved.
|
|
290
|
+
"""
|
|
291
|
+
return PaginatedList(
|
|
292
|
+
githubasyncio.File.File,
|
|
293
|
+
self._requester,
|
|
294
|
+
await self.url,
|
|
295
|
+
self._pagination_parameters_with(page=1, per_page=commit_files_per_page),
|
|
296
|
+
headers=None,
|
|
297
|
+
list_item="files",
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
async def get_statuses(self) -> PaginatedList[CommitStatus]:
|
|
301
|
+
"""
|
|
302
|
+
:calls: `GET /repos/{owner}/{repo}/statuses/{sha} <https://docs.github.com/en/rest/reference/repos#statuses>`_
|
|
303
|
+
"""
|
|
304
|
+
return PaginatedList(
|
|
305
|
+
githubasyncio.CommitStatus.CommitStatus,
|
|
306
|
+
self._requester,
|
|
307
|
+
f"{self._parentUrl(self._parentUrl(await self.url))}/statuses/{await self.sha}",
|
|
308
|
+
None,
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
async def get_combined_status(self) -> CommitCombinedStatus:
|
|
312
|
+
"""
|
|
313
|
+
:calls: `GET /repos/{owner}/{repo}/commits/{ref}/status <http://docs.github.com/en/rest/reference/repos#statuses>`_
|
|
314
|
+
"""
|
|
315
|
+
headers, data = await self._requester.requestJsonAndCheck("GET", f"{await self.url}/status")
|
|
316
|
+
return githubasyncio.CommitCombinedStatus.CommitCombinedStatus(self._requester, headers, data)
|
|
317
|
+
|
|
318
|
+
async def get_pulls(self) -> PaginatedList[PullRequest]:
|
|
319
|
+
"""
|
|
320
|
+
:calls: `GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls <https://docs.github.com/en/rest/reference/repos#list-pull-requests-associated-with-a-commit>`_
|
|
321
|
+
"""
|
|
322
|
+
return PaginatedList(
|
|
323
|
+
githubasyncio.PullRequest.PullRequest,
|
|
324
|
+
self._requester,
|
|
325
|
+
f"{await self.url}/pulls",
|
|
326
|
+
None,
|
|
327
|
+
headers={"Accept": "application/vnd.github.groot-preview+json"},
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
async def get_check_runs(
|
|
331
|
+
self,
|
|
332
|
+
check_name: Opt[str] = NotSet,
|
|
333
|
+
status: Opt[str] = NotSet,
|
|
334
|
+
filter: Opt[str] = NotSet,
|
|
335
|
+
) -> PaginatedList[CheckRun]:
|
|
336
|
+
"""
|
|
337
|
+
:calls: `GET /repos/{owner}/{repo}/commits/{ref}/check-runs <https://docs.github.com/en/rest/reference/checks#list-check-runs-for-a-git-reference>`_
|
|
338
|
+
"""
|
|
339
|
+
assert is_optional(check_name, str), check_name
|
|
340
|
+
assert is_optional(status, str), status
|
|
341
|
+
assert is_optional(filter, str), filter
|
|
342
|
+
url_parameters = NotSet.remove_unset_items({"check_name": check_name, "status": status, "filter": filter})
|
|
343
|
+
|
|
344
|
+
return PaginatedList(
|
|
345
|
+
githubasyncio.CheckRun.CheckRun,
|
|
346
|
+
self._requester,
|
|
347
|
+
f"{await self.url}/check-runs",
|
|
348
|
+
url_parameters,
|
|
349
|
+
headers={"Accept": "application/vnd.github.v3+json"},
|
|
350
|
+
list_item="check_runs",
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
async def get_check_suites(
|
|
354
|
+
self, app_id: Opt[int] = NotSet, check_name: Opt[str] = NotSet
|
|
355
|
+
) -> PaginatedList[CheckSuite]:
|
|
356
|
+
"""
|
|
357
|
+
:class: `GET /repos/{owner}/{repo}/commits/{ref}/check-suites <https://docs.github.com/en/rest/reference/checks#list-check-suites-for-a-git-reference>`_
|
|
358
|
+
"""
|
|
359
|
+
assert is_optional(app_id, int), app_id
|
|
360
|
+
assert is_optional(check_name, str), check_name
|
|
361
|
+
parameters = NotSet.remove_unset_items({"app_id": app_id, "check_name": check_name})
|
|
362
|
+
|
|
363
|
+
request_headers = {"Accept": "application/vnd.github.v3+json"}
|
|
364
|
+
return PaginatedList(
|
|
365
|
+
githubasyncio.CheckSuite.CheckSuite,
|
|
366
|
+
self._requester,
|
|
367
|
+
f"{await self.url}/check-suites",
|
|
368
|
+
parameters,
|
|
369
|
+
headers=request_headers,
|
|
370
|
+
list_item="check_suites",
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
|
374
|
+
super()._useAttributes(attributes)
|
|
375
|
+
if "author" in attributes: # pragma no branch
|
|
376
|
+
self._author = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["author"])
|
|
377
|
+
if "comments_url" in attributes: # pragma no branch
|
|
378
|
+
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
|
379
|
+
if "commit" in attributes: # pragma no branch
|
|
380
|
+
self._commit = self._makeClassAttribute(githubasyncio.GitCommit.GitCommit, attributes["commit"])
|
|
381
|
+
if "committer" in attributes: # pragma no branch
|
|
382
|
+
self._committer = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["committer"])
|
|
383
|
+
if "files" in attributes: # pragma no branch
|
|
384
|
+
self._files = self._makeListOfClassesAttribute(githubasyncio.File.File, attributes["files"])
|
|
385
|
+
if "html_url" in attributes: # pragma no branch
|
|
386
|
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
|
387
|
+
if "node_id" in attributes: # pragma no branch
|
|
388
|
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
|
389
|
+
if "parents" in attributes: # pragma no branch
|
|
390
|
+
self._parents = self._makeListOfClassesAttribute(Commit, attributes["parents"])
|
|
391
|
+
if "sha" in attributes: # pragma no branch
|
|
392
|
+
self._sha = self._makeStringAttribute(attributes["sha"])
|
|
393
|
+
elif "url" in attributes and attributes["url"]:
|
|
394
|
+
quoted_sha = attributes["url"].split("/")[-1]
|
|
395
|
+
sha = urllib.parse.unquote(quoted_sha)
|
|
396
|
+
self._sha = self._makeStringAttribute(sha)
|
|
397
|
+
if "stats" in attributes: # pragma no branch
|
|
398
|
+
self._stats = self._makeClassAttribute(githubasyncio.CommitStats.CommitStats, attributes["stats"])
|
|
399
|
+
if "text_matches" in attributes: # pragma no branch
|
|
400
|
+
self._text_matches = self._makeDictAttribute(attributes["text_matches"])
|
|
401
|
+
|
|
402
|
+
# Only commit search results contain the repository, other commits refer to it via their url:
|
|
403
|
+
# .../repos/{owner}/{repo}/commits/{sha} or .../repos/{owner}/{repo}/git/commits/{sha}
|
|
404
|
+
if self._url.value:
|
|
405
|
+
match = re.fullmatch(r"(.*?/repos/[^/]+/[^/]+)/(?:git/)?commits/[^/]+", self._url.value)
|
|
406
|
+
if match:
|
|
407
|
+
self._repository = self._makeClassAttribute(
|
|
408
|
+
githubasyncio.Repository.Repository, {"url": match.group(1)}
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
class CommitSearchResult(Commit):
|
|
413
|
+
"""
|
|
414
|
+
This class represents CommitSearchResult.
|
|
415
|
+
|
|
416
|
+
The reference can be found here
|
|
417
|
+
https://docs.github.com/en/rest/reference/search#search-commits
|
|
418
|
+
|
|
419
|
+
The OpenAPI schema can be found at
|
|
420
|
+
|
|
421
|
+
- /components/schemas/commit-search-result-item
|
|
422
|
+
|
|
423
|
+
"""
|
|
424
|
+
|
|
425
|
+
def _initAttributes(self) -> None:
|
|
426
|
+
super()._initAttributes()
|
|
427
|
+
self._score: Attribute[float] = NotSet
|
|
428
|
+
|
|
429
|
+
def __repr__(self) -> str:
|
|
430
|
+
return self.get__repr__({"sha": self._sha.value, "score": self._score.value})
|
|
431
|
+
|
|
432
|
+
@property
|
|
433
|
+
async def score(self) -> float:
|
|
434
|
+
await self._completeIfNotSet(self._score)
|
|
435
|
+
return self._score.value
|
|
436
|
+
|
|
437
|
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
|
438
|
+
super()._useAttributes(attributes)
|
|
439
|
+
if "repository" in attributes: # pragma no branch
|
|
440
|
+
self._repository = self._makeClassAttribute(githubasyncio.Repository.Repository, attributes["repository"])
|
|
441
|
+
if "score" in attributes: # pragma no branch
|
|
442
|
+
self._score = self._makeFloatAttribute(attributes["score"])
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# FILE AUTO GENERATED DO NOT TOUCH
|
|
2
|
+
############################ Copyrights and license ############################
|
|
3
|
+
# #
|
|
4
|
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
5
|
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
|
6
|
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
|
7
|
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
8
|
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
9
|
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
|
10
|
+
# Copyright 2016 John Eskew <jeskew@edx.org> #
|
|
11
|
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
|
12
|
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
|
13
|
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
|
14
|
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
|
15
|
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
|
16
|
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
|
17
|
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
|
18
|
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
|
19
|
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
20
|
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
|
21
|
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
|
22
|
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
23
|
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
|
24
|
+
# Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
|
|
25
|
+
# #
|
|
26
|
+
# This file is part of PyGithub. #
|
|
27
|
+
# http://pygithub.readthedocs.io/ #
|
|
28
|
+
# #
|
|
29
|
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
|
30
|
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
|
31
|
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
|
32
|
+
# any later version. #
|
|
33
|
+
# #
|
|
34
|
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
|
35
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
|
36
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
|
37
|
+
# details. #
|
|
38
|
+
# #
|
|
39
|
+
# You should have received a copy of the GNU Lesser General Public License #
|
|
40
|
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
|
41
|
+
# #
|
|
42
|
+
################################################################################
|
|
43
|
+
|
|
44
|
+
from __future__ import annotations
|
|
45
|
+
|
|
46
|
+
from typing import TYPE_CHECKING, Any
|
|
47
|
+
|
|
48
|
+
import githubasyncio.CommitStatus
|
|
49
|
+
import githubasyncio.Repository
|
|
50
|
+
from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet
|
|
51
|
+
|
|
52
|
+
if TYPE_CHECKING:
|
|
53
|
+
from githubasyncio.CommitStatus import CommitStatus
|
|
54
|
+
from githubasyncio.Repository import Repository
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class CommitCombinedStatus(NonCompletableGithubObject):
|
|
58
|
+
"""
|
|
59
|
+
This class represents CommitCombinedStatuses.
|
|
60
|
+
|
|
61
|
+
The reference can be found here
|
|
62
|
+
https://docs.github.com/en/rest/reference/repos#statuses
|
|
63
|
+
|
|
64
|
+
The OpenAPI schema can be found at
|
|
65
|
+
|
|
66
|
+
- /components/schemas/combined-commit-status
|
|
67
|
+
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
def _initAttributes(self) -> None:
|
|
71
|
+
self._commit_url: Attribute[str] = NotSet
|
|
72
|
+
self._repository: Attribute[Repository] = NotSet
|
|
73
|
+
self._sha: Attribute[str] = NotSet
|
|
74
|
+
self._state: Attribute[str] = NotSet
|
|
75
|
+
self._statuses: Attribute[list[CommitStatus]] = NotSet
|
|
76
|
+
self._total_count: Attribute[int] = NotSet
|
|
77
|
+
self._url: Attribute[str] = NotSet
|
|
78
|
+
|
|
79
|
+
def __repr__(self) -> str:
|
|
80
|
+
return self.get__repr__({"sha": self._sha.value, "state": self._state.value})
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def commit_url(self) -> str:
|
|
84
|
+
return self._commit_url.value
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def repository(self) -> Repository:
|
|
88
|
+
return self._repository.value
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def sha(self) -> str:
|
|
92
|
+
return self._sha.value
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def state(self) -> str:
|
|
96
|
+
return self._state.value
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def statuses(self) -> list[CommitStatus]:
|
|
100
|
+
return self._statuses.value
|
|
101
|
+
|
|
102
|
+
@property
|
|
103
|
+
def total_count(self) -> int:
|
|
104
|
+
return self._total_count.value
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def url(self) -> str:
|
|
108
|
+
return self._url.value
|
|
109
|
+
|
|
110
|
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
|
111
|
+
if "commit_url" in attributes: # pragma no branch
|
|
112
|
+
self._commit_url = self._makeStringAttribute(attributes["commit_url"])
|
|
113
|
+
if "repository" in attributes: # pragma no branch
|
|
114
|
+
self._repository = self._makeClassAttribute(githubasyncio.Repository.Repository, attributes["repository"])
|
|
115
|
+
if "sha" in attributes: # pragma no branch
|
|
116
|
+
self._sha = self._makeStringAttribute(attributes["sha"])
|
|
117
|
+
if "state" in attributes: # pragma no branch
|
|
118
|
+
self._state = self._makeStringAttribute(attributes["state"])
|
|
119
|
+
if "statuses" in attributes: # pragma no branch
|
|
120
|
+
self._statuses = self._makeListOfClassesAttribute(
|
|
121
|
+
githubasyncio.CommitStatus.CommitStatus, attributes["statuses"]
|
|
122
|
+
)
|
|
123
|
+
if "total_count" in attributes: # pragma no branch
|
|
124
|
+
self._total_count = self._makeIntAttribute(attributes["total_count"])
|
|
125
|
+
if "url" in attributes: # pragma no branch
|
|
126
|
+
self._url = self._makeStringAttribute(attributes["url"])
|