return code2 + "inset('" + code + "')"
    return code2 + code


compile = lambda code, **kwargs: pyext.compile(
    strtobytes(pre_transform(code, kwargs)))
compile_chunk = lambda code, **kwargs: pyext.compile_chunk(
    strtobytes(pre_transform(code, kwargs)))
compile_to_lll = lambda code, **kwargs: node(
    pyext.compile_to_lll(strtobytes(pre_transform(code, kwargs))))
compile_chunk_to_lll = lambda code, **kwargs: node(
    pyext.compile_chunk_to_lll(strtobytes(pre_transform(code, kwargs))))
compile_lll = lambda x: pyext.compile_lll(take(strtobytes(x)))
parse = lambda code, **kwargs: node(
    pyext.parse(strtobytes(pre_transform(code, kwargs))))
rewrite = lambda x: node(pyext.rewrite(take(strtobytes(x))))
rewrite_chunk = lambda x: node(pyext.rewrite_chunk(take(strtobytes(x))))
pretty_compile = lambda code, **kwargs: list(
    map(node, pyext.pretty_compile(strtobytes(pre_transform(code, kwargs)))))
pretty_compile_chunk = lambda code, **kwargs: list(
    map(node,
        pyext.pretty_compile_chunk(strtobytes(pre_transform(code, kwargs)))))
pretty_compile_lll = lambda code, **kwargs: list(
    map(
        node,
        pyext.pretty_compile_lll(take(strtobytes(pre_transform(code, kwargs))))
    ))
serialize = lambda x: pyext.serialize(takelist(strtobytes(x)))
deserialize = lambda x: list(map(node, pyext.deserialize(x)))
mk_signature = lambda code, **kwargs: pyext.mk_signature(
    strtobytes(pre_transform(code, kwargs)))
Esempio n. 2
0
        return Token(li[1], li[2])


def take(x):
    return pyext.parse_lll(x) if isinstance(x, (str, unicode)) else x.out()


def takelist(x):
    return map(take, parse(x).args if isinstance(x, (str, unicode)) else x)


compile = lambda x: pyext.compile(x)
compile_to_lll = lambda x: node(pyext.compile_to_lll(x))
compile_lll = lambda x: pyext.compile_lll(take(x))
parse = lambda x: node(pyext.parse(x))
rewrite = lambda x: node(pyext.rewrite(take(x)))
pretty_compile = lambda x: map(node, pyext.pretty_compile(x))
pretty_compile_lll = lambda x: map(node, pyext.pretty_compile_lll(take(x)))
serialize = lambda x: pyext.serialize(takelist(x))
deserialize = lambda x: map(node, pyext.deserialize(x))

is_numeric = lambda x: isinstance(x, (int, long))
is_string = lambda x: isinstance(x, (str, unicode))
tobytearr = lambda n, L: [] if L == 0 else tobytearr(n / 256, L - 1)+[n % 256]


# A set of methods for detecting raw values (numbers and strings) and
# converting them to integers
def frombytes(b):
    return 0 if len(b) == 0 else ord(b[-1]) + 256 * frombytes(b[:-1])
Esempio n. 3
0
def take(x):
    return pyext.parse_lll(x) if isinstance(x, (str, unicode)) else x.out()


def takelist(x):
    return map(take, parse(x).args if isinstance(x, (str, unicode)) else x)


compile = lambda x: pyext.compile(x)
compile_chunk = lambda x: pyext.compile_chunk(x)
compile_to_lll = lambda x: node(pyext.compile_to_lll(x))
compile_chunk_to_lll = lambda x: node(pyext.compile_chunk_to_lll(x))
compile_lll = lambda x: pyext.compile_lll(take(x))
parse = lambda x: node(pyext.parse(x))
rewrite = lambda x: node(pyext.rewrite(take(x)))
rewrite_chunk = lambda x: node(pyext.rewrite_chunk(take(x)))
pretty_compile = lambda x: map(node, pyext.pretty_compile(x))
pretty_compile_chunk = lambda x: map(node, pyext.pretty_compile_chunk(x))
pretty_compile_lll = lambda x: map(node, pyext.pretty_compile_lll(take(x)))
serialize = lambda x: pyext.serialize(takelist(x))
deserialize = lambda x: map(node, pyext.deserialize(x))

is_numeric = lambda x: isinstance(x, (int, long))
is_string = lambda x: isinstance(x, (str, unicode))
tobytearr = lambda n, L: [] if L == 0 else tobytearr(n / 256, L - 1
                                                     ) + [n % 256]


# A set of methods for detecting raw values (numbers and strings) and
# converting them to integers
Esempio n. 4
0

def take(x):
    return pyext.parse_lll(x) if isinstance(x, (str, unicode, bytes)) else x.out()


def takelist(x):
    return map(take, parse(x).args if isinstance(x, (str, unicode, bytes)) else x)

compile = lambda x: pyext.compile(strtobytes(x))
compile_chunk = lambda x: pyext.compile_chunk(strtobytes(x))
compile_to_lll = lambda x: node(pyext.compile_to_lll(strtobytes(x)))
compile_chunk_to_lll = lambda x: node(pyext.compile_chunk_to_lll(strtobytes(x)))
compile_lll = lambda x: pyext.compile_lll(take(strtobytes(x)))
parse = lambda x: node(pyext.parse(strtobytes(x)))
rewrite = lambda x: node(pyext.rewrite(take(strtobytes(x))))
rewrite_chunk = lambda x: node(pyext.rewrite_chunk(take(strtobytes(x))))
pretty_compile = lambda x: map(node, pyext.pretty_compile(strtobytes(x)))
pretty_compile_chunk = lambda x: map(node, pyext.pretty_compile_chunk(strtobytes(x)))
pretty_compile_lll = lambda x: map(node, pyext.pretty_compile_lll(take(strtobytes(x))))
serialize = lambda x: pyext.serialize(takelist(strtobytes(x)))
deserialize = lambda x: map(node, pyext.deserialize(strtobytes(x)))

is_numeric = lambda x: isinstance(x, (int, long))
is_string = lambda x: isinstance(x, (str, unicode))
tobytearr = lambda n, L: [] if L == 0 else tobytearr(n / 256, L - 1)+[n % 256]


# A set of methods for detecting raw values (numbers and strings) and
# converting them to integers
def frombytes(b):