Return the available ports of this supervisor.
348686
public Set<Integer> getAvailablePorts(SupervisorDetails supervisor) {
        Set<Integer> usedPorts = this.getUsedPorts(supervisor);

        Set<Integer> ret = new HashSet<>();
        ret.addAll(getAssignablePorts(supervisor));
        ret.removeAll(usedPorts);

        return ret;
    }
1310292
public static TreeSet<Integer> getUsableLocalPorts(int numRequested, int minPort, int maxPort) {
		final TreeSet<Integer> availablePorts = new TreeSet<>();
		int attemptCount = 0;
		while ((++attemptCount <= numRequested + 100) && availablePorts.size() < numRequested) {
			availablePorts.add(getUsableLocalPort(minPort, maxPort));
		}

		if (availablePorts.size() != numRequested) {
			throw new UtilException("Could not find {} available  ports in the range [{}, {}]", numRequested, minPort, maxPort);
		}

		return availablePorts;
	}
1177289
def find_available_port():
    
    s = socket.socket()
    s.bind(('localhost', 0))
    _address, port = s.getsockname()
    s.close()
    return port
1019658
def show_port(self, port, **_params):
        """"""
        return self.get(self.port_path % (port), params=_params)
646096
def filter_inactive_ports(query):
    
    port_model = models_v2.Port
    query = (query
             .filter(port_model.status == n_const.PORT_STATUS_ACTIVE))
    return query
170711
def source_ports(self):
        
        start_port = self.blacklist.get('BlacklistEntrySourcePort')
        if start_port is not None:
            return '{}-{}'.format(
                start_port, self.blacklist.get('BlacklistEntrySourcePortRange'))
        return 'ANY'
20638
def _get_hosts_from_ports(self, ports):
        
        hosts = map(lambda x: 'localhost:%d' % int(x.strip()), ports.split(','))
        return list(set(hosts))
677650
def connected_svcports(self):
        '''

        '''
        return [p for p in self.ports \
                if p.__class__.__name__ == 'CorbaPort' and p.is_connected]
641862
def get_connections_by_dests(self, dests):
        ''''''
        with self._mutex:
            res = []
            for c in self.connections:
                if not c.has_port(self):
                    continue
                has_dest = False
                for d in dests:
                    if c.has_port(d):
                        has_dest = True
                        break
                if has_dest:
                    res.append(c)
            return res
130684
public Set<Integer> getUsedPorts(SupervisorDetails supervisor) {
        Map<String, SchedulerAssignment> assignments = this.getAssignments();
        Set<Integer> usedPorts = new HashSet<>();

        for (SchedulerAssignment assignment : assignments.values()) {
            for (WorkerSlot slot : assignment.getExecutorToSlot().values()) {
                if (slot.getNodeId().equals(supervisor.getId())) {
                    usedPorts.add(slot.getPort());
                }
            }
        }

        return usedPorts;
    }
540870
def export_capacities(self):
        
        return [export for cls in getmro(type(self)) if hasattr(cls, "EXPORT_TO") for export in cls.EXPORT_TO]
1020883
def ports_to_spawn(self):
        
        return (self.config.get(config.HTTP_SERVER, dict()).get(config.PORTS)
                or self.DEFAULT_PORTS)
1062337
def ports(self) -> dict:
        """"""
        return {
            param: self[param].raw
            for param in self
            if param.startswith(IOPORT)
        }
1367242
def get_unassigned_ports(self):
        
        uri = "{}/unassignedPortsForPortMonitor".format(self.data["uri"])
        response = self._helper.do_get(uri)

        return self._helper.get_members(response)
486048
def getservers(self, vhost = None):
        '''
        
        '''
        if vhost is not None:
            return [s for s in self.connections if s.protocol.vhost == vhost]
        else:
            return list(self.connections)
374992
def _get_containers(self):
        """"""
        infos = self.native_conn.list_containers_info()
        return [self.cont_cls(self, i['name'], i['count'], i['bytes'])
                for i in infos]
176312
def p_instance_ports_list(self, p):
        ''
        p[0] = p[1] + (p[3],)
        p.set_lineno(0, p.lineno(1))