Fields

Internal class delegating to a module, and displaying warnings when module attributes deprecated in acme.fields are accessed.

class acme.fields.Fixed(json_name: str, value: Any)[source]

Fixed field.

decode(value: Any) Any[source]

Decode a value, optionally with context JSON object.

encode(value: Any) Any[source]

Encode a value, optionally with context JSON object.

class acme.fields.RFC3339Field(json_name: str, default: Optional[Any] = None, omitempty: bool = False, decoder: Optional[Callable[[Any], Any]] = None, encoder: Optional[Callable[[Any], Any]] = None)[source]

RFC3339 field encoder/decoder.

Handles decoding/encoding between RFC3339 strings and aware (not naive) datetime.datetime objects (e.g. datetime.datetime.now(pytz.utc)).

classmethod default_encoder(value: datetime.datetime) str[source]

Default (passthrough) encoder.

classmethod default_decoder(value: str) datetime.datetime[source]

Default decoder.

Recursively deserialize into immutable types ( josepy.util.frozendict instead of dict(), tuple() instead of list()).

class acme.fields.Resource(resource_type: str, *args: Any, **kwargs: Any)[source]

Resource MITM field.

decode(value: Any) Any[source]

Decode a value, optionally with context JSON object.

acme.fields.fixed(json_name: str, value: Any) Any[source]

Generates a type-friendly Fixed field.

acme.fields.rfc3339(json_name: str, omitempty: bool = False) Any[source]

Generates a type-friendly RFC3339 field.

acme.fields.resource(resource_type: str) Any[source]

Generates a type-friendly Resource field.