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.

module documentation

Provide foundation config operations.

Includes validate_integer, validate_string, validate_boolean, normalize_enum.

Function _enum_values Index enum names and values in declaration order.
Function copy_string_list Validate a list of non-empty strings and return an independent copy.
Function normalize_enum Normalize an enum member, member name, or string value.
Function normalize_optional_store Convert optional cache/scheduler store dictionaries into typed entities.
Function validate_boolean Require a boolean without coercing truthy values.
Function validate_cookie_name Validate a cookie name with the HTTP response serializer.
Function validate_driver Require the driver implemented by a connection entity.
Function validate_http_origin Require an explicit serialized HTTP(S) origin without wildcards.
Function validate_integer Validate an integer within an inclusive range.
Function validate_name Require a safe connection, queue, or SQL table identifier.
Function validate_seconds Require finite nonnegative or strictly positive seconds.
Function validate_store_db Validate the Redis database index for cache and scheduler stores.
Function validate_store_port Validate Redis/Memcached ports using the existing store error messages.
Function validate_store_table Validate cache/scheduler table names without widening their accepted syntax.
Function validate_string Validate a string and optionally allow blank values.
Constant _ENUM_SCALAR_TYPES Enum scalar types used by validation.
Constant _MAX_STORE_PORT Max store port value used by validation.
Constant _NAME_PATTERN Compiled pattern used to recognize name pattern.
Constant _STORE_TABLE_PATTERN Compiled pattern used to recognize store table pattern.
Constant _TABLE_PATTERN Compiled pattern used to recognize table pattern.
@lru_cache(maxsize=64)
def _enum_values(enum_type: type[Enum], _member_count: int) -> MappingProxyType | None: (source)

Index enum names and values in declaration order.

Parameters
enum_type:type[orionis.orm.schema.types.Enum]Enum class defining the accepted names and values.
_member_count:intNumber of declared names, including aliases, used as a cache revision.
Returns
types.MappingProxyType or NoneRead-only scalar lookup preserving declaration order, or None when values require their current string representation on every lookup.
def copy_string_list(value: object, name: str) -> list[str]: (source)

Validate a list of non-empty strings and return an independent copy.

Parameters
value:objectList to validate and copy.
name:strField name used in validation errors.
Returns
list[str]A new list containing the validated strings.
Raises
TypeErrorIf value is not a list or an item is not a string.
ValueErrorIf an item is blank.
def normalize_enum(value: object, enum_type: type[Enum], name: str) -> object: (source)

Normalize an enum member, member name, or string value.

Parameters
value:objectEnum member, member name, or string value to normalize.
enum_type:type[orionis.orm.schema.types.Enum]Enum class that defines the accepted members.
name:strField name used in validation errors.
Returns
objectThe normalized enum member value.
Raises
TypeErrorIf value is neither an enum member nor a string.
ValueErrorIf the string does not match an enum member or value.
def normalize_optional_store(owner: object, name: str, cls: type): (source)

Convert optional cache/scheduler store dictionaries into typed entities.

Parameters
owner:objectConfiguration entity whose field is normalized during initialization.
name:strField containing an entity, dict or None.
cls:typeExpected store entity type.
Returns
NonePreserve disabled stores and assign converted entities to frozen owners.
def validate_boolean(value: object, name: str): (source)

Require a boolean without coercing truthy values.

Parameters
value:objectValue to validate.
name:strField name used in validation errors.
Returns
NoneThis function validates the value without returning a result.
Raises
TypeErrorIf value is not a boolean.
def validate_cookie_name(value: object, name: str): (source)

Validate a cookie name with the HTTP response serializer.

Parameters
value:objectCookie name to validate.
name:strField name used in validation errors.
Returns
NoneThis function validates the name without returning a result.
Raises
TypeErrorIf value is not a non-empty string.
ValueErrorIf the serializer rejects value as a cookie name.
def validate_driver(value: object, expected: Drivers): (source)

Require the driver implemented by a connection entity.

