Example #1
0
IGNORECASE = I = 1
MULTILINE = M = 2
DOTALL = S = 4
VERBOSE = X = 8
PCRE_ANCHORED = 0x10
# Ignored
LOCALE = L = 0

# ASCII is a special value ditinguishable from 0
ASCII = A = 0x4000
UNICODE = U = 0x800

PCRE_INFO_CAPTURECOUNT = 2

_UNESCAPE_DICT = const({
    b"\\": b"\\", b"n": b"\n", b"r": b"\r", b"t": b"\t",
    b"v": b"\v", b"f": b"\f", b"a": b"\a", b"b": b"\b"
})


class error(Exception):

    def __init__(self, msg, pattern=None, pos=None):
        self.msg = msg
        self.pattern = pattern
        self.pos = pos


class PCREMatch:

    def __init__(self, patobj, s, is_str, num_matches, offsets):
        self.patobj = patobj
Example #2
0
import pycopy
from pycopy import const

FOO = const(1)


@pycopy.native
def func1():
    return 2


@pycopy.viper
def func2() -> int:
    return 3


assert FOO == 1
assert func1() == 2
assert func2() == 3