ujotypes.tools

Auxilary functions for easy ujo type access and conversion

ujotypes.tools.ujo_to_python

Converting Ujo Container objects to Python Object

ujotypes.tools.ujo_to_python.ujo_to_python(variant: Union[ujotypes.variants.none.UjoNone, ujotypes.variants.boolean.UjoBool, ujotypes.variants.integer.UjoUInt8, ujotypes.variants.integer.UjoInt8, ujotypes.variants.integer.UjoUInt16, ujotypes.variants.integer.UjoInt16, ujotypes.variants.integer.UjoUInt32, ujotypes.variants.integer.UjoInt32, ujotypes.variants.integer.UjoUInt64, ujotypes.variants.integer.UjoInt64, ujotypes.variants.float.UjoFloat64, ujotypes.variants.float.UjoFloat32, ujotypes.variants.float.UjoFloat16, ujotypes.variants.string.UjoStringC, ujotypes.variants.string.UjoStringUTF8, ujotypes.variants.timestamp.UjoTimestamp]) → object

Recursively convert Ujo container object to native Python objects

Parameters:variant (UjoVariant) – Instance of any Ujo object to convert
Returns:
Python object representation of Ujo variant and all
contained subobjects
Return type:Union[list,dict]

ujotypes.tools.type_conversion

Type conversion helpers

ujotypes.tools.type_conversion.ujot_ujo_cstr_by_key(dictionary, key)

Get dictionary entry as UjoStringC

If the key isn’t found in the dictionary, UjoNone is returned.

Parameters:
  • dictionary (dict) – The dictionary to search in
  • key (Any) – The key to search in dictionary with
Returns:

The Ujo variant

Return type:

(UjoStringC or UjoNone)

ujotypes.tools.type_conversion.ujot_ujo_uint16_by_key(dictionary, key)

Get dictionary entry as UjoUInt16

If the key isn’t found in the dictionary, UjoNone is returned.

Parameters:
  • dictionary (dict) – The dictionary to search in
  • key (Any) – The key to search in dictionary with
Returns:

The Ujo variant

Return type:

(UjoUInt16 or UjoNone)

ujotypes.tools.type_conversion.ujot_ujo_uint64_by_key(dictionary, key)

Get dictionary entry as UjoUInt64

If the key isn’t found in the dictionary, UjoNone is returned.

Parameters:
  • dictionary (dict) – The dictionary to search in
  • key (Any) – The key to search in dictionary with
Returns:

The Ujo variant

Return type:

(UjoUInt64 or UjoNone)