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.
Files changed (188) hide show
  1. githubasyncio/AccessToken.py +159 -0
  2. githubasyncio/AdvisoryBase.py +163 -0
  3. githubasyncio/AdvisoryCredit.py +131 -0
  4. githubasyncio/AdvisoryCreditDetailed.py +110 -0
  5. githubasyncio/AdvisoryVulnerability.py +191 -0
  6. githubasyncio/AdvisoryVulnerabilityPackage.py +93 -0
  7. githubasyncio/AppAuthentication.py +58 -0
  8. githubasyncio/ApplicationOAuth.py +200 -0
  9. githubasyncio/Artifact.py +183 -0
  10. githubasyncio/Auth.py +560 -0
  11. githubasyncio/AuthenticatedUser.py +1251 -0
  12. githubasyncio/Authorization.py +192 -0
  13. githubasyncio/AuthorizationApplication.py +73 -0
  14. githubasyncio/Autolink.py +104 -0
  15. githubasyncio/Branch.py +689 -0
  16. githubasyncio/BranchProtection.py +224 -0
  17. githubasyncio/CVSS.py +83 -0
  18. githubasyncio/CWE.py +75 -0
  19. githubasyncio/CheckRun.py +315 -0
  20. githubasyncio/CheckRunAnnotation.py +134 -0
  21. githubasyncio/CheckRunOutput.py +108 -0
  22. githubasyncio/CheckSuite.py +319 -0
  23. githubasyncio/Clones.py +97 -0
  24. githubasyncio/CodeScanAlert.py +215 -0
  25. githubasyncio/CodeScanAlertInstance.py +134 -0
  26. githubasyncio/CodeScanAlertInstanceLocation.py +102 -0
  27. githubasyncio/CodeScanRule.py +134 -0
  28. githubasyncio/CodeScanTool.py +94 -0
  29. githubasyncio/CodeSecurityConfig.py +301 -0
  30. githubasyncio/CodeSecurityConfigRepository.py +70 -0
  31. githubasyncio/Commit.py +442 -0
  32. githubasyncio/CommitCombinedStatus.py +126 -0
  33. githubasyncio/CommitComment.py +270 -0
  34. githubasyncio/CommitStats.py +78 -0
  35. githubasyncio/CommitStatus.py +169 -0
  36. githubasyncio/Comparison.py +219 -0
  37. githubasyncio/Consts.py +197 -0
  38. githubasyncio/ContentFile.py +304 -0
  39. githubasyncio/Copilot.py +97 -0
  40. githubasyncio/CopilotSeat.py +132 -0
  41. githubasyncio/DefaultCodeSecurityConfig.py +93 -0
  42. githubasyncio/DependabotAlert.py +184 -0
  43. githubasyncio/DependabotAlertAdvisory.py +82 -0
  44. githubasyncio/DependabotAlertDependency.py +100 -0
  45. githubasyncio/DependabotAlertVulnerability.py +85 -0
  46. githubasyncio/Deployment.py +314 -0
  47. githubasyncio/DeploymentBranchPolicy.py +102 -0
  48. githubasyncio/DeploymentStatus.py +201 -0
  49. githubasyncio/DiscussionBase.py +140 -0
  50. githubasyncio/DiscussionCommentBase.py +140 -0
  51. githubasyncio/Download.py +256 -0
  52. githubasyncio/Enterprise.py +175 -0
  53. githubasyncio/EnterpriseConsumedLicenses.py +138 -0
  54. githubasyncio/Environment.py +354 -0
  55. githubasyncio/EnvironmentDeploymentBranchPolicy.py +87 -0
  56. githubasyncio/EnvironmentProtectionRule.py +117 -0
  57. githubasyncio/EnvironmentProtectionRuleReviewer.py +110 -0
  58. githubasyncio/Event.py +134 -0
  59. githubasyncio/File.py +142 -0
  60. githubasyncio/GeneratedReleaseNotes.py +68 -0
  61. githubasyncio/Gist.py +373 -0
  62. githubasyncio/GistComment.py +162 -0
  63. githubasyncio/GistFile.py +106 -0
  64. githubasyncio/GistHistoryState.py +245 -0
  65. githubasyncio/GitAuthor.py +94 -0
  66. githubasyncio/GitBlob.py +123 -0
  67. githubasyncio/GitCommit.py +208 -0
  68. githubasyncio/GitCommitVerification.py +103 -0
  69. githubasyncio/GitObject.py +84 -0
  70. githubasyncio/GitRef.py +122 -0
  71. githubasyncio/GitRelease.py +476 -0
  72. githubasyncio/GitReleaseAsset.py +232 -0
  73. githubasyncio/GitTag.py +143 -0
  74. githubasyncio/GitTree.py +113 -0
  75. githubasyncio/GitTreeElement.py +104 -0
  76. githubasyncio/GithubApp.py +236 -0
  77. githubasyncio/GithubException.py +226 -0
  78. githubasyncio/GithubIntegration.py +365 -0
  79. githubasyncio/GithubObject.py +910 -0
  80. githubasyncio/GithubRetry.py +253 -0
  81. githubasyncio/GitignoreTemplate.py +88 -0
  82. githubasyncio/GlobalAdvisory.py +141 -0
  83. githubasyncio/Hook.py +238 -0
  84. githubasyncio/HookDelivery.py +243 -0
  85. githubasyncio/HookDescription.py +85 -0
  86. githubasyncio/HookResponse.py +83 -0
  87. githubasyncio/InputFileContent.py +63 -0
  88. githubasyncio/InputGitAuthor.py +71 -0
  89. githubasyncio/InputGitTreeElement.py +79 -0
  90. githubasyncio/Installation.py +298 -0
  91. githubasyncio/InstallationAuthorization.py +138 -0
  92. githubasyncio/Invitation.py +171 -0
  93. githubasyncio/Issue.py +955 -0
  94. githubasyncio/IssueComment.py +309 -0
  95. githubasyncio/IssueDependenciesSummary.py +77 -0
  96. githubasyncio/IssueEvent.py +296 -0
  97. githubasyncio/IssuePullRequest.py +97 -0
  98. githubasyncio/IssueType.py +123 -0
  99. githubasyncio/Label.py +186 -0
  100. githubasyncio/License.py +169 -0
  101. githubasyncio/MainClass.py +1142 -0
  102. githubasyncio/Membership.py +154 -0
  103. githubasyncio/MergedUpstream.py +71 -0
  104. githubasyncio/Migration.py +281 -0
  105. githubasyncio/Milestone.py +255 -0
  106. githubasyncio/NamedEnterpriseUser.py +207 -0
  107. githubasyncio/NamedUser.py +841 -0
  108. githubasyncio/Notification.py +182 -0
  109. githubasyncio/NotificationSubject.py +96 -0
  110. githubasyncio/Organization.py +2462 -0
  111. githubasyncio/OrganizationCodeScanAlert.py +65 -0
  112. githubasyncio/OrganizationCustomProperty.py +215 -0
  113. githubasyncio/OrganizationDependabotAlert.py +75 -0
  114. githubasyncio/OrganizationSecret.py +191 -0
  115. githubasyncio/OrganizationSecretScanAlert.py +112 -0
  116. githubasyncio/OrganizationVariable.py +141 -0
  117. githubasyncio/PaginatedList.py +652 -0
  118. githubasyncio/Path.py +102 -0
  119. githubasyncio/Permissions.py +113 -0
  120. githubasyncio/Plan.py +108 -0
  121. githubasyncio/Project.py +286 -0
  122. githubasyncio/ProjectCard.py +257 -0
  123. githubasyncio/ProjectColumn.py +227 -0
  124. githubasyncio/PublicKey.py +138 -0
  125. githubasyncio/PullRequest.py +1202 -0
  126. githubasyncio/PullRequestComment.py +401 -0
  127. githubasyncio/PullRequestMergeStatus.py +89 -0
  128. githubasyncio/PullRequestPart.py +110 -0
  129. githubasyncio/PullRequestReview.py +214 -0
  130. githubasyncio/Rate.py +123 -0
  131. githubasyncio/RateLimit.py +210 -0
  132. githubasyncio/RateLimitOverview.py +104 -0
  133. githubasyncio/Reaction.py +128 -0
  134. githubasyncio/Referrer.py +94 -0
  135. githubasyncio/RepoCodeSecurityConfig.py +93 -0
  136. githubasyncio/Repository.py +5211 -0
  137. githubasyncio/RepositoryAdvisory.py +431 -0
  138. githubasyncio/RepositoryDiscussion.py +221 -0
  139. githubasyncio/RepositoryDiscussionCategory.py +150 -0
  140. githubasyncio/RepositoryDiscussionComment.py +159 -0
  141. githubasyncio/RepositoryKey.py +166 -0
  142. githubasyncio/RepositoryPreferences.py +82 -0
  143. githubasyncio/RepositoryRulesetBypassActor.py +75 -0
  144. githubasyncio/Requester.py +1518 -0
  145. githubasyncio/RequiredPullRequestReviews.py +269 -0
  146. githubasyncio/RequiredStatusChecks.py +153 -0
  147. githubasyncio/Rule.py +134 -0
  148. githubasyncio/Ruleset.py +292 -0
  149. githubasyncio/Secret.py +139 -0
  150. githubasyncio/SecretScanAlert.py +317 -0
  151. githubasyncio/SecretScanAlertInstance.py +128 -0
  152. githubasyncio/SecurityAndAnalysis.py +188 -0
  153. githubasyncio/SecurityAndAnalysisFeature.py +79 -0
  154. githubasyncio/SelfHostedActionsRunner.py +129 -0
  155. githubasyncio/SelfHostedActionsRunnerApplication.py +92 -0
  156. githubasyncio/SelfHostedActionsRunnerJitConfig.py +74 -0
  157. githubasyncio/SelfHostedActionsRunnerToken.py +118 -0
  158. githubasyncio/SourceImport.py +260 -0
  159. githubasyncio/Stargazer.py +88 -0
  160. githubasyncio/StatsCodeFrequency.py +81 -0
  161. githubasyncio/StatsCommitActivity.py +86 -0
  162. githubasyncio/StatsContributor.py +138 -0
  163. githubasyncio/StatsParticipation.py +78 -0
  164. githubasyncio/StatsPunchCard.py +76 -0
  165. githubasyncio/SubIssueSummary.py +70 -0
  166. githubasyncio/Tag.py +108 -0
  167. githubasyncio/Team.py +618 -0
  168. githubasyncio/TeamDiscussion.py +137 -0
  169. githubasyncio/TimelineEvent.py +164 -0
  170. githubasyncio/TimelineEventSource.py +81 -0
  171. githubasyncio/Topic.py +177 -0
  172. githubasyncio/Traffic.py +95 -0
  173. githubasyncio/UserKey.py +141 -0
  174. githubasyncio/Variable.py +155 -0
  175. githubasyncio/View.py +97 -0
  176. githubasyncio/Workflow.py +335 -0
  177. githubasyncio/WorkflowJob.py +253 -0
  178. githubasyncio/WorkflowRun.py +480 -0
  179. githubasyncio/WorkflowStep.py +118 -0
  180. githubasyncio/__init__.py +38 -0
  181. githubasyncio/compat/__init__.py +52 -0
  182. githubasyncio/requestlib/__init__.py +29 -0
  183. pygithub_asyncio-3.0.0b1.dist-info/METADATA +102 -0
  184. pygithub_asyncio-3.0.0b1.dist-info/RECORD +188 -0
  185. pygithub_asyncio-3.0.0b1.dist-info/WHEEL +5 -0
  186. pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING +674 -0
  187. pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING.LESSER +165 -0
  188. pygithub_asyncio-3.0.0b1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,214 @@
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 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
11
+ # Copyright 2017 Aaron Levine <allevin@sandia.gov> #
12
+ # Copyright 2017 Mike Miller <github@mikeage.net> #
13
+ # Copyright 2018 Darragh Bailey <daragh.bailey@gmail.com> #
14
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
15
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
16
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
17
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
18
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
19
+ # Copyright 2021 Claire Johns <42869556+johnsc1@users.noreply.github.com> #
20
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
21
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
22
+ # Copyright 2023 Gael Colas <gael.colas@plus.ai> #
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 2025 Enrico Minack <github@enrico.minack.dev> #
28
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
29
+ # #
30
+ # This file is part of PyGithub. #
31
+ # http://pygithub.readthedocs.io/ #
32
+ # #
33
+ # PyGithub is free software: you can redistribute it and/or modify it under #
34
+ # the terms of the GNU Lesser General Public License as published by the Free #
35
+ # Software Foundation, either version 3 of the License, or (at your option) #
36
+ # any later version. #
37
+ # #
38
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
39
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
40
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
41
+ # details. #
42
+ # #
43
+ # You should have received a copy of the GNU Lesser General Public License #
44
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
45
+ # #
46
+ ################################################################################
47
+
48
+ from __future__ import annotations
49
+
50
+ from datetime import datetime
51
+ from typing import TYPE_CHECKING, Any
52
+
53
+ import githubasyncio.GithubObject
54
+ import githubasyncio.NamedUser
55
+ import githubasyncio.Organization
56
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet
57
+
58
+ if TYPE_CHECKING:
59
+ from githubasyncio.NamedUser import NamedUser
60
+
61
+
62
+ class PullRequestReview(NonCompletableGithubObject):
63
+ """
64
+ This class represents PullRequestReviews.
65
+
66
+ The reference can be found here
67
+ https://docs.github.com/en/rest/reference/pulls#reviews
68
+
69
+ The OpenAPI schema can be found at
70
+
71
+ - /components/schemas/pull-request-review
72
+
73
+ """
74
+
75
+ def _initAttributes(self) -> None:
76
+ self._author_association: Attribute[str] = NotSet
77
+ self._body: Attribute[str] = NotSet
78
+ self._body_html: Attribute[str] = NotSet
79
+ self._body_text: Attribute[str] = NotSet
80
+ self._commit_id: Attribute[str] = NotSet
81
+ self._copilot_code_review_effort: Attribute[str] = NotSet
82
+ self._html_url: Attribute[str] = NotSet
83
+ self._id: Attribute[int] = NotSet
84
+ self._is_copilot_code_review: Attribute[bool] = NotSet
85
+ self._node_id: Attribute[str] = NotSet
86
+ self._pull_request_url: Attribute[str] = NotSet
87
+ self._state: Attribute[str] = NotSet
88
+ self._submitted_at: Attribute[datetime] = NotSet
89
+ self._user: Attribute[NamedUser] = NotSet
90
+
91
+ def __repr__(self) -> str:
92
+ return self.get__repr__({"id": self._id.value, "user": self._user.value})
93
+
94
+ @property
95
+ def author_association(self) -> str:
96
+ return self._author_association.value
97
+
98
+ @property
99
+ def body(self) -> str:
100
+ return self._body.value
101
+
102
+ @property
103
+ def body_html(self) -> str:
104
+ return self._body_html.value
105
+
106
+ @property
107
+ def body_text(self) -> str:
108
+ return self._body_text.value
109
+
110
+ @property
111
+ def commit_id(self) -> str:
112
+ return self._commit_id.value
113
+
114
+ @property
115
+ def copilot_code_review_effort(self) -> str:
116
+ return self._copilot_code_review_effort.value
117
+
118
+ @property
119
+ def html_url(self) -> str:
120
+ return self._html_url.value
121
+
122
+ @property
123
+ def id(self) -> int:
124
+ return self._id.value
125
+
126
+ @property
127
+ def is_copilot_code_review(self) -> bool:
128
+ return self._is_copilot_code_review.value
129
+
130
+ @property
131
+ def node_id(self) -> str:
132
+ return self._node_id.value
133
+
134
+ @property
135
+ def pull_request_url(self) -> str:
136
+ return self._pull_request_url.value
137
+
138
+ @property
139
+ def state(self) -> str:
140
+ return self._state.value
141
+
142
+ @property
143
+ def submitted_at(self) -> datetime:
144
+ return self._submitted_at.value
145
+
146
+ @property
147
+ def user(self) -> NamedUser:
148
+ return self._user.value
149
+
150
+ async def dismiss(self, message: str) -> None:
151
+ """
152
+ :calls: `PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals <https://docs.github.com/en/rest/reference/pulls#reviews>`_
153
+ """
154
+ post_parameters = {"message": message}
155
+ headers, data = await self._requester.requestJsonAndCheck(
156
+ "PUT",
157
+ f"{self.pull_request_url}/reviews/{self.id}/dismissals",
158
+ input=post_parameters,
159
+ )
160
+ self._useAttributes(data)
161
+
162
+ async def delete(self) -> None:
163
+ """
164
+ :calls: `DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} <https://developer.github.com/v3/pulls/reviews/>`_
165
+ """
166
+ headers, data = await self._requester.requestJsonAndCheck(
167
+ "DELETE", f"{self.pull_request_url}/reviews/{self.id}"
168
+ )
169
+
170
+ async def edit(self, body: str) -> None:
171
+ """
172
+ :calls: `PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}
173
+ <https://docs.github.com/en/rest/pulls/reviews#update-a-review-for-a-pull-request>`_
174
+ """
175
+ assert isinstance(body, str), body
176
+ post_parameters = {
177
+ "body": body,
178
+ }
179
+ headers, data = await self._requester.requestJsonAndCheck(
180
+ "PUT",
181
+ f"{self.pull_request_url}/reviews/{self.id}",
182
+ input=post_parameters,
183
+ )
184
+ self._useAttributes(data)
185
+
186
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
187
+ if "author_association" in attributes: # pragma no branch
188
+ self._author_association = self._makeStringAttribute(attributes["author_association"])
189
+ if "body" in attributes: # pragma no branch
190
+ self._body = self._makeStringAttribute(attributes["body"])
191
+ if "body_html" in attributes: # pragma no branch
192
+ self._body_html = self._makeStringAttribute(attributes["body_html"])
193
+ if "body_text" in attributes: # pragma no branch
194
+ self._body_text = self._makeStringAttribute(attributes["body_text"])
195
+ if "commit_id" in attributes: # pragma no branch
196
+ self._commit_id = self._makeStringAttribute(attributes["commit_id"])
197
+ if "copilot_code_review_effort" in attributes: # pragma no branch
198
+ self._copilot_code_review_effort = self._makeStringAttribute(attributes["copilot_code_review_effort"])
199
+ if "html_url" in attributes: # pragma no branch
200
+ self._html_url = self._makeStringAttribute(attributes["html_url"])
201
+ if "id" in attributes: # pragma no branch
202
+ self._id = self._makeIntAttribute(attributes["id"])
203
+ if "is_copilot_code_review" in attributes: # pragma no branch
204
+ self._is_copilot_code_review = self._makeBoolAttribute(attributes["is_copilot_code_review"])
205
+ if "node_id" in attributes: # pragma no branch
206
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
207
+ if "pull_request_url" in attributes: # pragma no branch
208
+ self._pull_request_url = self._makeStringAttribute(attributes["pull_request_url"])
209
+ if "state" in attributes: # pragma no branch
210
+ self._state = self._makeStringAttribute(attributes["state"])
211
+ if "submitted_at" in attributes: # pragma no branch
212
+ self._submitted_at = self._makeDatetimeAttribute(attributes["submitted_at"])
213
+ if "user" in attributes: # pragma no branch
214
+ self._user = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["user"])
githubasyncio/Rate.py ADDED
@@ -0,0 +1,123 @@
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 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
11
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
12
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
13
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
14
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
15
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
16
+ # Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
17
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
18
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
19
+ # Copyright 2023 Nikolay Yurin <yurinnick93@gmail.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
+ # #
25
+ # This file is part of PyGithub. #
26
+ # http://pygithub.readthedocs.io/ #
27
+ # #
28
+ # PyGithub is free software: you can redistribute it and/or modify it under #
29
+ # the terms of the GNU Lesser General Public License as published by the Free #
30
+ # Software Foundation, either version 3 of the License, or (at your option) #
31
+ # any later version. #
32
+ # #
33
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
34
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
35
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
36
+ # details. #
37
+ # #
38
+ # You should have received a copy of the GNU Lesser General Public License #
39
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
40
+ # #
41
+ ################################################################################
42
+
43
+ from __future__ import annotations
44
+
45
+ from datetime import datetime, timezone
46
+ from typing import Any
47
+
48
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet
49
+
50
+
51
+ class Rate(NonCompletableGithubObject):
52
+ """
53
+ This class represents Rates.
54
+
55
+ The reference can be found here
56
+ https://docs.github.com/en/rest/reference/rate-limit
57
+
58
+ The OpenAPI schema can be found at
59
+
60
+ - /components/schemas/rate-limit
61
+
62
+ """
63
+
64
+ def _initAttributes(self) -> None:
65
+ self._limit: Attribute[int] = NotSet
66
+ self._remaining: Attribute[int] = NotSet
67
+ self._reset: Attribute[datetime] = NotSet
68
+ self._resource: Attribute[str] = NotSet
69
+ self._used: Attribute[int] = NotSet
70
+
71
+ def __repr__(self) -> str:
72
+ return self.get__repr__(
73
+ {
74
+ "limit": self._limit.value,
75
+ "remaining": self._remaining.value,
76
+ "reset": self._reset.value,
77
+ }
78
+ )
79
+
80
+ @property
81
+ def limit(self) -> int:
82
+ return self._limit.value
83
+
84
+ @property
85
+ def remaining(self) -> int:
86
+ return self._remaining.value
87
+
88
+ @property
89
+ def reset(self) -> datetime:
90
+ return self._reset.value
91
+
92
+ @property
93
+ def resets_in_seconds(self) -> float:
94
+ """
95
+ Seconds until this rate limit resets, which is zero if the reset time has already passed.
96
+
97
+ This is safe to be used with ``time.sleep``.
98
+
99
+ """
100
+ return max(0.0, (self.reset - datetime.now(timezone.utc)).total_seconds())
101
+
102
+ @property
103
+ def resource(self) -> str | None:
104
+ """
105
+ Name of the rate limit resource, ``None`` if not known.
106
+ """
107
+ return self._resource.value
108
+
109
+ @property
110
+ def used(self) -> int:
111
+ return self._used.value
112
+
113
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
114
+ if "limit" in attributes: # pragma no branch
115
+ self._limit = self._makeIntAttribute(attributes["limit"])
116
+ if "remaining" in attributes: # pragma no branch
117
+ self._remaining = self._makeIntAttribute(attributes["remaining"])
118
+ if "reset" in attributes: # pragma no branch
119
+ self._reset = self._makeTimestampAttribute(attributes["reset"])
120
+ if "resource" in attributes: # pragma no branch
121
+ self._resource = self._makeStringAttribute(attributes["resource"])
122
+ if "used" in attributes: # pragma no branch
123
+ self._used = self._makeIntAttribute(attributes["used"])
@@ -0,0 +1,210 @@
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 Vincent Jacques <vincent@vincent-jacques.net> #
7
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
8
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
9
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
10
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
11
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
12
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
13
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
14
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
15
+ # Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
16
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
17
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
18
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
19
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
20
+ # Copyright 2024 Bill Napier <napier@pobox.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.Rate
49
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet
50
+
51
+ if TYPE_CHECKING:
52
+ from githubasyncio.Rate import Rate
53
+
54
+
55
+ class RateLimit(NonCompletableGithubObject):
56
+ """
57
+ This class represents RateLimits.
58
+
59
+ The reference can be found here
60
+ https://docs.github.com/en/rest/reference/rate-limit
61
+
62
+ The OpenAPI schema can be found at
63
+
64
+ - /components/schemas/rate-limit-overview/properties/resources
65
+
66
+ """
67
+
68
+ def _initAttributes(self) -> None:
69
+ self._actions_runner_registration: Attribute[Rate] = NotSet
70
+ self._code_scanning_autofix: Attribute[Rate] = NotSet
71
+ self._code_scanning_upload: Attribute[Rate] = NotSet
72
+ self._code_search: Attribute[Rate] = NotSet
73
+ self._copilot_usage_records: Attribute[Rate] = NotSet
74
+ self._core: Attribute[Rate] = NotSet
75
+ self._dependency_sbom: Attribute[Rate] = NotSet
76
+ self._dependency_snapshots: Attribute[Rate] = NotSet
77
+ self._graphql: Attribute[Rate] = NotSet
78
+ self._integration_manifest: Attribute[Rate] = NotSet
79
+ self._scim: Attribute[Rate] = NotSet
80
+ self._search: Attribute[Rate] = NotSet
81
+ self._source_import: Attribute[Rate] = NotSet
82
+
83
+ def __repr__(self) -> str:
84
+ return self.get__repr__({"core": self._core.value})
85
+
86
+ @property
87
+ def actions_runner_registration(self) -> Rate:
88
+ """
89
+ Rate limit for registering self-hosted runners in GitHub Actions.
90
+ """
91
+ return self._actions_runner_registration.value
92
+
93
+ @property
94
+ def code_scanning_autofix(self) -> Rate:
95
+ return self._code_scanning_autofix.value
96
+
97
+ @property
98
+ def code_scanning_upload(self) -> Rate:
99
+ """
100
+ Rate limit for uploading SARIF results to code scanning.
101
+ """
102
+ return self._code_scanning_upload.value
103
+
104
+ @property
105
+ def code_search(self) -> Rate:
106
+ """
107
+ Rate limit for the REST API for searching code.
108
+ """
109
+ return self._code_search.value
110
+
111
+ @property
112
+ def copilot_usage_records(self) -> Rate:
113
+ return self._copilot_usage_records.value
114
+
115
+ @property
116
+ def core(self) -> Rate:
117
+ """
118
+ Rate limit for the non-search-related API.
119
+ """
120
+ return self._core.value
121
+
122
+ @property
123
+ def dependency_sbom(self) -> Rate:
124
+ return self._dependency_sbom.value
125
+
126
+ @property
127
+ def dependency_snapshots(self) -> Rate:
128
+ """
129
+ Rate limit for submitting snapshots to the dependency graph.
130
+ """
131
+ return self._dependency_snapshots.value
132
+
133
+ @property
134
+ def graphql(self) -> Rate:
135
+ """
136
+ (Experimental) Rate limit for GraphQL API, use with caution.
137
+ """
138
+ return self._graphql.value
139
+
140
+ @property
141
+ def integration_manifest(self) -> Rate:
142
+ """
143
+ Rate limit for POST /app-manifests/{code}/conversions operation.
144
+ """
145
+ return self._integration_manifest.value
146
+
147
+ @property
148
+ def scim(self) -> Rate:
149
+ return self._scim.value
150
+
151
+ @property
152
+ def search(self) -> Rate:
153
+ """
154
+ Rate limit for the Search API.
155
+ """
156
+ return self._search.value
157
+
158
+ @property
159
+ def source_import(self) -> Rate:
160
+ return self._source_import.value
161
+
162
+ def get_rate_limit(self, resource: str) -> Rate | None:
163
+ """
164
+ Rate limit of the given resource, ``None`` if that is not known.
165
+
166
+ This also provides resources that have no property in this class. It does not send any request.
167
+
168
+ :param resource: name of the rate limit resource, e.g. ``core``
169
+
170
+ """
171
+ attribute: Attribute[Rate] = (
172
+ self._makeRateAttribute(self._rawData, resource) if resource in self._rawData else NotSet
173
+ )
174
+ return attribute.value
175
+
176
+ def _makeRateAttribute(self, attributes: dict[str, Any], resource: str) -> Attribute[Rate]:
177
+ value = attributes[resource]
178
+ if isinstance(value, dict):
179
+ # inject into a copy, so that raw_data of this object remains the API response,
180
+ # a resource provided by the API response takes precedence
181
+ value = {"resource": resource, **value}
182
+ return self._makeClassAttribute(githubasyncio.Rate.Rate, value)
183
+
184
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
185
+ if "actions_runner_registration" in attributes: # pragma no branch
186
+ self._actions_runner_registration = self._makeRateAttribute(attributes, "actions_runner_registration")
187
+ if "code_scanning_autofix" in attributes: # pragma no branch
188
+ self._code_scanning_autofix = self._makeRateAttribute(attributes, "code_scanning_autofix")
189
+ if "code_scanning_upload" in attributes: # pragma no branch
190
+ self._code_scanning_upload = self._makeRateAttribute(attributes, "code_scanning_upload")
191
+ if "code_search" in attributes: # pragma no branch
192
+ self._code_search = self._makeRateAttribute(attributes, "code_search")
193
+ if "copilot_usage_records" in attributes: # pragma no branch
194
+ self._copilot_usage_records = self._makeRateAttribute(attributes, "copilot_usage_records")
195
+ if "core" in attributes: # pragma no branch
196
+ self._core = self._makeRateAttribute(attributes, "core")
197
+ if "dependency_sbom" in attributes: # pragma no branch
198
+ self._dependency_sbom = self._makeRateAttribute(attributes, "dependency_sbom")
199
+ if "dependency_snapshots" in attributes: # pragma no branch
200
+ self._dependency_snapshots = self._makeRateAttribute(attributes, "dependency_snapshots")
201
+ if "graphql" in attributes: # pragma no branch
202
+ self._graphql = self._makeRateAttribute(attributes, "graphql")
203
+ if "integration_manifest" in attributes: # pragma no branch
204
+ self._integration_manifest = self._makeRateAttribute(attributes, "integration_manifest")
205
+ if "scim" in attributes: # pragma no branch
206
+ self._scim = self._makeRateAttribute(attributes, "scim")
207
+ if "search" in attributes: # pragma no branch
208
+ self._search = self._makeRateAttribute(attributes, "search")
209
+ if "source_import" in attributes: # pragma no branch
210
+ self._source_import = self._makeRateAttribute(attributes, "source_import")
@@ -0,0 +1,104 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
5
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
6
+ # Copyright 2024 Thomas Cooper <coopernetes@proton.me> #
7
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
8
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
9
+ # #
10
+ # This file is part of PyGithub. #
11
+ # http://pygithub.readthedocs.io/ #
12
+ # #
13
+ # PyGithub is free software: you can redistribute it and/or modify it under #
14
+ # the terms of the GNU Lesser General Public License as published by the Free #
15
+ # Software Foundation, either version 3 of the License, or (at your option) #
16
+ # any later version. #
17
+ # #
18
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
19
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
20
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
21
+ # details. #
22
+ # #
23
+ # You should have received a copy of the GNU Lesser General Public License #
24
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
25
+ # #
26
+ ################################################################################
27
+
28
+ from __future__ import annotations
29
+
30
+ from typing import TYPE_CHECKING, Any
31
+
32
+ import githubasyncio.Rate
33
+ import githubasyncio.RateLimit
34
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet
35
+
36
+ if TYPE_CHECKING:
37
+ from githubasyncio.Rate import Rate
38
+ from githubasyncio.RateLimit import RateLimit
39
+
40
+
41
+ class RateLimitOverview(NonCompletableGithubObject):
42
+ """
43
+ This class represents RateLimitOverview.
44
+
45
+ The reference can be found here
46
+ https://docs.github.com/en/rest/reference/rate-limit
47
+
48
+ The OpenAPI schema can be found at
49
+
50
+ - /components/schemas/rate-limit-overview
51
+
52
+ """
53
+
54
+ def _initAttributes(self) -> None:
55
+ self._rate: Attribute[Rate] = NotSet
56
+ self._resources: Attribute[RateLimit] = NotSet
57
+ self._url: Attribute[str] = NotSet
58
+
59
+ def __repr__(self) -> str:
60
+ return self.get__repr__({"rate": self._rate.value})
61
+
62
+ @property
63
+ def rate(self) -> Rate:
64
+ return self._rate.value
65
+
66
+ @property
67
+ def resources(self) -> RateLimit:
68
+ return self._resources.value
69
+
70
+ @property
71
+ def url(self) -> str:
72
+ return self._url.value
73
+
74
+ def get_rate_limit(self, resource: str) -> Rate | None:
75
+ """
76
+ Rate limit of the given resource, ``None`` if that is not known.
77
+
78
+ This also provides resources that have no property in :class:`githubasyncio.RateLimit.RateLimit`. It does not send any
79
+ request.
80
+
81
+ :param resource: name of the rate limit resource, e.g. ``core``
82
+
83
+ """
84
+ return self.resources.get_rate_limit(resource)
85
+
86
+ async def update(self) -> RateLimitOverview:
87
+ """
88
+ Fetch all rate limits. This object does not change, they are returned as a new object.
89
+
90
+ This updates the respective values provided by :attr:`githubasyncio.GithubObject.GithubObject.current_rate_limits`.
91
+
92
+ :calls: `GET /rate_limit <https://docs.github.com/en/rest/reference/rate-limit>`_
93
+ :return: current rate limits
94
+
95
+ """
96
+ return await self._requester.get_rate_limits()
97
+
98
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
99
+ if "rate" in attributes: # pragma no branch
100
+ self._rate = self._makeClassAttribute(githubasyncio.Rate.Rate, attributes["rate"])
101
+ if "resources" in attributes: # pragma no branch
102
+ self._resources = self._makeClassAttribute(githubasyncio.RateLimit.RateLimit, attributes["resources"])
103
+ if "url" in attributes: # pragma no branch
104
+ self._url = self._makeStringAttribute(attributes["url"])