:type query str
    :rtype: (int, int)
978694
def get_query_limit_and_offset(query):
    
    limit = None
    offset = None
    last_keyword = None
    last_token = None

    # print(query)
    for token in get_query_tokens(query):
        # print([token, token.ttype, last_keyword])

        if token.is_keyword and token.value.upper() in ['LIMIT', 'OFFSET']:
            last_keyword = token.value.upper()
        elif token.ttype is Number.Integer:
            # print([token, last_keyword, last_token_was_integer])
            if last_keyword == 'LIMIT':
                # LIMIT <limit>
                limit = int(token.value)
                last_keyword = None
            elif last_keyword == 'OFFSET':
                # OFFSET <offset>
                offset = int(token.value)
                last_keyword = None
            elif last_token and last_token.ttype is Punctuation:
                # LIMIT <offset>,<limit>
                offset = limit
                limit = int(token.value)

        last_token = token

    if limit is None:
        return None

    return limit, offset or 0
217483
def query_params(self, value=None):
        
        if value is not None:
            return URL._mutate(self, query=unicode_urlencode(value, doseq=True))
        query = '' if self._tuple.query is None else self._tuple.query

        # In Python 2.6, urlparse needs a bytestring so we encode and then
        # decode the result.
        if not six.PY3:
            result = parse_qs(to_utf8(query), True)
            return dict_to_unicode(result)

        return parse_qs(query, True)
873702
def getquery(self, default=None, encoding='utf-8', errors='strict'):
        
        query = self.query
        if query is None:
            return default
        else:
            return uridecode(query, encoding, errors)
57796
def query(self):
        """"""

        if not hasattr(self, '_decoded_query'):
            self._decoded_query = list(urls._url_decode_impl(
                self.querystr.split('&'), 'utf-8', False, True, 'strict'))
        return self.query_cls(self._decoded_query)
691898
def query(self, *args, **kwargs):
        
        clone = self._clone()
        queries = []
        from pyes.query import Query

        if args:
            for f in args:
                if isinstance(f, Query):
                    queries.append(f)
                else:
                    raise TypeError('Only Query objects can be passed as argument')

        for field, value in kwargs.items():
            if value == [None]:
                value = ["$$$$"]
            queries.append(self._build_inner_query(field, value))

        clone._queries.extend(queries)
        return clone
699889
def query(self):
        """"""
        self._query = query = ""

        query_kwargs = self.query_kwargs
        if query_kwargs: query = urlencode(query_kwargs, doseq=True)
        return query
1335592
def query(self):
        
        query = QueryBuilder(self, self._query_grammar, self._post_processor)

        return query
1173196
def query( self ):
        
        # build a query if not searching all
        q        = Q()
        operator = 'and'
        
        for i in range(self.uiQueryTREE.topLevelItemCount()):
            item = self.uiQueryTREE.topLevelItem(i)
            
            if ( isinstance(item, XQueryItem) ):
                if ( operator == 'and' ):
                    q &= item.query()
                else:
                    q |= item.query()
            else:
                operator = nativestring(item.text(0))
        return q
1021587
def search(self, query: Optional[dict] = None, offset: Optional[int] = None,
               limit: Optional[int] = None,
               order_by: Union[None, list, tuple] = None) -> Sequence['IModel']:
        """"""
        raise NotImplementedError
72631
def query(self, sql):
        '''
        
        '''
        try:
            self.connect()
            with self.con.cursor() as cursor:
                cursor.execute(sql)
                self.con.commit()
                res = cursor.fetchall()
                return res
        except Exception as e:
            print(e)
            return -1
        finally:
            self.close()
1091255
def search(self, query, limit=None):
        
        return self._limit_get('search', params=dict(q=query), limit=limit)
401035
def send_query(self, query):
        
        message = riemann_client.riemann_pb2.Msg()
        message.query.string = query
        return self.transport.send(message)
1294145
def _query(self, x, result):
        '''
        
        '''
        if self.single_interval is None: # Empty
            return
        elif self.single_interval != 0:  # Single interval, just check whether x is in it
            if self.single_interval[0] <= x < self.single_interval[1]:
                result.append(self.single_interval)
        elif x < self.center:            # Normal tree, query point to the left of center
            if self.left_subtree is not None:
                self.left_subtree._query(x, result)
            for int in self.mid_sorted_by_start:
                if int[0] <= x:
                    result.append(int)
                else:
                    break
        else:  # Normal tree, query point to the right of center
            for int in self.mid_sorted_by_end:
                if int[1] > x:
                    result.append(int)
                else:
                    break
            if self.right_subtree is not None:
                self.right_subtree._query(x, result)
894595
def query(cls, name=None, offset=None, limit=None, api=None):
        

        api = api or cls._API
        return super(Automation, cls)._query(
            url=cls._URL['query'],
            name=name,
            offset=offset,
            limit=limit,
            api=api,
        )
165358
def query(self):
        
        if self._loadQuery is not None:
            return self._loadQuery
        
        container = self.widget(0)
        if container:
            query = container.query()
        else:
            query = Query()
        
        return query
1205357
def query(self, value=None):
        
        if value is not None:
            return URL._mutate(self, query=value)
        return self._tuple.query
765311
def _query(options, collection_name, num_to_skip,
           num_to_return, query, field_selector, opts, check_keys):
    """"""
    encoded = _dict_to_bson(query, check_keys, opts)
    if field_selector:
        efs = _dict_to_bson(field_selector, False, opts)
    else:
        efs = b""
    max_bson_size = max(len(encoded), len(efs))
    return b"".join([
        _pack_int(options),
        _make_c_string(collection_name),
        _pack_int(num_to_skip),
        _pack_int(num_to_return),
        encoded,
        efs]), max_bson_size