# Path: pydal/helpers/regex.py
# REGEX_SEARCH_PATTERN = r"^{[^.]+\.[^.]+(\.(lt|gt|le|ge|eq|ne|contains|startswith|year|month|day|hour|minute|second))?(\.not)?}$"
# 
# REGEX_SQUARE_BRACKETS = r"^.+\[.+\]$"
# 
# Path: pydal/_compat.py
# PY2 = sys.version_info[0] == 2
#     def implements_bool(cls):
#     def implements_iterator(cls):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def to_unicode(obj, charset="utf-8", errors="strict"):
#     class metaclass(meta):


import re
from .regex import REGEX_SEARCH_PATTERN, REGEX_SQUARE_BRACKETS
from .._compat import long
                        elif tokens[2] == "year":
                            query = self.db[table][field].year() == args[i]
                        elif tokens[2] == "month":
                            query = self.db[table][field].month() == args[i]
                        elif tokens[2] == "day":
                            query = self.db[table][field].day() == args[i]
                        elif tokens[2] == "hour":
                            query = self.db[table][field].hour() == args[i]
                        elif tokens[2] == "minute":
                            query = self.db[table][field].minutes() == args[i]
                        elif tokens[2] == "second":
                            query = self.db[table][field].seconds() == args[i]
                        elif tokens[2] == "startswith":
                            query = self.db[table][field].startswith(args[i])
                        elif tokens[2] == "contains":
                            query = self.db[table][field].contains(args[i])
                        else:
                            raise RuntimeError("invalid pattern: %s" % pattern)
                        if len(tokens) == 4 and tokens[3] == "not":
                            query = ~query
                        elif len(tokens) >= 4:
                            raise RuntimeError("invalid pattern: %s" % pattern)
                        if not otable and isinstance(queries, dict):
                            dbset = self.db(queries[table])
                            if basequery is not None:
                                dbset = dbset(basequery)
                        dbset = dbset(query)
                    else:
                        raise RuntimeError("missing relation in pattern: %s" % pattern)
                elif (

# Path: pydal/helpers/regex.py
# REGEX_SEARCH_PATTERN = r"^{[^.]+\.[^.]+(\.(lt|gt|le|ge|eq|ne|contains|startswith|year|month|day|hour|minute|second))?(\.not)?}$"
# 
# REGEX_SQUARE_BRACKETS = r"^.+\[.+\]$"
# 
# Path: pydal/_compat.py
# PY2 = sys.version_info[0] == 2
#     def implements_bool(cls):
#     def implements_iterator(cls):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def to_unicode(obj, charset="utf-8", errors="strict"):
#     class metaclass(meta):


# Path: pydal/helpers/rest.py
import re
from .regex import REGEX_SEARCH_PATTERN, REGEX_SQUARE_BRACKETS
from .._compat import long

                        elif tokens[2] == "year":
                            query = self.db[table][field].year() == args[i]
                        elif tokens[2] == "month":
                            query = self.db[table][field].month() == args[i]
                        elif tokens[2] == "day":
                            query = self.db[table][field].day() == args[i]
                        elif tokens[2] == "hour":
                            query = self.db[table][field].hour() == args[i]
                        elif tokens[2] == "minute":
                            query = self.db[table][field].minutes() == args[i]
                        elif tokens[2] == "second":
                            query = self.db[table][field].seconds() == args[i]
                        elif tokens[2] == "startswith":
                            query = self.db[table][field].startswith(args[i])
                        elif tokens[2] == "contains":
                            query = self.db[table][field].contains(args[i])
                        else:
                            raise RuntimeError("invalid pattern: %s" % pattern)
                        if len(tokens) == 4 and tokens[3] == "not":
                            query = ~query
                        elif len(tokens) >= 4:
                            raise RuntimeError("invalid pattern: %s" % pattern)
                        if not otable and isinstance(queries, dict):
                            dbset = self.db(queries[table])
                            if basequery is not None:
                                dbset = dbset(basequery)
                        dbset = dbset(query)
                    else:
                        raise RuntimeError("missing relation in pattern: %s" % pattern)
                elif (

                    re.match(REGEX_SQUARE_BRACKETS, tag)