class BaseConvert(ValueOp): input_type = [ rules.one_of([integer, string]), integer(name='from_base'), integer(name='to_base') ] output_type = rules.shape_like_flatargs('string')
def _operation_type_conversion(inputs, output): in_type = [validate_type(x) for x in inputs] in_values = [rules.value_typed_as(_convert_types(x)) for x in in_type] out_type = validate_type(output) out_value = rules.shape_like_flatargs(out_type) return (in_values, out_value)
class StringJoin(ValueOp): input_type = [string(name='sep'), list_of(string, min_length=1)] output_type = rules.shape_like_flatargs('string')
def _type_signature(self, inputs, output): input_type = _to_input_sig(inputs) output = validate_type(output) output_type = rules.shape_like_flatargs(output) return input_type, output_type
def _operation_type_conversion(inputs, output): in_type = [ir._validate_type(x) for x in inputs] in_values = [rules.value_typed_as(_convert_types(x)) for x in in_type] out_type = ir._validate_type(output) out_value = rules.shape_like_flatargs(out_type) return (in_values, out_value)