THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class documentation
class Dimensions(Rule): (source)
Constructor: Dimensions(min_width, max_width, min_height, max_height, ...)
Ensure an uploaded image satisfies the given dimension constraints.
Widths and heights are read from the image header, so no third-party imaging library is required. Ratios accept either a number or a "width/height" string such as "3/2".
| Method | __check |
Check the pixel dimensions against the configured bounds. |
| Method | __check |
Check the aspect ratio against the configured constraints. |
| Method | __init__ |
Initialize the rule with the accepted dimension constraints. |
| Method | enforce |
Validate an uploaded image against the dimension constraints. |
| Class Variable | __code__ |
Undocumented |
| Class Variable | __message__ |
Undocumented |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | _height |
Undocumented |
| Instance Variable | _max |
Undocumented |
| Instance Variable | _max |
Undocumented |
| Instance Variable | _max |
Undocumented |
| Instance Variable | _min |
Undocumented |
| Instance Variable | _min |
Undocumented |
| Instance Variable | _min |
Undocumented |
| Instance Variable | _ratio |
Undocumented |
| Instance Variable | _width |
Undocumented |
Inherited from Rule:
| Async Method | enforce |
Run an explicitly asynchronous rule check without blocking the loop. |
| Method | validate |
Validate the field value and return a failure when invalid. |
| Async Method | validate |
Await the rule and describe an invalid field value. |
| Instance Variable | _code |
Undocumented |
| Instance Variable | _message |
Undocumented |
def __init__(self, *, min_width:
int | None = None, max_width: int | None = None, min_height: int | None = None, max_height: int | None = None, width: int | None = None, height: int | None = None, ratio: float | str | None = None, min_ratio: float | str | None = None, max_ratio: float | str | None = None, message: str | None = None):
(source)
¶
overrides
orionis.schemas.rule.Rule.__init__Initialize the rule with the accepted dimension constraints.
| Parameters | |
minint | None, optional | Lowest accepted width in pixels. |
maxint | None, optional | Highest accepted width in pixels. |
minint | None, optional | Lowest accepted height in pixels. |
maxint | None, optional | Highest accepted height in pixels. |
width:int | None, optional | Exact required width in pixels. |
height:int | None, optional | Exact required height in pixels. |
ratio:float | str | None, optional | Exact required aspect ratio. |
minfloat | str | None, optional | Lowest accepted aspect ratio. |
maxfloat | str | None, optional | Highest accepted aspect ratio. |
message:str | None, optional | Override message used when validation fails. |
| Returns | |
None | This method initializes the instance and returns None. |
| Raises | |
ValueError | If any ratio constraint cannot be parsed. |