|
15 | 15 | # specific language governing permissions and limitations |
16 | 16 | # under the License. |
17 | 17 |
|
18 | | -from typing import final |
| 18 | +# This file is automatically generated by pyo3_stub_gen |
| 19 | +# ruff: noqa: E501, F401 |
19 | 20 |
|
20 | | -class Layer: ... |
| 21 | +import builtins |
| 22 | +import typing |
21 | 23 |
|
22 | | -@final |
23 | | -class RetryLayer(Layer): |
24 | | - def __init__( |
25 | | - self, |
26 | | - max_times: int | None = None, |
27 | | - factor: float | None = None, |
28 | | - jitter: bool = False, |
29 | | - max_delay: float | None = None, |
30 | | - min_delay: float | None = None, |
31 | | - ) -> None: ... |
32 | | - |
33 | | -@final |
| 24 | +@typing.final |
34 | 25 | class ConcurrentLimitLayer(Layer): |
35 | | - def __init__(self, limit: int) -> None: ... |
| 26 | + r""" |
| 27 | + ConcurrentLimitLayer. |
| 28 | +
|
| 29 | + Create a layer that limits the number of concurrent operations. |
| 30 | +
|
| 31 | + Notes |
| 32 | + ----- |
| 33 | + All operators wrapped by this layer will share a common semaphore. This |
| 34 | + allows you to reuse the same layer across multiple operators, ensuring |
| 35 | + that the total number of concurrent requests across the entire |
| 36 | + application does not exceed the limit. |
| 37 | + """ |
| 38 | + |
| 39 | + def __new__(cls, limit: builtins.int) -> ConcurrentLimitLayer: |
| 40 | + r""" |
| 41 | + Create a new ConcurrentLimitLayer. |
| 42 | +
|
| 43 | + Parameters |
| 44 | + ---------- |
| 45 | + limit : int |
| 46 | + Maximum number of concurrent operations allowed. |
| 47 | +
|
| 48 | + Returns |
| 49 | + ------- |
| 50 | + ConcurrentLimitLayer |
| 51 | + """ |
36 | 52 |
|
37 | | -@final |
| 53 | +class Layer: |
| 54 | + r""" |
| 55 | + Layer. |
| 56 | +
|
| 57 | + Layers are used to intercept the operations on the underlying storage. |
| 58 | + """ |
| 59 | + |
| 60 | +@typing.final |
38 | 61 | class MimeGuessLayer(Layer): |
39 | | - def __init__(self) -> None: ... |
| 62 | + r""" |
| 63 | + MimeGuessLayer. |
| 64 | +
|
| 65 | + Create a layer that guesses MIME types for objects based on their |
| 66 | + paths or content. |
| 67 | +
|
| 68 | + This layer uses the `mime_guess` crate |
| 69 | + (see https://crates.io/crates/mime_guess) to infer the |
| 70 | + ``Content-Type``. |
| 71 | +
|
| 72 | + Notes |
| 73 | + ----- |
| 74 | + This layer will not override a ``Content-Type`` that has already |
| 75 | + been set, either manually or by the backend service. It is only |
| 76 | + applied if no content type is present. |
| 77 | +
|
| 78 | + A ``Content-Type`` is not guaranteed. If the file extension is |
| 79 | + uncommon or unknown, the content type will remain unset. |
| 80 | + """ |
| 81 | + |
| 82 | + def __new__(cls) -> MimeGuessLayer: |
| 83 | + r""" |
| 84 | + Create a new MimeGuessLayer. |
| 85 | +
|
| 86 | + Returns |
| 87 | + ------- |
| 88 | + MimeGuessLayer |
| 89 | + """ |
| 90 | + |
| 91 | +@typing.final |
| 92 | +class RetryLayer(Layer): |
| 93 | + r""" |
| 94 | + RetryLayer. |
| 95 | +
|
| 96 | + A layer that retries operations that fail with temporary errors. |
| 97 | +
|
| 98 | + Operations are retried if they fail with an error for which |
| 99 | + `Error.is_temporary` returns `True`. If all retries are exhausted, |
| 100 | + the error is marked as persistent and then returned. |
| 101 | +
|
| 102 | + Notes |
| 103 | + ----- |
| 104 | + After an operation on a `Reader` or `Writer` has failed through |
| 105 | + all retries, the object is in an undefined state. Reusing it |
| 106 | + can lead to exceptions. |
| 107 | + """ |
| 108 | + |
| 109 | + def __new__( |
| 110 | + cls, |
| 111 | + max_times: builtins.int | None = None, |
| 112 | + factor: builtins.float | None = None, |
| 113 | + jitter: builtins.bool = False, |
| 114 | + max_delay: builtins.float | None = None, |
| 115 | + min_delay: builtins.float | None = None, |
| 116 | + ) -> RetryLayer: |
| 117 | + r""" |
| 118 | + Create a new RetryLayer. |
| 119 | +
|
| 120 | + Parameters |
| 121 | + ---------- |
| 122 | + max_times : Optional[int] |
| 123 | + Maximum number of retry attempts. Defaults to ``3``. |
| 124 | + factor : Optional[float] |
| 125 | + Backoff factor applied between retries. Defaults to ``2.0``. |
| 126 | + jitter : bool |
| 127 | + Whether to apply jitter to the backoff. Defaults to ``False``. |
| 128 | + max_delay : Optional[float] |
| 129 | + Maximum delay (in seconds) between retries. Defaults to ``60.0``. |
| 130 | + min_delay : Optional[float] |
| 131 | + Minimum delay (in seconds) between retries. Defaults to ``1.0``. |
| 132 | +
|
| 133 | + Returns |
| 134 | + ------- |
| 135 | + RetryLayer |
| 136 | + """ |
0 commit comments