The skip command

        Args:
            query (str): The number of items to skip
18616
async def skip(self, query="1"):
        

        if not self.state == 'ready':
            logger.debug("Trying to skip from wrong state '{}'".format(self.state))
            return

        if query == "":
            query = "1"
        elif query == "all":
            query = str(len(self.queue) + 1)

        try:
            num = int(query)
        except TypeError:
            self.statuslog.error("Skip argument must be a number")
        except ValueError:
            self.statuslog.error("Skip argument must be a number")
        else:
            self.statuslog.info("Skipping")

            for i in range(num - 1):
                if len(self.queue) > 0:
                    self.prev_queue.append(self.queue.pop(0))

            try:
                self.streamer.stop()
            except Exception as e:
                logger.exception(e)
1203449
def delete(queue, items):
    '''
    
    '''
    con = _conn(queue)
    with con:
        cur = con.cursor()
        if isinstance(items, six.string_types):
            items = _quote_escape(items)
            cmd = """DELETE FROM {0} WHERE name = '{1}'""".format(queue, items)
            log.debug('SQL Query: %s', cmd)
            cur.execute(cmd)
            return True
        if isinstance(items, list):
            items = [_quote_escape(el) for el in items]
            cmd = 'DELETE FROM {0} WHERE name = ?'.format(queue)
            log.debug('SQL Query: %s', cmd)
            newitems = []
            for item in items:
                newitems.append((item,))
                # we need a list of one item tuples here
            cur.executemany(cmd, newitems)
        if isinstance(items, dict):
            items = salt.utils.json.dumps(items).replace('"', "'")
            items = _quote_escape(items)
            cmd = ("""DELETE FROM {0} WHERE name = '{1}'""").format(queue, items)  # future lint: disable=blacklisted-function
            log.debug('SQL Query: %s', cmd)
            cur.execute(cmd)
            return True
        return True
737776
def setCurrentQuery( self, query ):
        
        self.clear()
        
        for entry in query:
            self.addLineWidget(entry)
        
        # make sure we have the minimum number of widgets
        for i in range(self.minimumCount() - len(query)):
            self.addLineWidget()
1335872
def _query_uncompressed(options, collection_name, num_to_skip,
          num_to_return, query, field_selector, opts, check_keys=False):
    """"""
    op_query, max_bson_size = _query(
        options,
        collection_name,
        num_to_skip,
        num_to_return,
        query,
        field_selector,
        opts,
        check_keys)
    rid, msg = __pack_message(2004, op_query)
    return rid, msg, max_bson_size
791012
def skip_item_key(self, item, key):
        
        if "skip" in item:
            item["skip"].append(key)
        else:
            item["skip"] = [key]
        return item
1085204
def skip(self, count):
        '''
        
        '''
        skipped = 0
        for _ in range(count):
            if self.mutate():
                skipped += 1
            else:
                break
        return skipped
777392
def compile_query(query: dict) -> PyQuery:
    

    def _pair_to_dict(pair):
        if isinstance(pair, dict):
            return pair
        return {pair[0]: pair[1]}

    def _reduce(pair):
        try:
            return {'and': (_pair_to_dict(pair[0]), _pair_to_dict(pair[1]))}
        except (KeyError, IndexError):
            return _pair_to_dict(pair)

    def _get_first_pair(d: dict):
        return list(query.items())[0]

    if len(query) < 2:
        return compile_single_item(*_get_first_pair(query))
    try:
        reduced = reduce(lambda x, y: _reduce((x, y)), query.items())
    except KeyError:
        print(query)
        reduced = query
        raise
    return compile_single_item(*_get_first_pair(reduced))
391627
def Query(self, query, parameters=None):
    
    # TODO: catch Warning and return None.
    # Note that we cannot pass parameters as a keyword argument here.
    # A parameters value of None is not supported.
    if parameters:
      self._cursor.execute(query, parameters)
    else:
      self._cursor.execute(query)

    return self._cursor.fetchall()
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
818911
def delete_by_query!(query, params = nil, request_options = {})
      res = delete_by_query(query, params, request_options)
      wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) if res
      res
    end
1122890
private function truncate_skip( &$ret, $text, $search, $start, $len = null ) {
		if ( $len === null ) {
			$len = -1; // -1 means "no limit" for strcspn
		} elseif ( $len < 0 ) {
			$len = 0; // sanity
		}
		$skipCount = 0;
		if ( $start < strlen( $text ) ) {
			$skipCount = strcspn( $text, $search, $start, $len );
			$ret .= substr( $text, $start, $skipCount );
		}
		return $skipCount;
	}
1327563
def enumerate_query_by_limit(q, limit=1000):
    
    for offset in count(0, limit):
        r = q.offset(offset).limit(limit).all()

        for row in r:
            yield row

        if len(r) < limit:
            break
362640
function skip(value) {

        //Check arguments
        if (value < 0)
            throw new Error("Value must be greater or equals zero");
			
		//Copy array in order to avoid modifications on original
		var outData = [];
		for(var i = 0; i < this.items.length; i++){
			outData.push(this.items[i]);
		}

		//Slice source array
		var slicedData = outData.slice(value);
			
		//Return for chaining
        return new jslinq(slicedData);
    }
1055314
def canned_query(n,s):
    
    qobj = qmap[n]
    chain = qobj['chain']
    prefix = qobj['prefix']
    whr = chain2where(chain + [prefix], 'x')
    query = """
    SELECT * WHERE {{
    <{s}> {w}
    }}
    """.format(s=s, w=whr)
    bindings = run_sparql(query)
    rows = [ensure_prefixed(r['x']['value'], prefix) for r in bindings]
    return rows
974605
def query_mongo_sort_decend(
        database_name,
        collection_name,
        query={},
        skip=0,
        limit=getattr(
            settings,
            'MONGO_LIMIT',
            200),
    return_keys=(),
        sortkey=None):
    

    l = []
    response_dict = {}

    try:
        mongodb_client_url = getattr(settings, 'MONGODB_CLIENT',
                                     'mongodb://localhost:27017/')
        mc = MongoClient(mongodb_client_url,document_class=OrderedDict)

        db = mc[str(database_name)]
        collection = db[str(collection_name)]

        if return_keys:
            return_dict = {}
            for k in return_keys:
                return_dict[k] = 1
            # print "returndict=",return_dict
            mysearchresult = collection.find(
                query, return_dict).skip(skip).limit(limit).sort(
                sortkey, DESCENDING)
        else:
            mysearchresult = collection.find(query).skip(
                skip).limit(limit).sort(sortkey, DESCENDING)

        # response_dict['num_results']=int(mysearchresult.count(with_limit_and_skip=False))
        response_dict['code'] = 200
        response_dict['type'] = "search-results"
        for d in mysearchresult:
            d['id'] = d['_id'].__str__()
            del d['_id']
            l.append(d)
        response_dict['results'] = l

    except:
        print("Error reading from Mongo")
        print(str(sys.exc_info()))
        response_dict['num_results'] = 0
        response_dict['code'] = 500
        response_dict['type'] = "Error"
        response_dict['results'] = []
        response_dict['message'] = str(sys.exc_info())
    return response_dict
1183278
def delete_many(self, query):
        
        items = self.find(query)
        result = [
            self.table.remove(where(u'_id') == item[u'_id'])
            for item in items
        ]

        if query == {}:
            # need to reset TinyDB's index for docs order consistency
            self.table._last_id = 0

        return DeleteResult(raw_result=result)
1031300
def one(self, command, params=None):
        
        dr = self.query(command, params)
        if dr['rows']:
            return dr['rows'][0]
        else:
            return None