Flows
Reraise
Bases: SimpleContextManager
, Generic[E]
Represents context managers that reraise errors of given error_types
as error
.
Source code in src/funcs/flows.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
error: E
instance-attribute
The error to raise.
error_types: AnyErrorTypes
instance-attribute
The error types to reraise.
ReraiseWith
Bases: SimpleContextManager
, Generic[E]
Represents context managers that reraise errors of given error_types
as error
,
which is computed dynamically from the original error.
Source code in src/funcs/flows.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
into: Into[E]
instance-attribute
The function that computes the error to raise from the original error.
error_types: AnyErrorTypes
instance-attribute
The error types to reraise.
Suppress
Represents context managers that suppress errors of given error_types
.
Source code in src/funcs/flows.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
error_types: AnyErrorTypes
instance-attribute
The error types to suppress.
PostProcessing
Bases: Generic[R, S]
Represents decorators that post-process results of function calls.
Source code in src/funcs/flows.py
171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
WrapWith
Represents decorators that wrap function calls with the given context_manager
.
Source code in src/funcs/flows.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
context_manager: AnyContextManager
instance-attribute
The context manager to wrap function calls with.
once(function: Callable[P, R]) -> Callable[P, R]
Wraps the function to be called once, and then the computed result is returned on subsequent calls.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function |
Callable[P, R]
|
The function to wrap. |
required |
Returns:
Type | Description |
---|---|
Callable[P, R]
|
The wrapped function. |
Source code in src/funcs/flows.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
reraise(error: E, *error_types: AnyErrorType) -> Reraise[E]
Constructs the Reraise[E]
context manager
that reraises errors of given error_types
as error
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error |
E
|
The error to raise. |
required |
*error_types |
AnyErrorType
|
The error types to reraise. |
()
|
Returns:
Type | Description |
---|---|
Reraise[E]
|
The constructed |
Source code in src/funcs/flows.py
80 81 82 83 84 85 86 87 88 89 90 91 |
|
reraise_with(into: Into[E], *error_types: AnyErrorType) -> ReraiseWith[E]
Constructs the ReraiseWith[E]
context manager
that reraises errors of given error_types
as error
, which is computed dynamically
from the original error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
into |
Into[E]
|
The function that computes the error to raise from the original error. |
required |
*error_types |
AnyErrorType
|
The error types to reraise. |
()
|
Returns:
Type | Description |
---|---|
ReraiseWith[E]
|
The constructed |
Source code in src/funcs/flows.py
120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
suppress(*error_types: AnyErrorType) -> Suppress
Constructs the Suppress
context manager used to suppress
errors of given error_types
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*error_types |
AnyErrorType
|
The error types to suppress. |
()
|
Returns:
Type | Description |
---|---|
Suppress
|
The constructed |
Source code in src/funcs/flows.py
158 159 160 161 162 163 164 165 166 167 168 |
|
post_processing(function: Unary[R, S]) -> PostProcessing[R, S]
Constructs the PostProcessing[R, S]
decorator
which post-processes results of function calls.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function |
Unary[R, S]
|
The post-processing function. |
required |
Returns:
Type | Description |
---|---|
PostProcessing[R, S]
|
The constructed |
Source code in src/funcs/flows.py
186 187 188 189 190 191 192 193 194 195 196 |
|
wrap_with(context_manager: AnyContextManager) -> WrapWith
Constructs the WrapWith
decorator that wraps function calls
with the given context_manager
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context_manager |
AnyContextManager
|
The context manager to wrap function calls with. |
required |
Returns:
Type | Description |
---|---|
WrapWith
|
The constructed |
Source code in src/funcs/flows.py
215 216 217 218 219 220 221 222 223 224 225 |
|