h1st.schema.validators.type_helper module

Utilities function to work with python types

h1st.schema.validators.type_helper.type_name(t) → str[source]

Return a human readable string for a type

h1st.schema.validators.type_helper.is_union_type(t) → bool[source]

Return True if type is Union python type

h1st.schema.validators.type_helper.is_optional_type(t) → bool[source]

Return True if type is Optional python type

h1st.schema.validators.type_helper.is_list_type(t) → bool[source]

Return True if t is List python type

h1st.schema.validators.type_helper.get_list_type(t)[source]

Retrieve the type annotation from List

h1st.schema.validators.type_helper.is_pa_type(t, check)[source]

This function do additonal check on pyarrow type to make this works with python type:

>>> is_pa_type(pa.float64(), pa.types.is_float64)
>>> True
Parameters
  • t – target type

  • check – checker function

h1st.schema.validators.type_helper.validate_python_type(source, target) → bool[source]

Validate native python type and return True if two types are compatible

Returns

True if two type are compatible