ORIONIS API REFERENCE

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

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 __checkBounds Check the pixel dimensions against the configured bounds.
Method __checkRatio 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_height Undocumented
Instance Variable _max_ratio Undocumented
Instance Variable _max_width Undocumented
Instance Variable _min_height Undocumented
Instance Variable _min_ratio Undocumented
Instance Variable _min_width Undocumented
Instance Variable _ratio Undocumented
Instance Variable _width Undocumented

Inherited from Rule:

Async Method enforceAsync Run an explicitly asynchronous rule check without blocking the loop.
Method validate Validate the field value and return a failure when invalid.
Async Method validateAsync Await the rule and describe an invalid field value.
Instance Variable _code Undocumented
Instance Variable _message Undocumented
def __checkBounds(self, width: int, height: int) -> bool: (source)

Check the pixel dimensions against the configured bounds.

Parameters
width:intImage width in pixels.
height:intImage height in pixels.
Returns
boolReturn True when every configured bound is satisfied.
def __checkRatio(self, width: int, height: int) -> bool: (source)

Check the aspect ratio against the configured constraints.

Parameters
width:intImage width in pixels.
height:intImage height in pixels.
Returns
boolReturn True when every configured ratio is satisfied.
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)

Initialize the rule with the accepted dimension constraints.

Parameters
min_width:int | None, optionalLowest accepted width in pixels.
max_width:int | None, optionalHighest accepted width in pixels.
min_height:int | None, optionalLowest accepted height in pixels.
max_height:int | None, optionalHighest accepted height in pixels.
width:int | None, optionalExact required width in pixels.
height:int | None, optionalExact required height in pixels.
ratio:float | str | None, optionalExact required aspect ratio.
min_ratio:float | str | None, optionalLowest accepted aspect ratio.
max_ratio:float | str | None, optionalHighest accepted aspect ratio.
message:str | None, optionalOverride message used when validation fails.
Returns
NoneThis method initializes the instance and returns None.
Raises
ValueErrorIf any ratio constraint cannot be parsed.
def enforce(self, field: str, value: object, instance: object) -> bool: (source)

Validate an uploaded image against the dimension constraints.

Parameters
field:strField name associated with the value.
value:objectValue to validate.
instance:objectOwning object instance. This argument is accepted for interface compatibility.
Returns
boolReturn True when the value passes validation.
__code__: str = (source)

Undocumented

__message__: str = (source)

Undocumented

__slots__: tuple[str, ...] = (source)

Undocumented

_height: int | None = (source)

Undocumented

_max_height: int | None = (source)

Undocumented

_max_ratio: float | None = (source)

Undocumented

_max_width: int | None = (source)

Undocumented

_min_height: int | None = (source)

Undocumented

_min_ratio: float | None = (source)

Undocumented

_min_width: int | None = (source)

Undocumented

Undocumented

Undocumented