Parameters
value:objectConfigured driver name or enum member.
expected:orionis.foundation.config.queue.enums.DriversDriver supported by the entity.
Returns
NoneValidate the driver without changing its representation.
Raises
TypeErrorIf the driver is not a string or string enum.
ValueErrorIf the driver does not match the connection entity.
def validate_http_origin(origin: str): (source)

Require an explicit serialized HTTP(S) origin without wildcards.

Parameters
origin:strOne trusted browser origin from configuration.
Returns
NoneAccept the validated origin without changing its spelling.
Raises
TypeErrorIf the configured origin is not a string.
ValueErrorIf its syntax could permit ambiguous or unrestricted matching.
def validate_integer(value: object, name: str, *, minimum: int = 0, maximum: int | None = None): (source)

Validate an integer within an inclusive range.

Parameters
value:objectValue to validate.
name:strField name used in validation errors.
minimum:int, optionalMinimum allowed value, inclusive.
maximum:int | None, optionalMaximum allowed value, inclusive, or None for no upper bound.
Returns
NoneThis function validates the value without returning a result.
Raises
TypeErrorIf value is not an integer or is a boolean.
ValueErrorIf value is outside the configured range.
def validate_name(value: object, name: str, *, table: bool = False): (source)

Require a safe connection, queue, or SQL table identifier.

Parameters
value:objectIdentifier to validate.
name:strConfiguration field used in errors.
table:bool, optionalRestrict the identifier to an unqualified SQL table name.
Returns
NoneValidate the identifier without changing it.
Raises
TypeErrorIf the identifier is not a string.
ValueErrorIf the identifier is empty or unsafe.
def validate_seconds(value: object, name: str, *, positive: bool = False): (source)

Require finite nonnegative or strictly positive seconds.

Parameters
value:objectNumeric duration to validate.
name:strConfiguration field used in errors.
positive:bool, optionalReject zero when true.
Returns
NoneValidate the duration without coercion.
Raises
TypeErrorIf the duration is not numeric or is a boolean.
ValueErrorIf the duration is nonfinite or outside its allowed range.
def validate_store_db(value: object): (source)

Validate the Redis database index for cache and scheduler stores.

Parameters
value:objectRedis database index, excluding booleans.
Returns
NoneAccept nonnegative integers.
def validate_store_port(value: object): (source)

Validate Redis/Memcached ports using the existing store error messages.

Parameters
value:objectTCP port, excluding booleans.
Returns
NoneAccept integers from one through 65535.
def validate_store_table(value: object, name: str = 'table', *, optional: bool = False): (source)

Validate cache/scheduler table names without widening their accepted syntax.

Parameters
value:objectConfigured table name.
name:strProperty reported in validation errors.
optional:boolWhether None is accepted for an optional lock table.
Returns
NoneAccept lowercase letters and underscores, preserving store diagnostics.
def validate_string(value: object, name: str, *, allow_empty: bool = False): (source)

Validate a string and optionally allow blank values.

Parameters
value:objectValue to validate.
name:strField name used in validation errors.
allow_empty:bool, optionalWhether to allow strings containing only whitespace.
Returns
NoneThis function validates the value without returning a result.
Raises
TypeErrorIf value is not a string.
ValueErrorIf value is blank and empty strings are not allowed.
_ENUM_SCALAR_TYPES = (source)

Enum scalar types used by validation.

Value
frozenset(set([str, bytes, int, float, complex, bool, type(None)]))
_MAX_STORE_PORT: int = (source)

Max store port value used by validation.

Value
65535
_NAME_PATTERN = (source)

Compiled pattern used to recognize name pattern.

Value
re.compile(r'[A-Za-z0-9][A-Za-z0-9_\.-]{,127}')
_STORE_TABLE_PATTERN = (source)

Compiled pattern used to recognize store table pattern.

Value
re.compile(r'[a-z_]+')
_TABLE_PATTERN = (source)

Compiled pattern used to recognize table pattern.

Value
re.compile(r'[A-Za-z_]\w*',
           re.ASCII)