Count the number of connections currently in use to a given
        address.
350560
def in_use_connection_count(self, address):
        
        try:
            connections = self.connections[address]
        except KeyError:
            return 0
        else:
            return sum(1 if connection.in_use else 0 for connection in connections)
10447
def get_connections_by_dest(self, dest):
        ''''''
        with self._mutex:
            res = []
            for c in self.connections:
                if c.has_port(self) and c.has_port(dest):
                    res.append(c)
            return res
1199828
def connection(self):
        """"""
        self.getPorts()         # acquire if necessary
        self.getIPaddresses()   # acquire if necessary
        return (self.ipAddress, self.ports)
860901
private long getIPv4Count(boolean excludeZeroHosts, int segCount) {
		if(!isMultiple()) {
			if(excludeZeroHosts && isZero()) {
				return 0L;
			}
			return 1L;
		}
		long result = getCount(i -> getSegment(i).getValueCount(), segCount);
		if(excludeZeroHosts && includesZeroHost()) {
			int prefixedSegment = getNetworkSegmentIndex(getNetworkPrefixLength(), IPv4Address.BYTES_PER_SEGMENT, IPv4Address.BITS_PER_SEGMENT);
			long zeroHostCount = getCount(i -> {
				if(i == prefixedSegment) {
					IPAddressSegment seg = getSegment(i);
					int shift = seg.getBitCount() - seg.getSegmentPrefixLength();
					int count = ((seg.getUpperSegmentValue() >>> shift) - (seg.getSegmentValue() >>> shift)) + 1;
					return count;
				}
				return getSegment(i).getValueCount();
			}, prefixedSegment + 1);
			result -= zeroHostCount;
		}
		return result;
	}
336842
def dependents_of_addresses(self, addresses):
    """"""
    seen = OrderedSet(addresses)
    for address in addresses:
      seen.update(self._dependent_address_map[address])
      seen.update(self._implicit_dependent_address_map[address])
    return seen
719371
def count(self):
        """"""
        cursor = self.conn.cursor()
        with contextlib.closing(cursor):
            cursor.execute('SELECT COUNT(*) FROM events')
            res = cursor.fetchone()
            return res[0]
491552
def ip_to_array(ipaddress):
    """"""
    res = []
    for i in ipaddress.split("."):
        res.append(int(i))

    assert len(res) == 4
    return res
779796
def _find_address_range(addresses):
    
    first = last = addresses[0]
    last_index = 0
    for ip in addresses[1:]:
        if ip._ip == last._ip + 1:
            last = ip
            last_index += 1
        else:
            break
    return (first, last, last_index)
295662
def listunspent(
        self,
        address: str="",
        minconf: int=1,
        maxconf: int=999999,
    ) -> list:
        '''
        '''
        if address:
            return self.req("listunspent", [minconf, maxconf, [address]])

        return self.req("listunspent", [minconf, maxconf])
679631
def countDirectlyConnected(port: LPort, result: dict) -> int:
    
    inEdges = port.incomingEdges
    outEdges = port.outgoingEdges

    if port.children:
        ch_cnt = 0
        # try:
        #    assert not inEdges, (port, port.children, inEdges)
        #    assert not outEdges, (port, port.children, outEdges)
        # except AssertionError:
        #    raise
        for ch in port.children:
            ch_cnt += countDirectlyConnected(ch, result)

        return ch_cnt

    elif not inEdges and not outEdges:
        # this port is not connected, just check if it expected state
        if port.direction == PortType.INPUT:
            if port.originObj is not None:
                assert not port.originObj.src.drivers, port.originObj
            else:
                print("Warning", port, "not connected")
        return 0
    else:
        connectedElemCnt = 0
        for e in inEdges:
            connectedElemCnt += len(e.srcs)
            if connectedElemCnt > 1:
                return 0

        for e in outEdges:
            connectedElemCnt += len(e.dsts)
            if connectedElemCnt > 1:
                return 0

        if connectedElemCnt != 1:
            return 0

        if inEdges:
            e = inEdges[0]
        else:
            e = outEdges[0]

        # if is connected to different port
        if e.srcs[0].name != e.dsts[0].name:
            return 0

        if e.srcs[0] is port:
            p = e.dsts[0].parent
        else:
            # (can be hyperedge and then this does not have to be)
            # assert e.dsts[0] is port, (e, port)
            p = e.srcs[0].parent

        # if is part of interface which can be reduced
        if not isinstance(p, LNode):
            connections = result.get(p, [])
            connections.append((port, e))
            result[p] = connections

        return 1
642066
def _available_connections(self, key: 'ConnectionKey') -> int:
        

        if self._limit:
            # total calc available connections
            available = self._limit - len(self._acquired)

            # check limit per host
            if (self._limit_per_host and available > 0 and
                    key in self._acquired_per_host):
                acquired = self._acquired_per_host.get(key)
                assert acquired is not None
                available = self._limit_per_host - len(acquired)

        elif self._limit_per_host and key in self._acquired_per_host:
            # check limit per host
            acquired = self._acquired_per_host.get(key)
            assert acquired is not None
            available = self._limit_per_host - len(acquired)
        else:
            available = 1

        return available
382898
def get_address_transactions(self, address_id, **params):
        """"""
        return self.api_client.get_address_transactions(self.id, address_id, **params)
748610
public final int getActiveConnectionCount() {

      if(!isActive) {
         return 0;
      }

      int count = 0;
      for(ConnectionPoolConnection conn : connections) {
         if(conn.state.get() != ConnectionPoolConnection.STATE_AVAILABLE) {
            count++;
         }
      }

      return count;
   }
1165647
def search(query, count=10)
      return [] if query.length < 4
      response = @connection.get DOMESTIC_URL, params: { q: query.to_ascii, count: count }
      addresses = response.parsed['addresses'].each do |a|
        a['address_id'] = Integer(a['address_id'])
        a['dpid'] = Integer(a['dpid']) if a['dpid']
      end
      addresses.map {|address| OpenStruct.new(address)}
    end
152916
def getconnections(self, vhost = None):
        ""
        if vhost is None:
            return list(self.managed_connections)
        else:
            return [c for c in self.managed_connections if c.protocol.vhost == vhost]
528783
public function count(): int
    {
        $network_size = gmp_init($this->getNbAddresses());
        if (gmp_cmp($network_size, PHP_INT_MAX) > 0) {
            throw new \RuntimeException('The number of addresses is bigger than PHP_INT_MAX, use getNbAddresses() instead');
        }

        return gmp_intval($network_size);
    }
308772
def connectNetToMs(Facility_presence=0, ProgressIndicator_presence=0,
                   ConnectedNumber_presence=0, ConnectedSubaddress_presence=0,
                   UserUser_presence=0):
    """"""
    a = TpPd(pd=0x3)
    b = MessageType(mesType=0x7)  # 00000111
    packet = a / b
    if Facility_presence is 1:
        c = FacilityHdr(ieiF=0x1C, eightBitF=0x0)
        packet = packet / c
    if ProgressIndicator_presence is 1:
        d = ProgressIndicatorHdr(ieiPI=0x1E, eightBitPI=0x0)
        packet = packet / d
    if ConnectedNumber_presence is 1:
        e = ConnectedNumberHdr(ieiCN=0x4C, eightBitCN=0x0)
        packet = packet / e
    if ConnectedSubaddress_presence is 1:
        f = ConnectedSubaddressHdr(ieiCS=0x4D, eightBitCS=0x0)
        packet = packet / f
    if UserUser_presence is 1:
        g = UserUserHdr(ieiUU=0x7F, eightBitUU=0x0)
        packet = packet / g
    return packet