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,253 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
5
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
6
+ # Copyright 2023 Patryk Szulczyk <therealsoulcheck@gmail.com> #
7
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
8
+ # Copyright 2024 Austin Sasko <austintyler0239@yahoo.com> #
9
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
10
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
11
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
12
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
13
+ # Copyright 2026 Tanishk <tanishk7531@gmail.com> #
14
+ # #
15
+ # This file is part of PyGithub. #
16
+ # http://pygithub.readthedocs.io/ #
17
+ # #
18
+ # PyGithub is free software: you can redistribute it and/or modify it under #
19
+ # the terms of the GNU Lesser General Public License as published by the Free #
20
+ # Software Foundation, either version 3 of the License, or (at your option) #
21
+ # any later version. #
22
+ # #
23
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
24
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
25
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
26
+ # details. #
27
+ # #
28
+ # You should have received a copy of the GNU Lesser General Public License #
29
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
30
+ # #
31
+ ################################################################################
32
+
33
+ from __future__ import annotations
34
+
35
+ import json
36
+ import logging
37
+ from datetime import datetime, timezone
38
+ from logging import Logger
39
+ from types import TracebackType
40
+ from typing import Any
41
+
42
+ from githubasyncio.compat import Self
43
+ from githubasyncio.GithubException import GithubException, RateLimitExceededExceedsMaxWait
44
+ from githubasyncio.Requester import Requester
45
+ from githubasyncio.requestlib import CaseInsensitiveDict, Response, Retry, urllib3, utils
46
+
47
+ DEFAULT_SECONDARY_RATE_WAIT: int = 60
48
+
49
+
50
+ class GithubRetry(Retry):
51
+ """
52
+ A Github-specific implementation of `urllib3.Retry`
53
+
54
+ This retries 403 responses if they are retry-able. Github requests are retry-able when
55
+ the response provides a `"Retry-After"` header, or the content indicates a rate limit error.
56
+
57
+ By default, response codes 403, and 500 up to 599 are retried. This can be configured
58
+ via the `status_forcelist` argument.
59
+
60
+ By default, all methods defined in `Retry.DEFAULT_ALLOWED_METHODS` are retried, plus GET and POST.
61
+ This can be configured via the `allowed_methods` argument.
62
+
63
+ """
64
+
65
+ __logger: Logger | None = None
66
+
67
+ # used to mock datetime, mock.patch("GithubRetry.date") does not work as this
68
+ # references the class, not the module (due to re-exporting in github/__init__.py)
69
+ __datetime = datetime
70
+
71
+ def __init__(
72
+ self,
73
+ secondary_rate_wait: float = DEFAULT_SECONDARY_RATE_WAIT,
74
+ max_rate_limit_wait: float | None = None,
75
+ **kwargs: Any,
76
+ ) -> None:
77
+ """
78
+ :param secondary_rate_wait: seconds to wait before retrying secondary rate limit errors
79
+ :param max_rate_limit_wait: maximum seconds to wait for a primary or secondary rate limit reset;
80
+ if the required backoff would exceed this, raises
81
+ :class:`~githubasyncio.GithubException.RateLimitExceededExceedsMaxWait` instead of waiting.
82
+ Note that ``max_rate_limit_wait < secondary_rate_wait`` causes any secondary rate limit error to raise an exception and never wait.
83
+ ``None`` (the default) means no cap is applied.
84
+ :param kwargs: see urllib3.Retry for more arguments
85
+ """
86
+ self.secondary_rate_wait = secondary_rate_wait
87
+ self.max_rate_limit_wait = max_rate_limit_wait
88
+ # 403 is too broad to be retried, but GitHub API signals rate limits via 403
89
+ # we retry 403 and look into the response header via Retry.increment
90
+ # to determine if we really retry that 403
91
+ kwargs["status_forcelist"] = kwargs.get("status_forcelist", list(range(500, 600))) + [403]
92
+ kwargs["allowed_methods"] = kwargs.get("allowed_methods", Retry.DEFAULT_ALLOWED_METHODS.union({"GET", "POST"}))
93
+ super().__init__(**kwargs)
94
+
95
+ def new(self, **kw: Any) -> Self:
96
+ kw.update(dict(secondary_rate_wait=self.secondary_rate_wait, max_rate_limit_wait=self.max_rate_limit_wait))
97
+ return super().new(**kw) # type: ignore
98
+
99
+ def increment( # type: ignore[override]
100
+ self,
101
+ method: str | None = None,
102
+ url: str | None = None,
103
+ response: urllib3.response.HTTPResponse | None = None, # type: ignore[override]
104
+ error: Exception | None = None,
105
+ _pool: urllib3.ConnectionPool | None = None,
106
+ _stacktrace: TracebackType | None = None,
107
+ ) -> Retry:
108
+ if response:
109
+ # we retry 403 only when there is a Retry-After header (indicating it is retry-able)
110
+ # or the body message does imply a rate limit error
111
+ if response.status == 403:
112
+ self.__log(
113
+ logging.INFO,
114
+ f"Request {method} {url} failed with {response.status}: {response.reason}",
115
+ )
116
+ if "Retry-After" in response.headers:
117
+ # Sleeping 'Retry-After' seconds is implemented in urllib3.Retry.sleep() and called by urllib3
118
+ self.__log(
119
+ logging.INFO,
120
+ f"Retrying after {response.headers.get('Retry-After')} seconds",
121
+ )
122
+ else:
123
+ content = response.reason
124
+
125
+ # to identify retry-able methods, we inspect the response body
126
+ try:
127
+ content = self.get_content(response, url) # type: ignore
128
+ content = json.loads(content) # type: ignore
129
+ message = content.get("message") # type: ignore
130
+ except Exception as e:
131
+ # we want to fall back to the actual github exception (probably a rate limit error)
132
+ # but provide some context why we could not deal with it without another exception
133
+ try:
134
+ raise RuntimeError("Failed to inspect response message") from e
135
+ except RuntimeError as e:
136
+ raise GithubException(response.status, content or response.reason, response.headers) from e # type: ignore
137
+
138
+ try:
139
+ if Requester.isRateLimitError(message):
140
+ rate_type = "primary" if Requester.isPrimaryRateLimitError(message) else "secondary"
141
+ self.__log(
142
+ logging.DEBUG,
143
+ f"Response body indicates retry-able {rate_type} rate limit error: {message}",
144
+ )
145
+
146
+ # check early that we are retrying at all
147
+ retry = super().increment(method, url, response, error, _pool, _stacktrace)
148
+
149
+ # we backoff primary rate limit at least until X-RateLimit-Reset,
150
+ # we backoff secondary rate limit at for secondary_rate_wait seconds
151
+ backoff = 0.0
152
+
153
+ if Requester.isPrimaryRateLimitError(message):
154
+ if "X-RateLimit-Reset" in response.headers:
155
+ value = response.headers.get("X-RateLimit-Reset")
156
+ if value and value.isdigit():
157
+ reset = self.__datetime.fromtimestamp(int(value), timezone.utc)
158
+ delta = reset - self.__datetime.now(timezone.utc)
159
+ resetBackoff = delta.total_seconds()
160
+
161
+ if resetBackoff > 0:
162
+ self.__log(
163
+ logging.DEBUG,
164
+ f"Reset occurs in {str(delta)} ({value} / {reset})",
165
+ )
166
+
167
+ # plus 1s as it is not clear when in that second the reset occurs
168
+ backoff = resetBackoff + 1
169
+ else:
170
+ backoff = self.secondary_rate_wait
171
+ if self.max_rate_limit_wait is not None and backoff > self.max_rate_limit_wait:
172
+ self.__log(
173
+ logging.INFO,
174
+ f"Required backoff of {backoff}s exceeds "
175
+ f"max_rate_limit_wait of {self.max_rate_limit_wait}s".replace(".0s", "s"),
176
+ )
177
+ raise RateLimitExceededExceedsMaxWait(
178
+ response.status, # type: ignore
179
+ content, # type: ignore
180
+ response.headers, # type: ignore
181
+ wait=backoff,
182
+ )
183
+
184
+ # we backoff at least retry's next backoff
185
+ retry_backoff = retry.get_backoff_time()
186
+ if retry_backoff > backoff:
187
+ if backoff > 0:
188
+ self.__log(
189
+ logging.DEBUG,
190
+ f"Retry backoff of {retry_backoff}s exceeds "
191
+ f"required rate limit backoff of {backoff}s".replace(".0s", "s"),
192
+ )
193
+ backoff = retry_backoff
194
+
195
+ def get_backoff_time() -> float:
196
+ return backoff
197
+
198
+ self.__log(
199
+ logging.INFO,
200
+ f"Setting next backoff to {backoff}s".replace(".0s", "s"),
201
+ )
202
+ retry.get_backoff_time = get_backoff_time # type: ignore
203
+ return retry
204
+
205
+ self.__log(
206
+ logging.DEBUG,
207
+ "Response message does not indicate retry-able error",
208
+ )
209
+ raise Requester.createException(response.status, response.headers, content) # type: ignore
210
+ except (urllib3.exceptions.MaxRetryError, GithubException):
211
+ raise
212
+ except Exception as e:
213
+ # we want to fall back to the actual github exception (probably a rate limit error)
214
+ # but provide some context why we could not deal with it without another exception
215
+ try:
216
+ raise RuntimeError("Failed to determine retry backoff") from e
217
+ except RuntimeError as e:
218
+ raise GithubException(response.status, content, response.headers) from e # type: ignore
219
+
220
+ raise GithubException(
221
+ response.status, # type: ignore
222
+ content, # type: ignore
223
+ response.headers, # type: ignore
224
+ ) # type: ignore
225
+
226
+ # retry the request as usual
227
+ return super().increment(method, url, response, error, _pool, _stacktrace)
228
+
229
+ @staticmethod
230
+ def get_content(resp: urllib3.response.HTTPResponse, url: str) -> bytes: # type: ignore[override]
231
+ # logic taken from HTTPAdapter.build_response (requests.adapters)
232
+ response = Response()
233
+
234
+ # Fallback to None if there's no status_code, for whatever reason.
235
+ response.status_code = getattr(resp, "status", None) # type: ignore
236
+
237
+ # Make headers case-insensitive.
238
+ response.headers = CaseInsensitiveDict(getattr(resp, "headers", {}))
239
+
240
+ # Set encoding.
241
+ response.encoding = utils.get_encoding_from_headers(response.headers)
242
+ response.raw = resp
243
+ response.reason = response.raw.reason # type: ignore
244
+
245
+ response.url = url
246
+
247
+ return response.content or b""
248
+
249
+ def __log(self, level: int, message: str, **kwargs: Any) -> None:
250
+ if self.__logger is None:
251
+ self.__logger = logging.getLogger(__name__)
252
+ if self.__logger.isEnabledFor(level):
253
+ self.__logger.log(level, message, **kwargs)
@@ -0,0 +1,88 @@
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 Steve Kowalik <steven@wedontsleep.org> #
17
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
18
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
19
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
20
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
21
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
22
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
23
+ # #
24
+ # This file is part of PyGithub. #
25
+ # http://pygithub.readthedocs.io/ #
26
+ # #
27
+ # PyGithub is free software: you can redistribute it and/or modify it under #
28
+ # the terms of the GNU Lesser General Public License as published by the Free #
29
+ # Software Foundation, either version 3 of the License, or (at your option) #
30
+ # any later version. #
31
+ # #
32
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
33
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
34
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
35
+ # details. #
36
+ # #
37
+ # You should have received a copy of the GNU Lesser General Public License #
38
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
39
+ # #
40
+ ################################################################################
41
+
42
+ from __future__ import annotations
43
+
44
+ from typing import Any
45
+
46
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet
47
+
48
+
49
+ class GitignoreTemplate(NonCompletableGithubObject):
50
+ """
51
+ This class represents GitignoreTemplates.
52
+
53
+ The reference can be found here
54
+ https://docs.github.com/en/rest/reference/gitignore
55
+
56
+ The OpenAPI schema can be found at
57
+
58
+ - /components/schemas/gitignore-template
59
+
60
+ """
61
+
62
+ def _initAttributes(self) -> None:
63
+ self._name: Attribute[str] = NotSet
64
+ self._source: Attribute[str] = NotSet
65
+ self._url: Attribute[str] = NotSet
66
+
67
+ def __repr__(self) -> str:
68
+ return self.get__repr__({"name": self._name.value})
69
+
70
+ @property
71
+ def name(self) -> str:
72
+ return self._name.value
73
+
74
+ @property
75
+ def source(self) -> str:
76
+ return self._source.value
77
+
78
+ @property
79
+ def url(self) -> str:
80
+ return self._url.value
81
+
82
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
83
+ if "name" in attributes: # pragma no branch
84
+ self._name = self._makeStringAttribute(attributes["name"])
85
+ if "source" in attributes: # pragma no branch
86
+ self._source = self._makeStringAttribute(attributes["source"])
87
+ if "url" in attributes: # pragma no branch
88
+ self._url = self._makeStringAttribute(attributes["url"])
@@ -0,0 +1,141 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
5
+ # Copyright 2023 Joseph Henrich <crimsonknave@gmail.com> #
6
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
7
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
8
+ # Copyright 2024 Thomas Cooper <coopernetes@proton.me> #
9
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
10
+ # #
11
+ # This file is part of PyGithub. #
12
+ # http://pygithub.readthedocs.io/ #
13
+ # #
14
+ # PyGithub is free software: you can redistribute it and/or modify it under #
15
+ # the terms of the GNU Lesser General Public License as published by the Free #
16
+ # Software Foundation, either version 3 of the License, or (at your option) #
17
+ # any later version. #
18
+ # #
19
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
20
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
21
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
22
+ # details. #
23
+ # #
24
+ # You should have received a copy of the GNU Lesser General Public License #
25
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
26
+ # #
27
+ ################################################################################
28
+
29
+ from __future__ import annotations
30
+
31
+ from datetime import datetime
32
+ from typing import TYPE_CHECKING, Any
33
+
34
+ import githubasyncio.AdvisoryBase
35
+ import githubasyncio.AdvisoryCreditDetailed
36
+ import githubasyncio.AdvisoryVulnerability
37
+ from githubasyncio.AdvisoryBase import AdvisoryBase
38
+ from githubasyncio.GithubObject import Attribute, NotSet
39
+
40
+ if TYPE_CHECKING:
41
+ from githubasyncio.AdvisoryCreditDetailed import AdvisoryCreditDetailed
42
+ from githubasyncio.AdvisoryVulnerability import AdvisoryVulnerability
43
+
44
+
45
+ class GlobalAdvisory(AdvisoryBase):
46
+ """
47
+ This class represents a GlobalAdvisory.
48
+
49
+ https://docs.github.com/en/rest/security-advisories/global-advisories
50
+
51
+ The OpenAPI schema can be found at
52
+
53
+ - /components/schemas/global-advisory
54
+
55
+ """
56
+
57
+ def _initAttributes(self) -> None:
58
+ super()._initAttributes()
59
+ self._credits: Attribute[list[AdvisoryCreditDetailed]] = NotSet
60
+ self._epss: Attribute[dict[str, Any]] = NotSet
61
+ self._github_reviewed_at: Attribute[datetime] = NotSet
62
+ self._nvd_published_at: Attribute[datetime] = NotSet
63
+ self._references: Attribute[list[str]] = NotSet
64
+ self._repository_advisory_url: Attribute[str] = NotSet
65
+ self._source_code_location: Attribute[str] = NotSet
66
+ self._type: Attribute[str] = NotSet
67
+ self._vulnerabilities: Attribute[list[AdvisoryVulnerability]] = NotSet
68
+
69
+ def __repr__(self) -> str:
70
+ return self.get__repr__({"ghsa_id": self.ghsa_id, "summary": self.summary})
71
+
72
+ @property
73
+ def credits(
74
+ self,
75
+ ) -> list[AdvisoryCreditDetailed]:
76
+ return self._credits.value
77
+
78
+ @property
79
+ def epss(self) -> dict[str, Any]:
80
+ return self._epss.value
81
+
82
+ @property
83
+ def github_reviewed_at(self) -> datetime:
84
+ return self._github_reviewed_at.value
85
+
86
+ @property
87
+ def nvd_published_at(self) -> datetime:
88
+ return self._nvd_published_at.value
89
+
90
+ @property
91
+ def references(self) -> list[str]:
92
+ return self._references.value
93
+
94
+ @property
95
+ def repository_advisory_url(self) -> str:
96
+ return self._repository_advisory_url.value
97
+
98
+ @property
99
+ def source_code_location(self) -> str:
100
+ return self._source_code_location.value
101
+
102
+ @property
103
+ def type(self) -> str:
104
+ return self._type.value
105
+
106
+ @property
107
+ def vulnerabilities(self) -> list[AdvisoryVulnerability]:
108
+ return self._vulnerabilities.value
109
+
110
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
111
+ if "credits" in attributes: # pragma no branch
112
+ self._credits = self._makeListOfClassesAttribute(
113
+ githubasyncio.AdvisoryCreditDetailed.AdvisoryCreditDetailed,
114
+ attributes["credits"],
115
+ )
116
+ if "epss" in attributes: # pragma no branch
117
+ self._epss = self._makeDictAttribute(attributes["epss"])
118
+ if "github_reviewed_at" in attributes: # pragma no branch
119
+ assert attributes["github_reviewed_at"] is None or isinstance(attributes["github_reviewed_at"], str), (
120
+ attributes["github_reviewed_at"]
121
+ )
122
+ self._github_reviewed_at = self._makeDatetimeAttribute(attributes["github_reviewed_at"])
123
+ if "nvd_published_at" in attributes: # pragma no branch
124
+ assert attributes["nvd_published_at"] is None or isinstance(attributes["nvd_published_at"], str), (
125
+ attributes["nvd_published_at"]
126
+ )
127
+ self._nvd_published_at = self._makeDatetimeAttribute(attributes["nvd_published_at"])
128
+ if "references" in attributes: # pragma no branch
129
+ self._references = self._makeListOfStringsAttribute(attributes["references"])
130
+ if "repository_advisory_url" in attributes: # pragma no branch
131
+ self._repository_advisory_url = self._makeStringAttribute(attributes["repository_advisory_url"])
132
+ if "source_code_location" in attributes: # pragma no branch
133
+ self._source_code_location = self._makeStringAttribute(attributes["source_code_location"])
134
+ if "type" in attributes: # pragma no branch
135
+ self._type = self._makeStringAttribute(attributes["type"])
136
+ if "vulnerabilities" in attributes:
137
+ self._vulnerabilities = self._makeListOfClassesAttribute(
138
+ githubasyncio.AdvisoryVulnerability.AdvisoryVulnerability,
139
+ attributes["vulnerabilities"],
140
+ )
141
+ super()._useAttributes(attributes)