grpcio-fips 1.70.0__3-cp313-cp313-win_amd64.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 (63) hide show
  1. grpc/__init__.py +2348 -0
  2. grpc/_auth.py +80 -0
  3. grpc/_channel.py +2267 -0
  4. grpc/_common.py +183 -0
  5. grpc/_compression.py +71 -0
  6. grpc/_cython/__init__.py +13 -0
  7. grpc/_cython/_credentials/roots.pem +4337 -0
  8. grpc/_cython/_cygrpc/__init__.py +13 -0
  9. grpc/_cython/cygrpc.cp313-win_amd64.pyd +0 -0
  10. grpc/_grpcio_metadata.py +1 -0
  11. grpc/_interceptor.py +813 -0
  12. grpc/_observability.py +299 -0
  13. grpc/_plugin_wrapping.py +136 -0
  14. grpc/_runtime_protos.py +165 -0
  15. grpc/_server.py +1528 -0
  16. grpc/_simple_stubs.py +588 -0
  17. grpc/_typing.py +95 -0
  18. grpc/_utilities.py +222 -0
  19. grpc/aio/__init__.py +95 -0
  20. grpc/aio/_base_call.py +257 -0
  21. grpc/aio/_base_channel.py +364 -0
  22. grpc/aio/_base_server.py +385 -0
  23. grpc/aio/_call.py +764 -0
  24. grpc/aio/_channel.py +627 -0
  25. grpc/aio/_interceptor.py +1178 -0
  26. grpc/aio/_metadata.py +137 -0
  27. grpc/aio/_server.py +239 -0
  28. grpc/aio/_typing.py +43 -0
  29. grpc/aio/_utils.py +22 -0
  30. grpc/beta/__init__.py +13 -0
  31. grpc/beta/_client_adaptations.py +1015 -0
  32. grpc/beta/_metadata.py +56 -0
  33. grpc/beta/_server_adaptations.py +465 -0
  34. grpc/beta/implementations.py +345 -0
  35. grpc/beta/interfaces.py +163 -0
  36. grpc/beta/utilities.py +153 -0
  37. grpc/experimental/__init__.py +134 -0
  38. grpc/experimental/aio/__init__.py +16 -0
  39. grpc/experimental/gevent.py +27 -0
  40. grpc/experimental/session_cache.py +45 -0
  41. grpc/framework/__init__.py +13 -0
  42. grpc/framework/common/__init__.py +13 -0
  43. grpc/framework/common/cardinality.py +26 -0
  44. grpc/framework/common/style.py +24 -0
  45. grpc/framework/foundation/__init__.py +13 -0
  46. grpc/framework/foundation/abandonment.py +22 -0
  47. grpc/framework/foundation/callable_util.py +98 -0
  48. grpc/framework/foundation/future.py +219 -0
  49. grpc/framework/foundation/logging_pool.py +72 -0
  50. grpc/framework/foundation/stream.py +43 -0
  51. grpc/framework/foundation/stream_util.py +148 -0
  52. grpc/framework/interfaces/__init__.py +13 -0
  53. grpc/framework/interfaces/base/__init__.py +13 -0
  54. grpc/framework/interfaces/base/base.py +328 -0
  55. grpc/framework/interfaces/base/utilities.py +83 -0
  56. grpc/framework/interfaces/face/__init__.py +13 -0
  57. grpc/framework/interfaces/face/face.py +1084 -0
  58. grpc/framework/interfaces/face/utilities.py +245 -0
  59. grpcio_fips-1.70.0.dist-info/METADATA +142 -0
  60. grpcio_fips-1.70.0.dist-info/RECORD +63 -0
  61. grpcio_fips-1.70.0.dist-info/WHEEL +5 -0
  62. grpcio_fips-1.70.0.dist-info/licenses/LICENSE +610 -0
  63. grpcio_fips-1.70.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,385 @@
