Get the number of names, optionally counting the expired ones
    Return {'error': ...} on failure
9126
def get_num_names(include_expired=False, proxy=None, hostport=None):
    
    assert proxy or hostport, 'Need proxy or hostport'
    if proxy is None:
        proxy = connect_hostport(hostport)

    schema = {
        'type': 'object',
        'properties': {
            'count': {
                'type': 'integer',
                'minimum': 0,
            },
        },
        'required': [
            'count',
        ],
    }

    count_schema = json_response_schema(schema)

    resp = {}
    try:
        if include_expired:
            resp = proxy.get_num_names_cumulative()
        else:
            resp = proxy.get_num_names()

        resp = json_validate(count_schema, resp)
        if json_is_error(resp):
            return resp

    except ValidationError as e:
        if BLOCKSTACK_DEBUG:
            log.exception(e)

        resp = {'error': 'Server response did not match expected schema.  You are likely communicating with an out-of-date Blockstack node.', 'http_status': 502}
        return resp

    except socket.timeout:
        log.error("Connection timed out")
        resp = {'error': 'Connection to remote host timed out.', 'http_status': 503}
        return resp

    except socket.error as se:
        log.error("Connection error {}".format(se.errno))
        resp = {'error': 'Connection to remote host failed.', 'http_status': 502}
        return resp

    except Exception as ee:
        if BLOCKSTACK_DEBUG:
            log.exception(ee)

        log.error("Caught exception while connecting to Blockstack node: {}".format(ee))
        resp = {'error': 'Failed to contact Blockstack node.  Try again with `--debug`.', 'http_status': 500}
        return resp

    return resp['count']
202959
def count(limit = false)
      command = { count: collection.name, query: selector }
      command.merge!(skip: operation.skip, limit: operation.limit) if limit
      result = collection.database.command(command)
      result["n"].to_i
    end
888035
def count_waiting_jobs(cls, names):
        
        return sum([queue.waiting.llen() for queue in cls.get_all(names)])
305959
def count(self):
        

        try:
            return self.object_list.count()
        except (AttributeError, TypeError):
            # AttributeError if object_list has no count() method.
            # TypeError if object_list.count() requires arguments
            # (i.e. is of type list).
            return len(self.object_list)
582657
def get_all_names( self, offset=None, count=None, include_expired=False ):
        
        if offset is not None and offset < 0:
            offset = None

        if count is not None and count < 0:
            count = None 

        cur = self.db.cursor()
        names = namedb_get_all_names( cur, self.lastblock, offset=offset, count=count, include_expired=include_expired )
        return names
337729
def rpc_get_num_names( self, **con_info ):
        
        db = get_db_state(self.working_dir)
        num_names = db.get_num_names()
        db.close()

        return self.success_response( {'count': num_names} )
814165
def get_last(self, num=10):
        
        max_item = self.get_max_item()
        urls = [urljoin(self.item_url, F"{i}.json") for i in range(
            max_item - num + 1, max_item + 1)]
        result = self._run_async(urls=urls)
        return [Item(r) for r in result if r]
677881
def get_names(cs):
    """"""
    records = []
    for c in cs:
        records.extend(c.get('names', []))
    return records
1061755
function count(req, res, next) {
  db.users.count(function(err, count) {
    if(err) { return next(err); }
    res.json({count: count});
  });
}
1195552
def get_entries_count(module_name, query, opts={})
    login! unless logged_in?
    options = {
      :deleted => 0
    }.merge! opts

    json = <<-EOF
      {
        "session": "#{@sugar_session_id}",
        "module_name": "#{module_name}",
        "query": "#{query}",
        "deleted": #{options[:deleted]}
      }
    EOF
    json.gsub!(/^\s{6}/,'')
    send!(:get_entries_count, json)
  end
7810
def count(self, until=None):
        

        until = rationalize_until(until)
        return self.connection.zcount(self.scheduled_jobs_key, 0, until)
1368936
def count(self):
        
        params = self.dump()
        params['limit'] = 0
        params['count'] = 1
        content = self._do_request(params)
        return content['count']
1094388
def getVersionListCount(self, orgresource):
        

        url = nurls['getVersionListCount']

        data = {'userid': self.user_id,
                'useridx': self.useridx,
                'orgresource': orgresource,
                }

        r = self.session.post(url = url, data = data)
        j = json.loads(r.text)

        if j['message'] != 'success':
            print "[*] Error getVersionListCount: " + j['message']
            return False
        else:
            return int(j['resultvalue']['count'])
438636
def num_failures(self):
        
        min_time = time.time() - self.window

        while self.failures and self.failures[0] < min_time:
            self.failures.popleft()

        return len(self.failures)
1094415
def get_release_count(self, package_name: str) -> int:
        
        validate_package_name(package_name)
        self._validate_set_registry()
        return self.registry._num_release_ids(package_name)
1027773
def get_unique_name(name='', collection=()):
    '''
    
    '''
    if name not in collection:
        return name
    i = 1
    while True:
        i += 1
        name2 = '%s_%s' % (name, i)
        if name2 not in collection:
            return name2
49999
def _get_names(self):
        
        names = self._read_name_file('names.json')
        names = self._compute_weights(names)

        return names