pg.typing.Number#

Accessible via pg.typing.Number.

class Number(value_type, default=MISSING_VALUE, min_value=None, max_value=None, is_noneable=False, frozen=False)[source]#

Bases: pg.typing.Generic, pg.typing.PrimitiveType

Base class for value spec of numeric types.

Methods:

format(**kwargs)

Format this object.

to_json(**kwargs)

Returns a plain Python value as a representation for this object.

Attributes:

max_value

Returns maximum value of acceptable values.

min_value

Returns minimum value of acceptable values.

format(**kwargs)[source]#

Format this object.

Return type:

str

property max_value: Number | None[source]#

Returns maximum value of acceptable values.

property min_value: Number | None[source]#

Returns minimum value of acceptable values.

to_json(**kwargs)[source]#

Returns a plain Python value as a representation for this object.

A plain Python value are basic python types that can be serialized into JSON, e.g: bool, int, float, str, dict (with string keys), list, tuple where the container types should have plain Python values as their values.

Return type:

Dict[str, Any]

Parameters:

**kwargs – Keyword arguments as flags to control JSON conversion.

Returns:

A plain Python value.