kaskada.formatters_helpers

Module Contents

Functions

get_item(obj, keys[, default])

Safely recursively gets an item from a dict, otherwise returns the default value

appendChildIfNotNone(parent, child)

appendChildren(parent, children)

html_obj_table_row(key, value)

Returns a html table row, where the key is bolded, and the value is output as code.

html_table_row(key, value)

Returns a html table row, where the key is bolded, and the value is output as is.

html_obj_id_row(index, obj, props)

appendHtmlObjTableRowIfAttrExists(parent, obj, attr)

appendHtmlObjTableRowIfHasField(parent, obj, field)

convert_fenl_schema_field(field)

Converts a fenl field to a string representation.

convert_fenl_datatype(data_type)

Converts a fenl dataType to a string representation.

get_schema_dataframe(obj)

Gets a dataframe from a schema object if it exists

get_datetime(pb2_timestamp)

Converts a google.protobuf.timestamp_pb2 into a python datetime object.

get_classname(obj)

get_properties(obj)

Converts a protobuf response into a simple python dictionary.

Attributes

kaskada_fenl_primitive_types

kaskada_fenl_primitive_types[source]
get_item(obj, keys, default='')[source]

Safely recursively gets an item from a dict, otherwise returns the default value

Parameters:
  • {str (obj (dict of) – Any}): Dictionary of (nested) key item pairs

  • keys (list of str) – The list of keys use to navigate to the desired item in the dictionary.

  • default (str, optional) – The default value to return if the item isn’t found. Defaults to “”.

Returns:

Either the found value or the default.

Return type:

string

appendChildIfNotNone(parent, child)[source]
appendChildren(parent, children)[source]
html_obj_table_row(key, value)[source]

Returns a html table row, where the key is bolded, and the value is output as code.

html_table_row(key, value)[source]

Returns a html table row, where the key is bolded, and the value is output as is.

html_obj_id_row(index, obj, props)[source]
appendHtmlObjTableRowIfAttrExists(parent, obj, attr)[source]
appendHtmlObjTableRowIfHasField(parent, obj, field)[source]
convert_fenl_schema_field(field)[source]

Converts a fenl field to a string representation.

Parameters:

field (schema_pb2.Schema_Field) – the input field

Returns:

The string representation of the fenl Field

Return type:

str

convert_fenl_datatype(data_type)[source]

Converts a fenl dataType to a string representation.

Parameters:

data_type (schema_pb2.DataType) – the input dataType

Returns:

The string representation of the fenl DataType

Return type:

str

get_schema_dataframe(obj)[source]

Gets a dataframe from a schema object if it exists

Parameters:

obj (kaskada.fenl.v1alpha.schema_pb2.Schema | Any) – Either a schema object or an object that has a schema or analysis object at the root level

Returns:

Either a dataframe describing the schemea or None if no schema exists in the passed object.

Return type:

pandas.dataframe | None

get_datetime(pb2_timestamp)[source]

Converts a google.protobuf.timestamp_pb2 into a python datetime object.

Parameters:

pb2_timestamp (google.protobuf.timestamp_pb2) – The protobuf timestamp.

Returns:

The python datetime.

Return type:

datetime

get_classname(obj)[source]
get_properties(obj)[source]

Converts a protobuf response into a simple python dictionary.

Parameters:

obj (Any) – A deserialized protobuf object.

Returns:

Any}: A nested set of keys and values with structure matching the protobuf input.

Return type:

dict of {str