Skip to main content

normalization

Placeholder

from dara.core.internal.normalization import Placeholder

class Placeholder(TypedDict)

Placeholder object 'Referrable' objects are replaced with

Attributes

  • __ref: str

Referrable

from dara.core.internal.normalization import Referrable

class Referrable(TypedDict)

Describes an object which can be replaced by a Placeholder.

Attributes

  • __typename: str
  • uid: str

normalize

def normalize(obj: JsonLike,
check_root: bool = True) -> Tuple[JsonLike, Mapping]

Normalize a dictionary - extract referrable data into a separate lookup dictionary, replacing instances

found with placeholders.

Arguments:

  • obj: object to normalize
  • check_root: whether to check if the root object is also a referrable object

denormalize

def denormalize(normalized_obj: JsonLike,
lookup: Mapping) -> Optional[JsonLike]

Denormalize data by replacing Placeholders found with objects from the lookup

:normalized_obj: object or list containing placeholders :lookup: dict mapping identifiers to referrables