core.converters

Contains custom converters.

Attributes

extended_date_converter

json_converter

uuid_converter

bool_converter

datetime_converter

integer_range_converter

move_direction_converter

LiteralConverterBase

Classes

LiteralConverter

This is a Converter counter-part to typing.Literal.

Functions

extended_date_decode(…)

Decodes a date string HTML5 (RFC3339) compliant.

extended_date_encode(→ str)

Encodes a date HTML5 (RFC3339) compliant.

json_decode(…)

Decodes a json string to a dict.

json_encode(→ str)

Encodes a dictionary to json.

uuid_decode(→ uuid.UUID | None)

Turns a uuid string into a UUID instance.

uuid_encode(→ str)

Turns a UUID instance into a uuid string.

get_default_uuid_converter(→ morepath.Converter[UUID])

bool_decode(…)

Decodes a boolean.

bool_encode(…)

Encodes a boolean.

get_default_bool_converter(→ morepath.Converter[bool])

datetime_decode(…)

Decodes a datetime.

datetime_encode(→ str)

Encodes a datetime.

get_default_datetime_converter(...)

integer_range_decode(→ tuple[int, int] | None)

integer_range_encode(→ str)

move_direction_decode(...)

move_direction_encode(→ str)

get_default_move_direction_converter(...)

Module Contents

core.converters.extended_date_decode(s: Literal['']) None[source]
core.converters.extended_date_decode(s: str) datetime.date

Decodes a date string HTML5 (RFC3339) compliant.

core.converters.extended_date_encode(d: datetime.date | None) str[source]

Encodes a date HTML5 (RFC3339) compliant.

core.converters.extended_date_converter[source]
core.converters.json_decode(s: Literal['']) None[source]
core.converters.json_decode(s: str) dict[str, Any]

Decodes a json string to a dict.

core.converters.json_encode(d: Mapping[str, Any] | None) str[source]

Encodes a dictionary to json.

core.converters.json_converter[source]
core.converters.uuid_decode(s: str) uuid.UUID | None[source]

Turns a uuid string into a UUID instance.

core.converters.uuid_encode(uuid: uuid.UUID | str | None) str[source]

Turns a UUID instance into a uuid string.

core.converters.uuid_converter[source]
core.converters.get_default_uuid_converter() morepath.Converter[UUID][source]
core.converters.bool_decode(s: Literal['0', '']) Literal[False][source]
core.converters.bool_decode(s: Literal['1']) Literal[True]
core.converters.bool_decode(s: str) bool

Decodes a boolean.

core.converters.bool_encode(d: Literal[False] | None) Literal['0'][source]
core.converters.bool_encode(d: Literal[True]) Literal['1']
core.converters.bool_encode(d: bool | None) Literal['0', '1']

Encodes a boolean.

core.converters.bool_converter: morepath.Converter[bool][source]
core.converters.get_default_bool_converter() morepath.Converter[bool][source]
core.converters.datetime_decode(s: Literal['']) None[source]
core.converters.datetime_decode(s: str) datetime.datetime

Decodes a datetime.

core.converters.datetime_encode(d: datetime.datetime | None) str[source]

Encodes a datetime.

core.converters.datetime_converter[source]
core.converters.get_default_datetime_converter() morepath.Converter[datetime][source]
core.converters.integer_range_decode(s: str) tuple[int, int] | None[source]
core.converters.integer_range_encode(t: tuple[int, int] | None) str[source]
core.converters.integer_range_converter[source]
core.converters.move_direction_decode(s: str) onegov.core.orm.abstract.MoveDirection | None[source]
core.converters.move_direction_encode(d: str | onegov.core.orm.abstract.MoveDirection | None) str[source]
core.converters.move_direction_converter[source]
core.converters.get_default_move_direction_converter() morepath.Converter[MoveDirection][source]
core.converters.LiteralConverterBase[source]
class core.converters.LiteralConverter(literal_type: Any, /)[source]
class core.converters.LiteralConverter(*literals: LiteralString)

Bases: LiteralConverterBase

This is a Converter counter-part to typing.Literal.

allowed_values: set[str][source]
single_decode(string: str) str | None[source]
single_encode(value: str | None) str[source]