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,910 @@
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 Andrew Scheller <github@loowis.durge.org> #
9
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
10
+ # Copyright 2016 Jakub Wilk <jwilk@jwilk.net> #
11
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
12
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
13
+ # Copyright 2016 Sam Corbett <sam.corbett@cloudsoftcorp.com> #
14
+ # Copyright 2018 Shubham Singh <41840111+singh811@users.noreply.github.com> #
15
+ # Copyright 2018 h.shi <10385628+AnYeMoWang@users.noreply.github.com> #
16
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
17
+ # Copyright 2019 Adam Baratz <adam.baratz@gmail.com> #
18
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
19
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
20
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
21
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
22
+ # Copyright 2023 Christoph Reiter <reiter.christoph@gmail.com> #
23
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
24
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
25
+ # Copyright 2023 Jonathan Greg <31892308+jmgreg31@users.noreply.github.com> #
26
+ # Copyright 2023 Jonathan Leitschuh <jonathan.leitschuh@gmail.com> #
27
+ # Copyright 2023 Joseph Henrich <crimsonknave@gmail.com> #
28
+ # Copyright 2023 Nicolas Schweitzer <nicolas.schweitzer@datadoghq.com> #
29
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
30
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
31
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
32
+ # Copyright 2024 Min RK <benjaminrk@gmail.com> #
33
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
34
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
35
+ # Copyright 2026 Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> #
36
+ # #
37
+ # This file is part of PyGithub. #
38
+ # http://pygithub.readthedocs.io/ #
39
+ # #
40
+ # PyGithub is free software: you can redistribute it and/or modify it under #
41
+ # the terms of the GNU Lesser General Public License as published by the Free #
42
+ # Software Foundation, either version 3 of the License, or (at your option) #
43
+ # any later version. #
44
+ # #
45
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
46
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
47
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
48
+ # details. #
49
+ # #
50
+ # You should have received a copy of the GNU Lesser General Public License #
51
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
52
+ # #
53
+ ################################################################################
54
+
55
+ from __future__ import annotations
56
+
57
+ import email.utils
58
+ import re
59
+ import typing
60
+ from abc import ABC
61
+ from collections.abc import Callable
62
+ from datetime import datetime, timezone
63
+ from decimal import Decimal
64
+ from operator import itemgetter
65
+ from typing import TYPE_CHECKING, Any, ParamSpec, Protocol, TypeAlias, TypeVar, overload
66
+
67
+ from githubasyncio.compat import Self, TypeIs
68
+
69
+ from . import Consts
70
+ from .GithubException import BadAttributeException, IncompletableObject
71
+
72
+ if TYPE_CHECKING:
73
+ from .Rate import Rate
74
+ from .RateLimitOverview import RateLimitOverview
75
+ from .Requester import Requester
76
+
77
+ T = typing.TypeVar("T")
78
+ K = typing.TypeVar("K")
79
+ T_co = typing.TypeVar("T_co", covariant=True)
80
+ T_gh = typing.TypeVar("T_gh", bound="GithubObject")
81
+
82
+
83
+ class Attribute(Protocol[T_co]):
84
+ @property
85
+ def value(self) -> T_co:
86
+ raise NotImplementedError
87
+
88
+
89
+ def _datetime_from_http_date(value: str) -> datetime:
90
+ """
91
+ Convert an HTTP date to a datetime object.
92
+
93
+ Raises ValueError for invalid dates.
94
+
95
+ """
96
+ dt = email.utils.parsedate_to_datetime(value)
97
+ if dt.tzinfo is None:
98
+ # RFC7231 states that UTC is assumed if no timezone info is present
99
+ return dt.replace(tzinfo=timezone.utc)
100
+ return dt
101
+
102
+
103
+ def _datetime_from_github_isoformat(value: str) -> datetime:
104
+ """
105
+ Convert an GitHub API timestamps to a datetime object.
106
+
107
+ Raises ValueError for invalid timestamps.
108
+
109
+ """
110
+ # Github always returns YYYY-MM-DDTHH:MM:SSZ, so we can use the stdlib parser
111
+ # with some minor adjustments for Python < 3.11 which doesn't support "Z"
112
+ # https://docs.github.com/en/rest/overview/resources-in-the-rest-api#schema
113
+ if value.endswith("Z"):
114
+ value = value[:-1] + "+00:00"
115
+ return datetime.fromisoformat(value)
116
+
117
+
118
+ class _NotSetType(Attribute[Any]):
119
+ def __repr__(self) -> str:
120
+ return "NotSet"
121
+
122
+ @property
123
+ def value(self) -> Any:
124
+ return None
125
+
126
+ @staticmethod
127
+ def remove_unset_items(data: dict[str, Any]) -> dict[str, Any]:
128
+ return {key: value for key, value in data.items() if not isinstance(value, _NotSetType)}
129
+
130
+
131
+ NotSet = _NotSetType()
132
+
133
+ Opt: TypeAlias = T | _NotSetType
134
+
135
+
136
+ def is_defined(v: T | _NotSetType) -> TypeIs[T]:
137
+ return not isinstance(v, _NotSetType)
138
+
139
+
140
+ def is_undefined(v: T | _NotSetType) -> TypeIs[_NotSetType]:
141
+ return isinstance(v, _NotSetType)
142
+
143
+
144
+ def is_optional(v: Any, type: type | tuple[type, ...]) -> bool:
145
+ return isinstance(v, _NotSetType) or isinstance(v, type)
146
+
147
+
148
+ def is_list(v: Any, type: type | tuple[type, ...]) -> bool:
149
+ return isinstance(v, list) and all(isinstance(element, type) for element in v)
150
+
151
+
152
+ def is_optional_list(v: Any, type: type | tuple[type, ...]) -> bool:
153
+ return is_undefined(v) or is_list(v, type)
154
+
155
+
156
+ camel_to_snake_case_regexp = re.compile(r"(?<!^)(?=[A-Z])")
157
+
158
+
159
+ @overload
160
+ def as_rest_api_attributes(graphql_attributes: dict[str, Any]) -> dict[str, Any]: ...
161
+
162
+
163
+ @overload
164
+ def as_rest_api_attributes(graphql_attributes: None) -> None: ...
165
+
166
+
167
+ def as_rest_api_attributes(graphql_attributes: dict[str, Any] | None) -> dict[str, Any] | None:
168
+ """
169
+ Converts attributes from GraphQL schema to REST API schema.
170
+
171
+ The GraphQL API uses lower camel case (e.g. createdAt), whereas REST API uses snake case (created_at). Initializing
172
+ REST API GithubObjects from GraphQL API attributes requires transformation provided by this method.
173
+
174
+ Further renames GraphQL attributes to REST API attributes where the case conversion is not sufficient. For example,
175
+ GraphQL attribute 'id' is equivalent to REST API attribute 'node_id'.
176
+
177
+ """
178
+ if graphql_attributes is None:
179
+ return None
180
+
181
+ attribute_translation = {
182
+ "id": "node_id",
183
+ "databaseId": "id", # must be after 'id': 'node_id'!
184
+ "url": "html_url",
185
+ }
186
+
187
+ def translate(attr: str) -> str:
188
+ def un_capitalize(match: re.Match) -> str:
189
+ return match.group(1) + match.group(2).lower()
190
+
191
+ attr = attribute_translation.get(attr, attr)
192
+ attr = re.sub(r"([A-Z])([A-Z]+)", un_capitalize, attr)
193
+ attr = camel_to_snake_case_regexp.sub("_", attr)
194
+ attr = attr.lower()
195
+
196
+ return attr
197
+
198
+ return {
199
+ translate(k): as_rest_api_attributes(v)
200
+ if isinstance(v, dict)
201
+ else (as_rest_api_attributes_list(v) if isinstance(v, list) else v)
202
+ for k, v in graphql_attributes.items()
203
+ }
204
+
205
+
206
+ def as_rest_api_attributes_list(graphql_attributes: list[dict[str, Any] | None]) -> list[dict[str, Any] | None]:
207
+ return [as_rest_api_attributes(v) if isinstance(v, dict) else v for v in graphql_attributes]
208
+
209
+
210
+ class _ValuedAttribute(Attribute[T]):
211
+ def __init__(self, value: T):
212
+ self._value = value
213
+
214
+ @property
215
+ def value(self) -> T:
216
+ return self._value
217
+
218
+
219
+ class _BadAttribute(Attribute[T]):
220
+ def __init__(self, value: Any, expectedType: Any, exception: Exception | None = None):
221
+ self.__value = value
222
+ self.__expectedType = expectedType
223
+ self.__exception = exception
224
+
225
+ @property
226
+ def value(self) -> T:
227
+ raise BadAttributeException(self.__value, self.__expectedType, self.__exception)
228
+
229
+
230
+ def rate_limit_from_headers(headers: dict[str, Any]) -> dict[str, Any]:
231
+ """
232
+ Extract the rate limit from response headers, as attributes of :class:`githubasyncio.Rate.Rate`.
233
+
234
+ :return: attributes, empty if the headers do not provide any rate limit values
235
+
236
+ """
237
+ attributes: dict[str, Any] = {
238
+ # ints expected but sometimes floats returned: https://github.com/PyGithub/PyGithub/pull/2697
239
+ attribute: int(float(headers[header]))
240
+ for attribute, header in (
241
+ ("limit", Consts.headerRateLimit),
242
+ ("remaining", Consts.headerRateRemaining),
243
+ ("reset", Consts.headerRateReset),
244
+ ("used", Consts.headerRateUsed),
245
+ )
246
+ if header in headers
247
+ }
248
+ if attributes and Consts.headerRateResource in headers:
249
+ attributes["resource"] = headers[Consts.headerRateResource]
250
+ return attributes
251
+
252
+
253
+ # v3: add * to edit function of all GithubObject implementations,
254
+ # this allows to rename attributes and maintain the order of attributes
255
+ class GithubObject(ABC):
256
+ """
257
+ Base class for all classes representing objects returned by the API.
258
+ """
259
+
260
+ """
261
+ A global debug flag to enable header validation by requester for all objects
262
+ """
263
+ CHECK_AFTER_INIT_FLAG = False
264
+ _url: Attribute[str]
265
+
266
+ @classmethod
267
+ def is_rest(cls) -> bool:
268
+ return not cls.is_graphql()
269
+
270
+ @classmethod
271
+ def is_graphql(cls) -> bool:
272
+ return False
273
+
274
+ @classmethod
275
+ def setCheckAfterInitFlag(cls, flag: bool) -> None:
276
+ cls.CHECK_AFTER_INIT_FLAG = flag
277
+
278
+ def __init__(
279
+ self,
280
+ requester: Requester,
281
+ headers: dict[str, str | int],
282
+ attributes: Any,
283
+ ):
284
+ self._requester = requester
285
+ self._initAttributes()
286
+ self._storeAndUseAttributes(headers, attributes)
287
+
288
+ # Ask requester to do some checking, for debug and test purpose
289
+ # Since it's most handy to access and kinda all-knowing
290
+ if self.CHECK_AFTER_INIT_FLAG: # pragma no branch (Flag always set in tests)
291
+ requester.check_me(self)
292
+
293
+ def _storeAndUseAttributes(self, headers: dict[str, str | int], attributes: Any) -> None:
294
+ # Make sure headers are assigned before calling _useAttributes
295
+ # (Some derived classes will use headers in _useAttributes)
296
+ self._api_version = headers.get(Consts.headerApiVersionSelected)
297
+ self._headers = headers
298
+ self._rawData = attributes
299
+ self._useAttributes(attributes)
300
+
301
+ @property
302
+ def requester(self) -> Requester:
303
+ """
304
+ Return my Requester object.
305
+
306
+ For example, to make requests to API endpoints not yet supported by PyGitHub.
307
+
308
+ """
309
+ return self._requester
310
+
311
+ @property
312
+ def current_rate_limits(self) -> RateLimitOverview:
313
+ """
314
+ Latest rate limits known to the requester of this instance, per resource. This does not send any request.
315
+
316
+ Values come from the response headers of requests made through the requester of this instance.
317
+ Attributes of ``resources`` are ``None`` until values for that resource are known or if the resource is unknown
318
+ to :class:`githubasyncio.RateLimit.RateLimit`. Use :meth:`githubasyncio.RateLimitOverview.RateLimitOverview.update` to fetch latest values.
319
+
320
+ """
321
+ return self._requester.current_rate_limits
322
+
323
+ @property
324
+ def rate_limit(self) -> Rate | None:
325
+ """
326
+ Rate limit reported by the response that provided this object, ``None`` if that response did not report any.
327
+
328
+ This does not send any request, so it is also ``None`` for a lazy object that has not been completed yet.
329
+ It does not get updated by later requests, see :attr:`current_rate_limits` for the latest rate limits.
330
+
331
+ """
332
+ # imported here as github.Rate depends on this module
333
+ import githubasyncio.Rate
334
+
335
+ attributes = rate_limit_from_headers(self._headers)
336
+ if not attributes:
337
+ return None
338
+ return githubasyncio.Rate.Rate(self._requester, self._headers, attributes)
339
+
340
+ @property
341
+ async def raw_data(self) -> dict[str, Any]:
342
+ """
343
+ :type: dict
344
+ """
345
+ return self._rawData
346
+
347
+ @property
348
+ async def raw_headers(self) -> dict[str, str | int]:
349
+ """
350
+ :type: dict
351
+ """
352
+ return self._headers
353
+
354
+ @property
355
+ def api_version(self) -> str | None:
356
+ """
357
+ The Github API version of this PyGithub object as returned by the Github API.
358
+
359
+ This does not reflect the API version configured via Github(api_version=…) or GithubIntegration(api_version=…).
360
+
361
+ :type: str
362
+
363
+ """
364
+ return self._api_version # type: ignore
365
+
366
+ @staticmethod
367
+ def _parentUrl(url: str) -> str:
368
+ return "/".join(url.split("/")[:-1])
369
+
370
+ @staticmethod
371
+ def __makeSimpleAttribute(value: Any, type: type[T]) -> Attribute[T]:
372
+ if value is None or isinstance(value, type):
373
+ return _ValuedAttribute(value) # type: ignore
374
+ else:
375
+ return _BadAttribute(value, type) # type: ignore
376
+
377
+ @staticmethod
378
+ def __makeSimpleListAttribute(value: list, type: type[T]) -> Attribute[T]:
379
+ if isinstance(value, list) and all(isinstance(element, type) for element in value):
380
+ return _ValuedAttribute(value) # type: ignore
381
+ else:
382
+ return _BadAttribute(value, [type]) # type: ignore
383
+
384
+ @staticmethod
385
+ def __makeTransformedAttribute(value: T, type: type[T], transform: Callable[[T], K]) -> Attribute[K]:
386
+ if value is None:
387
+ return _ValuedAttribute(None) # type: ignore
388
+ elif isinstance(value, type):
389
+ try:
390
+ return _ValuedAttribute(transform(value))
391
+ except Exception as e:
392
+ return _BadAttribute(value, type, e) # type: ignore
393
+ else:
394
+ return _BadAttribute(value, type) # type: ignore
395
+
396
+ @staticmethod
397
+ def _makeStringAttribute(value: int | str | None) -> Attribute[str]:
398
+ return GithubObject.__makeSimpleAttribute(value, str)
399
+
400
+ @staticmethod
401
+ def _makeIntAttribute(value: int | str | None) -> Attribute[int]:
402
+ return GithubObject.__makeSimpleAttribute(value, int)
403
+
404
+ @staticmethod
405
+ def _makeDecimalAttribute(value: Decimal | None) -> Attribute[Decimal]:
406
+ return GithubObject.__makeSimpleAttribute(value, Decimal)
407
+
408
+ @staticmethod
409
+ def _makeFloatAttribute(value: float | None) -> Attribute[float]:
410
+ return GithubObject.__makeSimpleAttribute(value, float)
411
+
412
+ @staticmethod
413
+ def _makeBoolAttribute(value: bool | None) -> Attribute[bool]:
414
+ return GithubObject.__makeSimpleAttribute(value, bool)
415
+
416
+ @staticmethod
417
+ def _makeDictAttribute(value: dict[str, Any]) -> Attribute[dict[str, Any]]:
418
+ return GithubObject.__makeSimpleAttribute(value, dict)
419
+
420
+ @staticmethod
421
+ def _makeTimestampAttribute(value: int) -> Attribute[datetime]:
422
+ return GithubObject.__makeTransformedAttribute(
423
+ value,
424
+ int,
425
+ lambda t: datetime.fromtimestamp(t, tz=timezone.utc),
426
+ )
427
+
428
+ @staticmethod
429
+ def _makeDatetimeAttribute(value: str | None) -> Attribute[datetime]:
430
+ return GithubObject.__makeTransformedAttribute(value, str, _datetime_from_github_isoformat) # type: ignore
431
+
432
+ @staticmethod
433
+ def _makeHttpDatetimeAttribute(value: str | None) -> Attribute[datetime]:
434
+ return GithubObject.__makeTransformedAttribute(value, str, _datetime_from_http_date) # type: ignore
435
+
436
+ def _makeClassAttribute(self, klass: type[T_gh], value: Any) -> Attribute[T_gh]:
437
+ return GithubObject.__makeTransformedAttribute(
438
+ value,
439
+ dict,
440
+ lambda value: klass(self._requester, self._headers, value),
441
+ )
442
+
443
+ def _makeUnionClassAttributeFromTypeName(
444
+ self, type_name: str | None, fallback_type: str | None, value: Any, *class_and_names: tuple[type[T_gh], str]
445
+ ) -> Attribute[T_gh]:
446
+ class_and_name_index = {name: clazz for clazz, name in class_and_names}
447
+ if fallback_type is not None:
448
+ assert fallback_type in class_and_name_index
449
+
450
+ if value is None or type_name is None:
451
+ return _ValuedAttribute(None) # type: ignore
452
+
453
+ klass = class_and_name_index.get(type_name)
454
+ if klass is not None:
455
+ return self._makeClassAttribute(klass, value)
456
+
457
+ if fallback_type is not None:
458
+ fallback_class = class_and_name_index.get(fallback_type)
459
+ assert fallback_class is not None
460
+ return self._makeClassAttribute(fallback_class, value)
461
+
462
+ return _BadAttribute(value, type) # type: ignore
463
+
464
+ def _makeUnionClassAttributeFromTypeKey(
465
+ self,
466
+ type_key: str,
467
+ default_and_fallback_type: str | tuple[str, str] | None,
468
+ value: Any,
469
+ *class_and_names: tuple[type[T_gh], str],
470
+ ) -> Attribute[T_gh]:
471
+ if value is None or not isinstance(value, dict):
472
+ return _ValuedAttribute(None) # type: ignore
473
+ default_type: str | None
474
+ fallback_type: str | None
475
+ if isinstance(default_and_fallback_type, tuple):
476
+ default_type, fallback_type = default_and_fallback_type
477
+ else:
478
+ default_type = default_and_fallback_type
479
+ fallback_type = default_and_fallback_type
480
+ return self._makeUnionClassAttributeFromTypeName(
481
+ value.get(type_key, default_type), fallback_type, value, *class_and_names
482
+ )
483
+
484
+ def _makeUnionClassAttributeFromTypeKeyAndValueKey(
485
+ self,
486
+ type_key: str,
487
+ value_key: str,
488
+ default_and_fallback_type: str | tuple[str, str] | None,
489
+ value: Any,
490
+ *class_and_names: tuple[type[T_gh], str],
491
+ ) -> Attribute[T_gh]:
492
+ if value is None or not isinstance(value, dict):
493
+ return _ValuedAttribute(None) # type: ignore
494
+ default_type: str | None
495
+ fallback_type: str | None
496
+ if isinstance(default_and_fallback_type, tuple):
497
+ default_type, fallback_type = default_and_fallback_type
498
+ else:
499
+ default_type = default_and_fallback_type
500
+ fallback_type = default_and_fallback_type
501
+ return self._makeUnionClassAttributeFromTypeName(
502
+ value.get(type_key, default_type), fallback_type, value.get(value_key), *class_and_names
503
+ )
504
+
505
+ @staticmethod
506
+ def _makeListOfStringsAttribute(value: list[list[str]] | list[str] | list[str | int]) -> Attribute:
507
+ return GithubObject.__makeSimpleListAttribute(value, str)
508
+
509
+ @staticmethod
510
+ def _makeListOfIntsAttribute(value: list[int]) -> Attribute:
511
+ return GithubObject.__makeSimpleListAttribute(value, int)
512
+
513
+ @staticmethod
514
+ def _makeListOfDictsAttribute(value: list[dict[str, str | list[dict[str, str | list[int]]]]]) -> Attribute:
515
+ return GithubObject.__makeSimpleListAttribute(value, dict)
516
+
517
+ @staticmethod
518
+ def _makeListOfListOfStringsAttribute(
519
+ value: list[list[str]],
520
+ ) -> Attribute:
521
+ return GithubObject.__makeSimpleListAttribute(value, list)
522
+
523
+ def _makeListOfClassesAttribute(self, klass: type[T_gh], value: Any) -> Attribute[list[T_gh]]:
524
+ if isinstance(value, list) and all(isinstance(element, dict) for element in value):
525
+ return _ValuedAttribute([klass(self._requester, self._headers, element) for element in value])
526
+ else:
527
+ return _BadAttribute(value, [dict])
528
+
529
+ def _makeListOfUnionClassesAttributeFromTypeKey(
530
+ self,
531
+ type_key: str,
532
+ default_and_fallback_type: str | tuple[str, str],
533
+ value: Any,
534
+ *class_and_names: tuple[type[T_gh], str],
535
+ ) -> Attribute[list[T_gh]]:
536
+ class_and_name_index = {name: clazz for clazz, name in class_and_names}
537
+ if isinstance(default_and_fallback_type, str):
538
+ default_type = default_and_fallback_type
539
+ fallback_type = default_and_fallback_type
540
+ else:
541
+ default_type, fallback_type = default_and_fallback_type
542
+ assert default_type in class_and_name_index
543
+ assert fallback_type in class_and_name_index
544
+ fallback_class = class_and_name_index.get(fallback_type)
545
+ assert fallback_class is not None
546
+ if isinstance(value, list) and all(isinstance(element, dict) for element in value):
547
+ return _ValuedAttribute(
548
+ [
549
+ klass(self._requester, self._headers, element)
550
+ for element in value
551
+ for type_name in [element.get(type_key, default_type)]
552
+ for klass in [class_and_name_index.get(type_name, fallback_class)]
553
+ ]
554
+ )
555
+ else:
556
+ return _BadAttribute(value, [dict])
557
+
558
+ def _makeDictOfStringsToClassesAttribute(
559
+ self,
560
+ klass: type[T_gh],
561
+ value: dict[
562
+ str,
563
+ int | dict[str, Any],
564
+ ],
565
+ ) -> Attribute[dict[str, T_gh]]:
566
+ if isinstance(value, dict) and all(
567
+ isinstance(key, str) and isinstance(element, dict) for key, element in value.items()
568
+ ):
569
+ return _ValuedAttribute(
570
+ {key: klass(self._requester, self._headers, element) for key, element in value.items()}
571
+ )
572
+ else:
573
+ return _BadAttribute(value, {str: dict})
574
+
575
+ @property
576
+ def etag(self) -> str | None:
577
+ """
578
+ :type: str
579
+ """
580
+ return self._headers.get(Consts.RES_ETAG) # type: ignore
581
+
582
+ @property
583
+ def last_modified(self) -> str | None:
584
+ """
585
+ :type: str
586
+ """
587
+ return self._headers.get(Consts.RES_LAST_MODIFIED) # type: ignore
588
+
589
+ @property
590
+ def last_modified_datetime(self) -> datetime | None:
591
+ """
592
+ :type: datetime
593
+ """
594
+ return self._makeHttpDatetimeAttribute(self.last_modified).value # type: ignore
595
+
596
+ def get__repr__(self, params: dict[str, Any]) -> str:
597
+ """
598
+ Converts the object to a nicely printable string.
599
+ """
600
+
601
+ def format_params(params: dict[str, Any]) -> typing.Generator[str, None, None]:
602
+ items = list(params.items())
603
+ for k, v in sorted(items, key=itemgetter(0), reverse=True):
604
+ if isinstance(v, bytes):
605
+ v = v.decode("utf-8")
606
+ if isinstance(v, str):
607
+ v = f'"{v}"'
608
+ yield f"{k}={v}"
609
+
610
+ return "{class_name}({params})".format(
611
+ class_name=self.__class__.__name__,
612
+ params=", ".join(list(format_params(params))),
613
+ )
614
+
615
+ def _initAttributes(self) -> None:
616
+ raise NotImplementedError("BUG: Not Implemented _initAttributes")
617
+
618
+ def _useAttributes(self, attributes: Any) -> None:
619
+ raise NotImplementedError("BUG: Not Implemented _useAttributes")
620
+
621
+
622
+ class GraphQlObject:
623
+ @classmethod
624
+ def is_graphql(cls) -> bool:
625
+ return True
626
+
627
+
628
+ class NonCompletableGithubObject(GithubObject, ABC):
629
+ def __init__(
630
+ self,
631
+ requester: Requester,
632
+ headers: dict[str, str | int],
633
+ attributes: dict[str, Any],
634
+ ):
635
+ super().__init__(requester, headers, attributes)
636
+
637
+
638
+ class CompletableGithubObject(GithubObject, ABC):
639
+ def __init__(
640
+ self,
641
+ requester: Requester,
642
+ headers: dict[str, str | int] | None = None,
643
+ attributes: dict[str, Any] | None = None,
644
+ completed: bool | None = None,
645
+ *,
646
+ url: str | None = None,
647
+ accept: str | None = None,
648
+ ):
649
+ """
650
+ A CompletableGithubObject can be partially initialised (completed=False). Accessing attributes that are not
651
+ initialized will then trigger a request to complete all attributes.
652
+
653
+ A partially initialized CompletableGithubObject (completed=False) can be completed
654
+ via ``complete()``. This requires the url to be given via parameter ``url`` or ``attributes``.
655
+
656
+ With a requester where ``Requester.is_lazy == True``, this CompletableGithubObjects is
657
+ partially initialized. This requires the url to be given via parameter ``url`` or ``attributes``.
658
+ Any CompletableGithubObject created from this lazy object will be lazy itself if created with
659
+ parameter ``url`` or ``attributes``.
660
+
661
+ :param requester: requester
662
+ :param headers: response headers
663
+ :param attributes: attributes to initialize
664
+ :param completed: do not update non-initialized attributes when True
665
+ :param url: url of this instance, overrides attributes['url']
666
+ :param accept: use this accept header when completing this instance
667
+
668
+ """
669
+ response_given = headers is not None
670
+
671
+ if headers is None:
672
+ headers = {}
673
+ if attributes is None:
674
+ attributes = {}
675
+ if url is not None:
676
+ attributes["url"] = url
677
+ super().__init__(requester, headers, attributes)
678
+ self.__completed = completed if isinstance(completed, bool) else False
679
+ self.__completeHeaders = {"Accept": accept} if accept else None
680
+
681
+ # complete this completable object when requester indicates non-laziness and
682
+ # neither of complete and headers are given
683
+ # Async: store flag instead of calling self.complete() (can't await in __init__).
684
+ # The SyncProxy._wrap() or user code should call await obj.complete() when this is True.
685
+ self._needs_async_completion = requester.is_not_lazy and completed is None and not response_given
686
+
687
+ def _initAttributes(self) -> None:
688
+ self._url: Attribute[str] = NotSet
689
+
690
+ def __eq__(self, other: Any) -> bool:
691
+ return (
692
+ other.__class__.__name__ == self.__class__.__name__
693
+ and other.requester.base_url == self.requester.base_url
694
+ and other._url.value.removeprefix(other.requester.base_url)
695
+ == self._url.value.removeprefix(self.requester.base_url)
696
+ )
697
+
698
+ def __hash__(self) -> int:
699
+ return hash(self._url.value)
700
+
701
+ def __ne__(self, other: Any) -> bool:
702
+ return not self == other
703
+
704
+ @property
705
+ def completed(self) -> bool:
706
+ return self.__completed
707
+
708
+ @property
709
+ async def raw_data(self) -> dict[str, Any]:
710
+ """
711
+ :type: dict
712
+ """
713
+ await self._completeIfNeeded()
714
+ return await super().raw_data
715
+
716
+ @property
717
+ async def raw_headers(self) -> dict[str, str | int]:
718
+ """
719
+ :type: dict
720
+ """
721
+ await self._completeIfNeeded()
722
+ return await super().raw_headers
723
+
724
+ @property
725
+ async def url(self) -> str:
726
+ await self._completeIfNotSet(self._url)
727
+ return self._url.value
728
+
729
+ async def complete(self) -> Self:
730
+ await self._completeIfNeeded()
731
+ return self
732
+
733
+ async def _completeIfNotSet(self, value: Attribute) -> None:
734
+ if isinstance(value, _NotSetType):
735
+ await self._completeIfNeeded()
736
+
737
+ async def _completeIfNeeded(self) -> None:
738
+ if not self.__completed:
739
+ await self._complete()
740
+
741
+ async def _complete(self, parameters: dict[str, Any] | None = None) -> None:
742
+ if self._url.value is None:
743
+ raise IncompletableObject(400, message="Cannot complete object as it contains no URL")
744
+ headers, data = await self._requester.requestJsonAndCheck(
745
+ "GET", self._url.value, parameters=parameters, headers=self.__completeHeaders
746
+ )
747
+ self._storeAndUseAttributes(headers, data)
748
+ self._set_complete()
749
+
750
+ def _set_complete(self) -> None:
751
+ self.__completed = True
752
+
753
+ async def update(
754
+ self, additional_headers: dict[str, Any] | None = None, parameters: dict[str, Any] | None = None
755
+ ) -> bool:
756
+ """
757
+ Refresh this object in place with a conditional GET request.
758
+
759
+ The request uses the object's ETag and Last-Modified headers, when available.
760
+ A ``304 Not Modified`` response leaves the cached attributes unchanged.
761
+
762
+ :param additional_headers: Extra request headers, overriding the conditional headers if supplied.
763
+ :param parameters: Query parameters for the request.
764
+ :return: ``True`` if the response refreshed the object, or ``False`` for a ``304 Not Modified`` response.
765
+ :rtype: bool
766
+ """
767
+ conditionalRequestHeader = dict()
768
+ if self.etag is not None:
769
+ conditionalRequestHeader[Consts.REQ_IF_NONE_MATCH] = self.etag
770
+ if self.last_modified is not None:
771
+ conditionalRequestHeader[Consts.REQ_IF_MODIFIED_SINCE] = self.last_modified
772
+ if additional_headers is not None:
773
+ conditionalRequestHeader.update(additional_headers)
774
+
775
+ status, responseHeaders, output = await self._requester.requestJson(
776
+ "GET", self._url.value, parameters=parameters, headers=conditionalRequestHeader
777
+ )
778
+ if status == 304:
779
+ return False
780
+ else:
781
+ headers, data = await self._requester._Requester__check(status, responseHeaders, output) # type: ignore
782
+ self._storeAndUseAttributes(headers, data)
783
+ self.__completed = True
784
+ return True
785
+
786
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
787
+ # populate url attribute with self-link
788
+ if "url" not in attributes:
789
+ self_link = attributes.get("_links", {}).get("self", {})
790
+ if self_link:
791
+ if isinstance(self_link, str):
792
+ attributes["url"] = self_link
793
+ elif isinstance(self_link, dict):
794
+ href = self_link.get("href")
795
+ if href:
796
+ attributes["url"] = href
797
+ if "url" in attributes: # pragma no branch
798
+ self._url = self._makeStringAttribute(attributes["url"])
799
+
800
+
801
+ class CompletableGithubObjectWithPaginatedProperty(CompletableGithubObject):
802
+ """
803
+ A CompletableGithubObject that has a property that is subject to pagination.
804
+
805
+ An instance created from a Requester with a non-default value for ``per_page`` must have the
806
+ ``per_page`` value in the URL in order for the paginated property to use the ``per_page`` value.
807
+
808
+ """
809
+
810
+ def __init__(
811
+ self,
812
+ requester: Requester,
813
+ headers: dict[str, str | int] | None = None,
814
+ attributes: dict[str, Any] | None = None,
815
+ completed: bool | None = None,
816
+ *,
817
+ url: str | None = None,
818
+ accept: str | None = None,
819
+ per_page: int | None = None,
820
+ ):
821
+ assert per_page is None or isinstance(per_page, int) and per_page > 0, per_page
822
+
823
+ # we set page=1 to get pagination links, PaginatedList can work from there
824
+ self.__pagination_parameters = {"page": 1}
825
+ if per_page is not None:
826
+ # we set the given per_page
827
+ self.__pagination_parameters["per_page"] = per_page
828
+ else:
829
+ # we use the per_page explicitly configured with the Requester
830
+ if requester.per_page != Consts.DEFAULT_PER_PAGE:
831
+ self.__pagination_parameters["per_page"] = requester.per_page
832
+ else:
833
+ # we use the default (no) per_page (not Consts.DEFAULT_PER_PAGE, the URL might have a different default)
834
+ pass
835
+
836
+ super().__init__(requester, headers, attributes, completed, url=url, accept=accept)
837
+
838
+ @property
839
+ def _pagination_parameters(self) -> dict[str, Any]:
840
+ return self.__pagination_parameters
841
+
842
+ def _pagination_parameters_with(self, page: int, per_page: int | None) -> dict[str, Any]:
843
+ assert page > 0, page
844
+ assert per_page is None or isinstance(per_page, int) and per_page > 0, per_page
845
+ parameters = self._pagination_parameters.copy()
846
+ parameters["page"] = page
847
+ if per_page is not None:
848
+ parameters["per_page"] = per_page
849
+ return parameters
850
+
851
+ async def _complete(self, parameters: dict[str, Any] | None = None) -> None:
852
+ # inject pagination parameters into the complete request
853
+ parameters = {**parameters} if parameters else {}
854
+ parameters.update(**self.__pagination_parameters)
855
+ await super()._complete(parameters=parameters)
856
+
857
+ async def update(
858
+ self, additional_headers: dict[str, Any] | None = None, parameters: dict[str, Any] | None = None
859
+ ) -> bool:
860
+ # inject pagination parameters into the complete request
861
+ parameters = {**parameters} if parameters else {}
862
+ parameters.update(**self.__pagination_parameters)
863
+ return await super().update(parameters=parameters)
864
+
865
+
866
+ Param = ParamSpec("Param")
867
+ RetType = TypeVar("RetType")
868
+
869
+
870
+ # decorator to annotate methods with OpenAPI mapping information
871
+ def method_parameter(
872
+ *, name: str, required: bool = False, merge: list[str] | None = None, docstring_prepend: str | None = None
873
+ ) -> Callable[[Callable[Param, RetType]], Callable[Param, RetType]]:
874
+ def method_parameter_decorator(fn: Callable[Param, RetType]) -> Callable[Param, RetType]:
875
+ return fn
876
+
877
+ return method_parameter_decorator
878
+
879
+
880
+ # decorator to annotate methods with OpenAPI mapping information
881
+ def method_returns(
882
+ *, schema_property: str | None = None
883
+ ) -> Callable[[Callable[Param, RetType]], Callable[Param, RetType]]:
884
+ def method_returns_decorator(fn: Callable[Param, RetType]) -> Callable[Param, RetType]:
885
+ return fn
886
+
887
+ return method_returns_decorator
888
+
889
+
890
+ # decorator to annotate methods with OpenAPI mapping information
891
+ def openapi_parameter(
892
+ *,
893
+ name: str,
894
+ matches: str | None = None,
895
+ type: str | None = None,
896
+ input: bool | None = None,
897
+ docstring_prepend: str | None = None,
898
+ ) -> Callable[[Callable[Param, RetType]], Callable[Param, RetType]]:
899
+ def openapi_parameter_decorator(fn: Callable[Param, RetType]) -> Callable[Param, RetType]:
900
+ return fn
901
+
902
+ return openapi_parameter_decorator
903
+
904
+
905
+ # decorator to annotate methods with OpenAPI mapping information
906
+ def ignore_return_type(*, ignore_type: str) -> Callable[[Callable[Param, RetType]], Callable[Param, RetType]]:
907
+ def ignore_return_types_decorator(fn: Callable[Param, RetType]) -> Callable[Param, RetType]:
908
+ return fn
909
+
910
+ return ignore_return_types_decorator