@tornado.gen.coroutine
    def execcode_expr_store(self, nod):
        assert type(nod.ctx) is not ast.Load, 'target of assignment has Load context'
        nodtyp = type(nod)
        if nodtyp is ast.Name:
            return two.execute.BoundNameProxy(nod.id)
        if nodtyp is ast.Attribute:
            argument = yield self.execcode_expr(nod.value)
            key = nod.attr
            if isinstance(argument, two.execute.PropertyProxyMixin):
                return two.execute.BoundPropertyProxy(argument, key)
            raise ExecSandboxException('%s.%s: setattr not allowed' % (type(argument).__name__, key))
        if nodtyp is ast.Subscript:
            argument = yield self.execcode_expr(nod.value)
            subnod = nod.slice
            subtyp = type(subnod)
            if subtyp is ast.Index:
                subscript = yield self.execcode_expr(subnod.value)
            elif subtyp is ast.Slice:
                lower = None
                if subnod.lower is not None:
                    lower = yield self.execcode_expr(subnod.lower)
                upper = None
                if subnod.upper is not None:
                    upper = yield self.execcode_expr(subnod.upper)
                if subnod.step is None:
                    subscript = slice(lower, upper)
                else:
                    step = yield self.execcode_expr(subnod.step)
                    subscript = slice(lower, upper, step)
            else:
                raise NotImplementedError('Unsupported subscript type: %s' % (subtyp.__name__,))
            if isinstance(argument, two.execute.PropertyProxyMixin):
                # Special case: property proxies can be accessed by subscript.
                return two.execute.BoundPropertyProxy(argument, subscript)
            return two.execute.BoundSubscriptProxy(argument, subscript)
        if nodtyp in (ast.Tuple, ast.List):
            ls = []
            for subnod in nod.elts:
                val = yield self.execcode_expr_store(subnod)
                ls.append(val)
            return two.execute.MultiBoundProxy(ls)
        raise NotImplementedError('Script store-expression type not implemented: %s' % (nodtyp.__name__,))
hook to extend argparse parser with custom arguments
dataset/ETHPy150Open erkyrath/tworld/lib/two/evalctx.py/EvalPropContext.execcode_expr_store--crossover with--dataset/ETHPy150Open arq5x/cyvcf/cyvcf/filters.py/Base.customize_parser