def match(type_expr) -> Type['ParameterSection']: try: cls = Micheline.match(type_expr) if not issubclass(cls, ParameterSection): cls = ParameterSection.create_type(args=[cls]) except Exception as e: raise MichelsonRuntimeError('parameter', *e.args) from e return cls
def match(type_expr) -> Type['StorageSection']: try: cls = Micheline.match(type_expr) if not issubclass(cls, StorageSection): cls = StorageSection.create_type(args=[cls]) assert cls.args[ 0].field_name is None, f'argument type cannot be annotated: %{cls.args[0].field_name}' # type: ignore except Exception as e: raise MichelsonRuntimeError('storage', *e.args) from e return cls # type: ignore
def match(output_expr) -> Type['NowSection']: cls = Micheline.match(output_expr) if not issubclass(cls, NowSection): cls = NowSection.create_type(args=[cls]) return cls # type: ignore
def match(expr) -> Type['MichelsonType']: return cast(Type['MichelsonType'], Micheline.match(expr))
def from_micheline_value(cls, val_expr) -> 'LambdaType': assert isinstance( val_expr, list), f'expected list, got {type(val_expr).__name__}' return cls(Micheline.match(val_expr))
def dummy(cls, context: AbstractContext) -> 'LambdaType': return cls(Micheline.match(context.get_dummy_lambda()))
def match(code_expr) -> Type['CodeSection']: cls = Micheline.match(code_expr) if not issubclass(cls, CodeSection): cls = CodeSection.create_type(args=[cls]) return cls # type: ignore
def match(expr) -> Type['MichelsonInstruction']: return cast(Type['MichelsonInstruction'], Micheline.match(expr))