1
+ # Copyright 2020 The gRPC Authors
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Abstract base classes for server-side classes."""
15
+
16
+ import abc
17
+ from typing import Generic, Iterable, Mapping, NoReturn, Optional, Sequence
18
+
19
+ import grpc
20
+
21
+ from ._metadata import Metadata # pylint: disable=unused-import
22
+ from ._typing import DoneCallbackType
23
+ from ._typing import MetadataType
24
+ from ._typing import RequestType
25
+ from ._typing import ResponseType
26
+
27
+
28
+ class Server(abc.ABC):
29
+ """Serves RPCs."""
30
+
31
+ @abc.abstractmethod
32
+ def add_generic_rpc_handlers(
33
+ self, generic_rpc_handlers: Sequence[grpc.GenericRpcHandler]
34
+ ) -> None:
35
+ """Registers GenericRpcHandlers with this Server.
36
+
37
+ This method is only safe to call before the server is started.
38
+
39
+ Args:
40
+ generic_rpc_handlers: A sequence of GenericRpcHandlers that will be
41
+ used to service RPCs.
42
+ """
43
+
44
+ @abc.abstractmethod
45
+ def add_insecure_port(self, address: str) -> int:
46
+ """Opens an insecure port for accepting RPCs.
47
+
48
+ A port is a communication endpoint that used by networking protocols,
49
+ like TCP and UDP. To date, we only support TCP.
50
+
51
+ This method may only be called before starting the server.
52
+
53
+ Args:
54
+ address: The address for which to open a port. If the port is 0,
55
+ or not specified in the address, then the gRPC runtime will choose a port.
56
+
57
+ Returns:
58
+ An integer port on which the server will accept RPC requests.
59
+ """
60
+
61
+ @abc.abstractmethod
62
+ def add_secure_port(
63
+ self, address: str, server_credentials: grpc.ServerCredentials
64
+ ) -> int:
65
+ """Opens a secure port for accepting RPCs.
66
+
67
+ A port is a communication endpoint that used by networking protocols,
68
+ like TCP and UDP. To date, we only support TCP.
69
+
70
+ This method may only be called before starting the server.
71
+
72
+ Args:
73
+ address: The address for which to open a port.
74
+ if the port is 0, or not specified in the address, then the gRPC
75
+ runtime will choose a port.
76
+ server_credentials: A ServerCredentials object.
77
+
78
+ Returns:
79
+ An integer port on which the server will accept RPC requests.
80
+ """
81
+
82
+ @abc.abstractmethod
83
+ async def start(self) -> None:
84
+ """Starts this Server.
85
+
86
+ This method may only be called once. (i.e. it is not idempotent).
87
+ """
88
+
89
+ @abc.abstractmethod
90
+ async def stop(self, grace: Optional[float]) -> None:
91
+ """Stops this Server.
92
+
93
+ This method immediately stops the server from servicing new RPCs in
94
+ all cases.
95
+
96
+ If a grace period is specified, this method waits until all active
97
+ RPCs are finished or until the grace period is reached. RPCs that haven't
98
+ been terminated within the grace period are aborted.
99
+ If a grace period is not specified (by passing None for grace), all
100
+ existing RPCs are aborted immediately and this method blocks until
101
+ the last RPC handler terminates.
102
+
103
+ This method is idempotent and may be called at any time. Passing a
104
+ smaller grace value in a subsequent call will have the effect of
105
+ stopping the Server sooner (passing None will have the effect of
106
+ stopping the server immediately). Passing a larger grace value in a
107
+ subsequent call will not have the effect of stopping the server later
108
+ (i.e. the most restrictive grace value is used).
109
+
110
+ Args:
111
+ grace: A duration of time in seconds or None.
112
+ """
113
+
114
+ @abc.abstractmethod
115
+ async def wait_for_termination(
116
+ self, timeout: Optional[float] = None
117
+ ) -> bool:
118
+ """Continues current coroutine once the server stops.
119
+
120
+ This is an EXPERIMENTAL API.
121
+
122
+ The wait will not consume computational resources during blocking, and
123
+ it will block until one of the two following conditions are met:
124
+
125
+ 1) The server is stopped or terminated;
126
+ 2) A timeout occurs if timeout is not `None`.
127
+
128
+ The timeout argument works in the same way as `threading.Event.wait()`.
129
+ https://docs.python.org/3/library/threading.html#threading.Event.wait
130
+
131
+ Args:
132
+ timeout: A floating point number specifying a timeout for the
133
+ operation in seconds.
134
+
135
+ Returns:
136
+ A bool indicates if the operation times out.
137
+ """
138
+
139
+ def add_registered_method_handlers(self, service_name, method_handlers):
140
+ """Registers GenericRpcHandlers with this Server.
141
+
142
+ This method is only safe to call before the server is started.
143
+
144
+ Args:
145
+ service_name: The service name.
146
+ method_handlers: A dictionary that maps method names to corresponding
147
+ RpcMethodHandler.
148
+ """
149
+
150
+
151
+ # pylint: disable=too-many-public-methods
152
+ class ServicerContext(Generic[RequestType, ResponseType], abc.ABC):
153
+ """A context object passed to method implementations."""
154
+
155
+ @abc.abstractmethod
156
+ async def read(self) -> RequestType:
157
+ """Reads one message from the RPC.
158
+
159
+ Only one read operation is allowed simultaneously.
160
+
161
+ Returns:
162
+ A response message of the RPC.
163
+
164
+ Raises:
165
+ An RpcError exception if the read failed.
166
+ """
167
+
168
+ @abc.abstractmethod
169
+ async def write(self, message: ResponseType) -> None:
170
+ """Writes one message to the RPC.
171
+
172
+ Only one write operation is allowed simultaneously.
173
+
174
+ Raises:
175
+ An RpcError exception if the write failed.
176
+ """
177
+
178
+ @abc.abstractmethod
179
+ async def send_initial_metadata(
180
+ self, initial_metadata: MetadataType
181
+ ) -> None:
182
+ """Sends the initial metadata value to the client.
183
+
184
+ This method need not be called by implementations if they have no
185
+ metadata to add to what the gRPC runtime will transmit.
186
+
187
+ Args:
188
+ initial_metadata: The initial :term:`metadata`.
189
+ """
190
+
191
+ @abc.abstractmethod
192
+ async def abort(
193
+ self,
194
+ code: grpc.StatusCode,
195
+ details: str = "",
196
+ trailing_metadata: MetadataType = tuple(),
197
+ ) -> NoReturn:
198
+ """Raises an exception to terminate the RPC with a non-OK status.
199
+
200
+ The code and details passed as arguments will supersede any existing
201
+ ones.
202
+
203
+ Args:
204
+ code: A StatusCode object to be sent to the client.
205
+ It must not be StatusCode.OK.
206
+ details: A UTF-8-encodable string to be sent to the client upon
207
+ termination of the RPC.
208
+ trailing_metadata: A sequence of tuple represents the trailing
209
+ :term:`metadata`.
210
+
211
+ Raises:
212
+ Exception: An exception is always raised to signal the abortion the
213
+ RPC to the gRPC runtime.
214
+ """
215
+
216
+ @abc.abstractmethod
217
+ def set_trailing_metadata(self, trailing_metadata: MetadataType) -> None:
218
+ """Sends the trailing metadata for the RPC.
219
+
220
+ This method need not be called by implementations if they have no
221
+ metadata to add to what the gRPC runtime will transmit.
222
+
223
+ Args:
224
+ trailing_metadata: The trailing :term:`metadata`.
225
+ """
226
+
227
+ @abc.abstractmethod
228
+ def invocation_metadata(self) -> Optional[MetadataType]:
229
+ """Accesses the metadata sent by the client.
230
+
231
+ Returns:
232
+ The invocation :term:`metadata`.
233
+ """
234
+
235
+ @abc.abstractmethod
236
+ def set_code(self, code: grpc.StatusCode) -> None:
237
+ """Sets the value to be used as status code upon RPC completion.
238
+
239
+ This method need not be called by method implementations if they wish
240
+ the gRPC runtime to determine the status code of the RPC.
241
+
242
+ Args:
243
+ code: A StatusCode object to be sent to the client.
244
+ """
245
+
246
+ @abc.abstractmethod
247
+ def set_details(self, details: str) -> None:
248
+ """Sets the value to be used the as detail string upon RPC completion.
249
+
250
+ This method need not be called by method implementations if they have
251
+ no details to transmit.
252
+
253
+ Args:
254
+ details: A UTF-8-encodable string to be sent to the client upon
255
+ termination of the RPC.
256
+ """
257
+
258
+ @abc.abstractmethod
259
+ def set_compression(self, compression: grpc.Compression) -> None:
260
+ """Set the compression algorithm to be used for the entire call.
261
+
262
+ Args:
263
+ compression: An element of grpc.compression, e.g.
264
+ grpc.compression.Gzip.
265
+ """
266
+
267
+ @abc.abstractmethod
268
+ def disable_next_message_compression(self) -> None:
269
+ """Disables compression for the next response message.
270
+
271
+ This method will override any compression configuration set during
272
+ server creation or set on the call.
273
+ """
274
+
275
+ @abc.abstractmethod
276
+ def peer(self) -> str:
277
+ """Identifies the peer that invoked the RPC being serviced.
278
+
279
+ Returns:
280
+ A string identifying the peer that invoked the RPC being serviced.
281
+ The string format is determined by gRPC runtime.
282
+ """
283
+
284
+ @abc.abstractmethod
285
+ def peer_identities(self) -> Optional[Iterable[bytes]]:
286
+ """Gets one or more peer identity(s).
287
+
288
+ Equivalent to
289
+ servicer_context.auth_context().get(servicer_context.peer_identity_key())
290
+
291
+ Returns:
292
+ An iterable of the identities, or None if the call is not
293
+ authenticated. Each identity is returned as a raw bytes type.
294
+ """
295
+
296
+ @abc.abstractmethod
297
+ def peer_identity_key(self) -> Optional[str]:
298
+ """The auth property used to identify the peer.
299
+
300
+ For example, "x509_common_name" or "x509_subject_alternative_name" are
301
+ used to identify an SSL peer.
302
+
303
+ Returns:
304
+ The auth property (string) that indicates the
305
+ peer identity, or None if the call is not authenticated.
306
+ """
307
+
308
+ @abc.abstractmethod
309
+ def auth_context(self) -> Mapping[str, Iterable[bytes]]:
310
+ """Gets the auth context for the call.
311
+
312
+ Returns:
313
+ A map of strings to an iterable of bytes for each auth property.
314
+ """
315
+
316
+ def time_remaining(self) -> float:
317
+ """Describes the length of allowed time remaining for the RPC.
318
+
319
+ Returns:
320
+ A nonnegative float indicating the length of allowed time in seconds
321
+ remaining for the RPC to complete before it is considered to have
322
+ timed out, or None if no deadline was specified for the RPC.
323
+ """
324
+
325
+ def trailing_metadata(self):
326
+ """Access value to be used as trailing metadata upon RPC completion.
327
+
328
+ This is an EXPERIMENTAL API.
329
+
330
+ Returns:
331
+ The trailing :term:`metadata` for the RPC.
332
+ """
333
+ raise NotImplementedError()
334
+
335
+ def code(self):
336
+ """Accesses the value to be used as status code upon RPC completion.
337
+
338
+ This is an EXPERIMENTAL API.
339
+
340
+ Returns:
341
+ The StatusCode value for the RPC.
342
+ """
343
+ raise NotImplementedError()
344
+
345
+ def details(self):
346
+ """Accesses the value to be used as detail string upon RPC completion.
347
+
348
+ This is an EXPERIMENTAL API.
349
+
350
+ Returns:
351
+ The details string of the RPC.
352
+ """
353
+ raise NotImplementedError()
354
+
355
+ def add_done_callback(self, callback: DoneCallbackType) -> None:
356
+ """Registers a callback to be called on RPC termination.
357
+
358
+ This is an EXPERIMENTAL API.
359
+
360
+ Args:
361
+ callback: A callable object will be called with the servicer context
362
+ object as its only argument.
363
+ """
364
+
365
+ def cancelled(self) -> bool:
366
+ """Return True if the RPC is cancelled.
367
+
368
+ The RPC is cancelled when the cancellation was requested with cancel().
369
+
370
+ This is an EXPERIMENTAL API.
371
+
372
+ Returns:
373
+ A bool indicates whether the RPC is cancelled or not.
374
+ """
375
+
376
+ def done(self) -> bool:
377
+ """Return True if the RPC is done.
378
+
379
+ An RPC is done if the RPC is completed, cancelled or aborted.
380
+
381
+ This is an EXPERIMENTAL API.
382
+
383
+ Returns:
384
+ A bool indicates if the RPC is done.
385
+ """