Technical Reference
pipeline.core.pipe.pipe
Pipe
Bases: Generic[V, T]
A Pipe processes a single value through validation, matching, and transformation steps.
The execution flow is strict:
1. Optional Check: If the pipe is optional and the value is falsy, it returns early.
2. Type Validation: Checks if the value matches the expected type (via Condition.ValueType).
3. Conditions: Runs a set of condition handlers. If any fail, errors are collected, and processing
may stop if BREAK_PIPE_LOOP_ON_ERROR flag is set.
4. Matches: Only if no condition errors occurred, match handlers are executed. These are typically
regex-based checks.
5. Transform: Only if no match errors occurred, transform handlers are executed to modify the value.
Attributes:
| Name | Type | Description |
|---|---|---|
Condition |
Type[Condition]
|
The condition handler class registry. |
Match |
Type[Match]
|
The match handler class registry. |
Transform |
Type[Transform]
|
The transform handler class registry. |
Source code in pipeline/core/pipe/pipe.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
__init__(value, type, conditions=None, matches=None, transform=None, optional=None, context=None, metadata=None)
Initializes the Pipe with a value, type, and processing configurations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
V
|
The value to process. |
required |
type
|
T
|
The expected type of the value (e.g., |
required |
conditions
|
Optional[PipeConditions]
|
A dictionary of condition handlers and their arguments.
Used for logical validation (e.g., |
None
|
matches
|
Optional[PipeMatches]
|
A dictionary of match handlers and their arguments.
Used for pattern matching (e.g., |
None
|
transform
|
Optional[PipeTransform]
|
A dictionary of transform handlers and their arguments.
Used for data modification (e.g., |
None
|
optional
|
Optional[bool]
|
If True, the pipe is skipped if the value is falsy. |
None
|
context
|
Optional[PipeContext]
|
Additional context for the handlers, typically the entire data dictionary being processed. |
None
|
metadata
|
Optional[PipeMetadata]
|
Metadata about the pipe execution. |
None
|
Source code in pipeline/core/pipe/pipe.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
run()
Executes the pipe processing logic.
The method strictly follows the defined order of operations. Note that Transformations are ONLY applied if all validations (Conditions and Matches) pass. This provides a safe way to transform data, ensuring it is valid first.
Returns:
| Type | Description |
|---|---|
PipeResult[V]
|
PipeResult[V]: The result containing the processed value (or original value if errors occurred) |
PipeResult[V]
|
and lists of any condition or match errors. |
Source code in pipeline/core/pipe/pipe.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
pipeline.core.pipeline.pipeline
Pipeline
The Pipeline class orchestrates the execution of multiple pipes on a data dictionary.
It allows defining a sequence of processing steps (pipes) for specific fields in the input data. The pipeline iterates over the configuration, applies the corresponding pipe to each field, and aggregates any errors encountered. Hooks can be registered to execute before and after each pipe, allowing for side effects or custom logic. A custom error handler can also be provided to process aggregated errors.
Attributes:
| Name | Type | Description |
|---|---|---|
global_pre_hook |
ClassVar[PipelineHookFunc | None]
|
A function to be called before each pipe execution. |
global_post_hook |
ClassVar[PipelineHookFunc | None]
|
A function to be called after each pipe execution. |
global_handle_errors |
ClassVar[PipelineHandleErrorsFunc | None]
|
A function to handle errors collected during pipeline execution. This could be used to raise exceptions, log errors, or format them for a response. |
Source code in pipeline/core/pipeline/pipeline.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
global_handle_errors = None
class-attribute
A function to handle errors collected during pipeline execution.
global_post_hook = None
class-attribute
A function to be called after each pipe execution.
global_pre_hook = None
class-attribute
A function to be called before each pipe execution.
__call__(func)
Decorator to run the pipeline before a function execution.
When the decorated function is called, the pipeline is run using the function's
keyword arguments (kwargs) as the input data. If validation fails, and no
handle_errors is provided, a PipelineException is raised.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Any
|
The function to be decorated. The pipeline will run on the keyword arguments passed to this function. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The wrapped function. |
Raises:
| Type | Description |
|---|---|
PipelineException
|
If the pipeline encounters errors and no error handler is defined. |
Source code in pipeline/core/pipeline/pipeline.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
__init__(pre_hook=None, post_hook=None, handle_errors=None, **pipes_config)
Initializes the Pipeline with a configuration of pipes.
The pipes_config defines the schema and validation rules for the data. Each key in
pipes_config corresponds to a key in the input data dictionary. The value is a
dictionary of arguments required to initialize a Pipe instance (e.g., type,
conditions, matches).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pre_hook
|
PipelineHookFunc | None
|
A function to be called before each pipe execution. The global_pre_hook will not run if a local pre_hook is defined. |
None
|
post_hook
|
PipelineHookFunc | None
|
A function to be called after each pipe execution. The global_post_hook will not run if a local pre_hook is defined. |
None
|
handle_errors
|
PipelineHandleErrorsFunc | None
|
A function to handle errors collected during pipeline execution. This could be used to raise exceptions, log errors, or format them for a response. The global_handle_errors will not run if a local handle_errors is defined. |
None
|
**pipes_config
|
PipelinePipeConfig
|
Configuration for the pipes. Keys represent the fields in the data dictionary to be processed, and values are the configuration for the corresponding pipe. |
{}
|
Source code in pipeline/core/pipeline/pipeline.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
run(data)
Runs the pipeline on the provided data.
This method iterates through the pipes_config. For each field, it executes
the internal self._process_field_pipe method.
After processing all fields, if handle_errors is defined, it is called with the
collected errors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
The input data dictionary to process. The dictionary may be modified in-place with transformed values. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PipelineResult |
PipelineResult
|
A namedtuple containing the fields errors and processed_data. The processed_data field contains the final, trustworthy data and will be |
Source code in pipeline/core/pipeline/pipeline.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
pipeline.handlers.base_handler.base_handler
BaseHandler
Bases: ABC, Generic[V, A]
Abstract base class for all handlers in the pipeline.
Handlers are the building blocks of the pipeline, responsible for processing values (validation, matching, transformation) based on provided arguments and context. They support different modes of operation to handle single values, items in a collection, or values dependent on other context fields.
Attributes:
| Name | Type | Description |
|---|---|---|
FLAGS |
ClassVar[tuple[Flag, ...]]
|
Flags acting as settings for the handler.
Example: |
SUPPORT |
ClassVar[tuple[HandlerMode, ...]]
|
Supported handler modes.
- |
CONTEXT_ARGUMENT_BUILDER |
ClassVar[Optional[Callable]]
|
Helper to build arguments from context. Used in CONTEXT mode to transform the context value before using it as an argument. |
Source code in pipeline/handlers/base_handler/base_handler.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
id
property
Returns a unique identifier for the handler based on its class name.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The snake_case identifier of the handler (e.g., 'MaxLength' -> 'max_length'). |
__init__(value, argument, context=None, metadata=None, _mode=HandlerMode.ROOT, _item_use_key=False, _preferred_value_type=None)
Initializes the BaseHandler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
V
|
The value to process. |
required |
argument
|
A
|
The argument for the handler. |
required |
context
|
Optional[PipeContext]
|
Additional context for the handler. |
None
|
metadata
|
Optional[PipeMetadata]
|
Metadata about the pipe execution. |
None
|
_mode
|
HandlerMode
|
The mode in which the handler is operating. |
ROOT
|
_item_use_key
|
Optional[bool]
|
If True and in ITEM mode, the handler operates on the key of a dictionary item instead of the value. |
False
|
_preferred_value_type
|
Optional[type]
|
Specific type to prefer/enforce during type validation. |
None
|
Source code in pipeline/handlers/base_handler/base_handler.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
handle()
Executes the handler logic based on the current mode.
It delegates to _handle() for ROOT and CONTEXT modes, and _handle_item_mode()
for ITEM mode.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The result of the handling operation. The return type depends on the specific |
Any
|
handler implementation (e.g., specific error type, boolean, or transformed value). |
Raises:
| Type | Description |
|---|---|
HandlerException
|
If the handler mode is invalid. |
Source code in pipeline/handlers/base_handler/base_handler.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
pipeline.handlers.base_handler.handler_modifiers
Context(handler)
Modifier ensure the handler is run in CONTEXT mode.
In CONTEXT mode, the handler's argument is retrieved from the pipeline context using the provided argument as a key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handler
|
Type[T]
|
The handler class to modify. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
partial |
A partial application of the handler with _mode=HandlerMode.CONTEXT. |
Source code in pipeline/handlers/base_handler/handler_modifiers.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
Item(handler, use_key=False, only_consider=None)
Modifier to ensure the handler is run in ITEM mode.
In ITEM mode, the handler is applied to each item in an iterable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handler
|
Type[T] | partial[T]
|
The handler class or partial to modify. |
required |
use_key
|
Optional[bool]
|
If True, the handler uses the item's key (e.g., in a dictionary) instead of value. |
False
|
only_consider
|
Optional[type]
|
Specific type to filter items for processing. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
partial |
A partial application of the handler with ITEM mode settings. |
Source code in pipeline/handlers/base_handler/handler_modifiers.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
pipeline.handlers.condition_handler.condition_handler
ConditionHandler
Bases: BaseHandler[V, A]
Abstract base class for specific condition implementations.
This class provides the infrastructure for condition checking, including error message generation
and support for different handling modes (ROOT, ITEM).
It expects subclasses to implement the query method.
Source code in pipeline/handlers/condition_handler/condition_handler.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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
error_msg
property
Generates the error message based on the current mode and error templates.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The generated error message. |
Raises:
| Type | Description |
|---|---|
ConditionMissingRootErrorMsg
|
If the root error template is missing. |
__init__(value, argument, context=None, metadata=None, _mode=HandlerMode.ROOT, _item_use_key=False, _preferred_value_type=None)
Initializes the ConditionHandler.
It ensures that if ROOT mode is supported, a corresponding error template is present.
Source code in pipeline/handlers/condition_handler/condition_handler.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
query()
abstractmethod
Performs the condition check.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the condition is met, False otherwise. |
Source code in pipeline/handlers/condition_handler/condition_handler.py
65 66 67 68 69 70 71 72 73 | |
pipeline.handlers.condition_handler.condition
Condition
Registry for all condition handlers.
This class groups all available condition handlers (e.g., ValueType, MinLength, Equal) for easy access.
Source code in pipeline/handlers/condition_handler/condition.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
DoesNotMatchField
Bases: ConditionHandler[Any, Any]
Validates that the current value does not match the value of another field in the context (e.g., new password != old password)
Source code in pipeline/handlers/condition_handler/condition.py
157 158 159 160 161 162 163 164 165 166 167 168 | |
Equal
Bases: ConditionHandler[Any, Any]
Ensures the value is strictly equal to the argument or a specific context field
Source code in pipeline/handlers/condition_handler/condition.py
121 122 123 124 125 126 127 128 129 130 131 | |
IncludedIn
Bases: ConditionHandler[Any, Iterable]
Ensures the value exists within the provided Iterable
Source code in pipeline/handlers/condition_handler/condition.py
95 96 97 98 99 100 101 102 103 104 105 106 | |
MatchesField
Bases: ConditionHandler[Any, Any]
Validates that the current value matches the value of another field in the context (e.g., password confirmation)
Source code in pipeline/handlers/condition_handler/condition.py
145 146 147 148 149 150 151 152 153 154 155 | |
MaxLength
Bases: ConditionHandler[str | list | dict, int]
Ensures the collection or string does not exceed N items/characters
Source code in pipeline/handlers/condition_handler/condition.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
MaxNumber
Bases: ConditionHandler[int | float, int | float]
Ensures the numeric value is less than or equal to N
Source code in pipeline/handlers/condition_handler/condition.py
84 85 86 87 88 89 90 91 92 93 | |
MinLength
Bases: ConditionHandler[str | list | dict, int]
Ensures the collection or string has at least N items/characters
Source code in pipeline/handlers/condition_handler/condition.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
MinNumber
Bases: ConditionHandler[int | float, int | float]
Ensures the numeric value is greater than or equal to N
Source code in pipeline/handlers/condition_handler/condition.py
72 73 74 75 76 77 78 79 80 81 82 | |
NotEqual
Bases: ConditionHandler[Any, Any]
Ensures the value is strictly not equal to the argument or a specific context field
Source code in pipeline/handlers/condition_handler/condition.py
133 134 135 136 137 138 139 140 141 142 143 | |
NotIncludedIn
Bases: ConditionHandler[Any, Iterable]
Ensures the value does not exist within the provided blacklist
Source code in pipeline/handlers/condition_handler/condition.py
108 109 110 111 112 113 114 115 116 117 118 119 | |
Pipeline
Bases: ConditionHandler[dict, Pipeline]
Validates a dictionary using the same rules as the normal pipeline, but for nested data.
Source code in pipeline/handlers/condition_handler/condition.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
ValueType
Bases: ConditionHandler[Any, type]
A built-in condition handler to validate the type of the value.
This handler is automatically used by the Pipe to ensure the passed value matches the expected type defined in the Pipe.
Source code in pipeline/handlers/condition_handler/condition.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
pipeline.handlers.match_handler.match_handler
MatchHandler
Bases: ConditionHandler[V, A]
Base class for match handlers.
Match handlers extend condition handlers to provide specific matching capabilities, often involving regular expressions or patterns.
Source code in pipeline/handlers/match_handler/match_handler.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
fullmatch(pattern, flag=None)
Checks if the entire value matches the pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str | Pattern
|
The regex pattern to match against. |
required |
flag
|
Optional[RegexFlag]
|
Optional regex flags. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the entire value matches the pattern, False otherwise. |
Source code in pipeline/handlers/match_handler/match_handler.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
search(pattern, flag=None)
Searches for the pattern in the value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str | Pattern
|
The regex pattern to search for. |
required |
flag
|
Optional[RegexFlag]
|
Optional regex flags. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the pattern is found, False otherwise. |
Source code in pipeline/handlers/match_handler/match_handler.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
pipeline.handlers.match_handler.match
Match
Central registry for all match handler units.
This class provides a convenient way to access different match handlers (e.g., Text, Regex, Web) from a single location.
Source code in pipeline/handlers/match_handler/match.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
MatchEncoding
Registry for encoding-related match handlers.
Includes handlers for Base64, JSON, etc.
Source code in pipeline/handlers/match_handler/units/match_encoding.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
Base64
Bases: MatchHandler[str, None]
Checks if string is valid Base64 encoded
Source code in pipeline/handlers/match_handler/units/match_encoding.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
JSON
Bases: MatchHandler[str, None]
Validates that a string is a correctly formatted JSON object or array
Source code in pipeline/handlers/match_handler/units/match_encoding.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
MatchFormat
Registry for format-related match handlers.
Includes handlers for Email, UUID, HexColor, etc.
Source code in pipeline/handlers/match_handler/units/match_format.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
E164Phone
Bases: MatchHandler[str, None]
International phone numbers in E.164 format (e.g., +1234567890)
Source code in pipeline/handlers/match_handler/units/match_format.py
53 54 55 56 57 58 59 60 61 62 63 | |
Email
Bases: MatchHandler[str, None]
Accepts email addresses with standard user, domain, and TLD parts
Source code in pipeline/handlers/match_handler/units/match_format.py
17 18 19 20 21 22 23 24 25 26 27 28 | |
HexColor
Bases: MatchHandler[str, None]
Accepts hex colors in 3 or 6 digit formats (e.g., #F00, #FF0000)
Source code in pipeline/handlers/match_handler/units/match_format.py
41 42 43 44 45 46 47 48 49 50 51 | |
Password
Bases: MatchHandler[str, str]
Validates password strength based on three policies: RELAXED, NORMAL, or STRICT.
Policies: - RELAXED: 6-64 chars, 1 uppercase, 1 lowercase. - NORMAL: 6-64 chars, 1 uppercase, 1 lowercase, 1 digit. - STRICT: 6-64 chars, 1 uppercase, 1 lowercase, 1 digit, 1 special character.
Requires a policy argument (e.g., Match.Format.Password.NORMAL)
Source code in pipeline/handlers/match_handler/units/match_format.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
UUID
Bases: MatchHandler[str, None]
Validates 36-character hexadecimal unique identifiers (8-4-4-4-12)
Source code in pipeline/handlers/match_handler/units/match_format.py
30 31 32 33 34 35 36 37 38 39 | |
MatchLocalization
Registry for localization-related match handlers.
Includes handlers for Country, Currency, Language (ISO codes), and Timezones.
Source code in pipeline/handlers/match_handler/units/match_localization.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
Country
Bases: MatchHandler[str, None]
ISO 3166-1 alpha-2 (e.g., 'US', 'DE', 'JP')
Source code in pipeline/handlers/match_handler/units/match_localization.py
18 19 20 21 22 23 24 25 26 27 28 | |
Currency
Bases: MatchHandler[str, None]
ISO 4217 (e.g., 'USD', 'EUR', 'BTC')
Source code in pipeline/handlers/match_handler/units/match_localization.py
30 31 32 33 34 35 36 37 38 39 40 | |
Language
Bases: MatchHandler[str, None]
ISO 639-1 (e.g., 'en', 'fr', 'zh')
Source code in pipeline/handlers/match_handler/units/match_localization.py
42 43 44 45 46 47 48 49 50 51 52 | |
Timezone
Bases: MatchHandler[str, None]
IANA Timezone (e.g., 'America/New_York', 'Europe/London')
Source code in pipeline/handlers/match_handler/units/match_localization.py
54 55 56 57 58 59 60 61 62 63 | |
MatchNetwork
Registry for network-related match handlers.
Includes handlers for IPv4, IPv6, MAC Addresses, etc.
Source code in pipeline/handlers/match_handler/units/match_network.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
IPv4
Bases: MatchHandler[str, None]
Validates a standard IPv4 address (e.g., '192.168.1.1')
Source code in pipeline/handlers/match_handler/units/match_network.py
15 16 17 18 19 20 21 22 23 24 25 | |
IPv6
Bases: MatchHandler[str, None]
Validates an IPv6 address (e.g., '2001:db8::ff00:42:8329')
Source code in pipeline/handlers/match_handler/units/match_network.py
27 28 29 30 31 32 33 34 35 36 37 | |
MACAddress
Bases: MatchHandler[str, None]
Accepts hardware MAC addresses using colon, hyphen, or dot separators
Source code in pipeline/handlers/match_handler/units/match_network.py
39 40 41 42 43 44 45 46 47 48 49 50 | |
MatchRegex
Registry for regex-related match handlers.
Includes handlers for Search and FullMatch.
Source code in pipeline/handlers/match_handler/units/match_regex.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
FullMatch
Bases: MatchHandler[str, str | Pattern]
Accepts values that match the provided regex pattern in their entirety
Source code in pipeline/handlers/match_handler/units/match_regex.py
28 29 30 31 32 33 34 35 36 37 38 39 | |
Search
Bases: MatchHandler[str, str | Pattern]
Accepts values that contain at least one match of the provided regex pattern
Source code in pipeline/handlers/match_handler/units/match_regex.py
15 16 17 18 19 20 21 22 23 24 25 26 | |
MatchText
Registry for text-related match handlers.
Includes handlers for Lowercase, Uppercase, Digits, etc.
Source code in pipeline/handlers/match_handler/units/match_text.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
Alphanumeric
Bases: MatchHandler[str, None]
Accepts letters and numeric digits. No symbols or spaces
Source code in pipeline/handlers/match_handler/units/match_text.py
57 58 59 60 61 62 63 64 65 66 | |
Digits
Bases: MatchHandler[str, None]
Accepts ONLY numeric digits (0-9)
Source code in pipeline/handlers/match_handler/units/match_text.py
46 47 48 49 50 51 52 53 54 55 | |
Letters
Bases: MatchHandler[str, None]
Accepts ONLY case English letters (a-z, A-Z)
Source code in pipeline/handlers/match_handler/units/match_text.py
35 36 37 38 39 40 41 42 43 44 | |
Lowercase
Bases: MatchHandler[str, None]
Accepts ONLY lowercase English letters (a-z)
Source code in pipeline/handlers/match_handler/units/match_text.py
13 14 15 16 17 18 19 20 21 22 | |
NoWhitespace
Bases: MatchHandler[str, None]
Ensures string contains no spaces, tabs, or line breaks
Source code in pipeline/handlers/match_handler/units/match_text.py
80 81 82 83 84 85 86 87 88 89 | |
Printable
Bases: MatchHandler[str, None]
Accepts letters, numbers, symbols, and spaces (ASCII 20-7E)
Source code in pipeline/handlers/match_handler/units/match_text.py
68 69 70 71 72 73 74 75 76 77 78 | |
Slug
Bases: MatchHandler[str, None]
URL-friendly strings: 'my-cool-post-123'
Source code in pipeline/handlers/match_handler/units/match_text.py
91 92 93 94 95 96 97 98 99 100 101 | |
Uppercase
Bases: MatchHandler[str, None]
Accepts ONLY uppercase English letters (A-Z)
Source code in pipeline/handlers/match_handler/units/match_text.py
24 25 26 27 28 29 30 31 32 33 | |
MatchTime
Registry for time-related match handlers.
Includes handlers for Date, Time, and DateTime (ISO 8601).
Source code in pipeline/handlers/match_handler/units/match_time.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
Date
Bases: MatchHandler[str, None]
Validates YYYY-MM-DD format
Source code in pipeline/handlers/match_handler/units/match_time.py
13 14 15 16 17 18 19 20 21 22 23 24 | |
DateTime
Bases: MatchHandler[str, None]
Validates ISO 8601 combined Date and Time (e.g., 2023-10-01T14:30:00Z)
Source code in pipeline/handlers/match_handler/units/match_time.py
37 38 39 40 41 42 43 44 45 46 47 48 | |
Time
Bases: MatchHandler[str, None]
Validates 24h time in HH:MM or HH:MM:SS format
Source code in pipeline/handlers/match_handler/units/match_time.py
26 27 28 29 30 31 32 33 34 35 | |
MatchWeb
Registry for web-related match handlers.
Includes handlers for Domain and URL.
Source code in pipeline/handlers/match_handler/units/match_web.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
Domain
Bases: MatchHandler[str, None]
Validates a domain name based on RFC 1035.
Source code in pipeline/handlers/match_handler/units/match_web.py
14 15 16 17 18 19 20 21 22 23 | |
URL
Bases: MatchHandler[str, None]
Validates web URLs using HTTP or HTTPS protocols.
Source code in pipeline/handlers/match_handler/units/match_web.py
25 26 27 28 29 30 31 32 33 34 | |
pipeline.handlers.transform_handler.transform_handler
TransformHandler
Bases: BaseHandler[V, A]
Abstract base class for transform handlers.
Transform handlers modify the input value and return the transformed value.
They must implement the operation method.
Source code in pipeline/handlers/transform_handler/transform_handler.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
operation()
abstractmethod
Performs the transformation operation.
Returns:
| Name | Type | Description |
|---|---|---|
V |
V
|
The transformed value. |
Source code in pipeline/handlers/transform_handler/transform_handler.py
18 19 20 21 22 23 24 25 26 | |
pipeline.handlers.transform_handler.transform
Transform
Central registry for all transform handlers.
Transform handlers modify the value in some way, such as changing case, replacing substrings, or performing arithmetic operations.
Source code in pipeline/handlers/transform_handler/transform.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
Capitalize
Bases: TransformHandler[str, None]
Converts the first character to uppercase and the rest to lowercase
Source code in pipeline/handlers/transform_handler/transform.py
23 24 25 26 27 28 | |
Lowercase
Bases: TransformHandler[str, None]
Converts all characters in the string to lowercase
Source code in pipeline/handlers/transform_handler/transform.py
30 31 32 33 34 35 | |
Multiply
Bases: TransformHandler[str | list | int | float, int | float]
Multiplies a string, list, integer or float by the provided argument
If the value is not numeric, the argument is rounded before multiplication.
Source code in pipeline/handlers/transform_handler/transform.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
Replace
Bases: TransformHandler[str, tuple]
Replaces all occurrences of a substring with another (old, new)
Source code in pipeline/handlers/transform_handler/transform.py
88 89 90 91 92 93 94 95 | |
Reverse
Bases: TransformHandler[str | list, None]
Reverses the order of characters in a string or items in a list
Source code in pipeline/handlers/transform_handler/transform.py
58 59 60 61 62 63 | |
SnakeCase
Bases: TransformHandler[str, None]
Converts strings to snake_case (e.g., 'HelloWorld' -> 'hello_world')
Source code in pipeline/handlers/transform_handler/transform.py
72 73 74 75 76 77 78 79 | |
Strip
Bases: TransformHandler[str, Optional[str]]
Removes leading and trailing whitespace from a string
Source code in pipeline/handlers/transform_handler/transform.py
16 17 18 19 20 21 | |
Title
Bases: TransformHandler[str, None]
Converts the first character of every word to uppercase
Source code in pipeline/handlers/transform_handler/transform.py
65 66 67 68 69 70 | |
Unique
Bases: TransformHandler[list, None]
Removes duplicate items from a list while preserving order
Source code in pipeline/handlers/transform_handler/transform.py
81 82 83 84 85 86 | |
Uppercase
Bases: TransformHandler[str, None]
Converts all characters in the string to uppercase
Source code in pipeline/handlers/transform_handler/transform.py
37 38 39 40 41 42 | |
pipeline.integration.falcon.decorator
process_request(pre_hook=None, post_hook=None, handle_errors=None, **pipes_config)
A decorator factory that validates Falcon request (WSGI and ASGI) data using a defined pipeline.
This decorator extracts data from a Falcon Request object (either from
query parameters for GET requests or the media body for other methods),
runs it through a PipelineFalcon instance, and injects the validated
data into the decorated responder method.
If validation fails, it automatically sets the response body to the
validation errors and returns a 400 Bad Request status, preventing
the responder from executing. You can use your own error handler via
PipelineFalcon.handle_errors, but it must end the request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pre_hook
|
PipelineHookFunc | None
|
A function to be called before each pipe execution. The global_pre_hook will not run if a local pre_hook is defined. |
None
|
post_hook
|
PipelineHookFunc | None
|
A function to be called after each pipe execution. The global_post_hook will not run if a local pre_hook is defined. |
None
|
handle_errors
|
PipelineHandleErrorsFunc | None
|
A function to handle errors collected during pipeline execution. This could be used to raise exceptions, log errors, or format them for a response. The global_handle_errors will not run if a local handle_errors is defined. |
None
|
**pipes_config
|
PipelinePipeConfig
|
Configuration for the pipes. Keys represent the fields in the data dictionary to be processed, and values are the configuration for the corresponding pipe. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Callable |
A decorator that wraps a Falcon responder method. |
Example
@request_validator( email={ "type": str, "conditions": { Pipe.Condition.MaxLength: 64 }, "matches": { Pipe.Match.Format.Email: None } } ) def on_post(self, req, resp, email): pass
Source code in pipeline/integration/falcon/decorator.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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |