Source code for pytezos.michelson.sections.code

from typing import List
from typing import Type

from pytezos.context.abstract import AbstractContext
from pytezos.michelson.micheline import Micheline


[docs]class CodeSection(Micheline, prim='code', args_len=1):
[docs] @staticmethod 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
[docs] @classmethod def execute(cls, stack, stdout: List[str], context: AbstractContext): context.set_code_expr(cls.as_micheline_expr()) stdout.append(f'code: updated')