def __get_option_type(val): option_type = to_opt_type_ns("string") if isinstance(val, bool): option_type = to_opt_type_ns("boolean") elif isinstance(val, int): option_type = to_opt_type_ns("integer") elif isinstance(val, float): option_type = to_opt_type_ns("float") elif val is None: val = "" return option_type, val
def _jschema_to_pacbio_option_type_id(jschema_type): # This should get pushed down into pbcommand # and eventually remove all of the JsonSchema models types_d = {JsonSchemaTypes.BOOL: to_opt_type_ns("boolean"), JsonSchemaTypes.INT: to_opt_type_ns("integer"), JsonSchemaTypes.STR: to_opt_type_ns("string"), JsonSchemaTypes.NUM: to_opt_type_ns("float")} if jschema_type in types_d: return types_d[jschema_type] raise KeyError("Unsupported type {t} Supported types. {d}".format(t=jschema_type, d=types_d))