Find and return a port tuple for the specified port.
        Created and added when not found.
        @param port: A port.
        @type port: I{service.Port}
        @return: A port tuple.
        @rtype: (port, [method])
971177
def findport(self, port):
        
        for p in self.ports:
            if p[0] == p:
                return p
        p = (port, [])
        self.ports.append(p)
        return p
1173080
def port=(new_port)
      return if new_port == port
      raise JSS::InvalidDataError, 'ports must be Integers' unless port.is_a? Integer
      @port = new_port
      @need_to_update = true
    end
108069
def port_pair(self):
        """"""
        if self.transport is NotSpecified:
            return (self.port, "tcp")
        else:
            return (self.port, self.transport)
1092064
def set_tcp_port(self, tcp_port):
        
        if tcp_port is None:
            self.tcp_port = None
            return
        self.tcp_port = int(tcp_port)
155307
public static WebsocketServerTransport create(int port) {
    HttpServer httpServer = HttpServer.create().port(port);
    return create(httpServer);
  }
222920
def p_instance_port_list(self, p):
        ''
        p[0] = PortArg(None, p[1], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
157616
def return_port(port):
    """"""
    if port in _random_ports:
        _random_ports.remove(port)
    elif port in _owned_ports:
        _owned_ports.remove(port)
        _free_ports.add(port)
    elif port in _free_ports:
        logging.info("Returning a port that was already returned: %s", port)
    else:
        logging.info("Returning a port that wasn't given by portpicker: %s",
                     port)
1344737
def port(self, value):
        

        if value is not None:
            assert type(value) is int, "'{0}' attribute: '{1}' type is not 'int'!".format(
                "port", value)
            assert type(value) >= 0 and type(value) >= 65535, \
                "'{0}' attribute: '{1}' value must be in 0-65535 range!".format("port", value)
        self.__port = value
636854
def bind_port(requested_port):
  """"""
  sockets = tornado.netutil.bind_sockets(requested_port)

  if requested_port != 0:
    return sockets, requested_port

  # Get the actual port number.
  for s in sockets:
    host, port = s.getsockname()[:2]
    if host == '0.0.0.0':
      return sockets, port

  raise RuntimeError('Could not determine the bound port.')
359701
def record_tcp_port(self, port):
        

        if port not in self._used_tcp_ports:
            self._used_tcp_ports.add(port)
139221
def _translate_port(port):
    '''
    
    '''
    services = _get_services_mapping()
    if port in services and services[port]['port']:
        return services[port]['port'][0]
    return port
504787
function (port, protocol) {
        var portRegex = this._matchPatternObject.port,

            // default port for given protocol
            defaultPort = protocol && DEFAULT_PROTOCOL_PORT[protocol];

        // return true if both given port and match pattern are absent
        if (typeof port === UNDEFINED && typeof portRegex === UNDEFINED) {
            return true;
        }

        // convert integer port to string
        (port && typeof port !== STRING) && (port = String(port));

        // assign default port or portRegex
        !port && (port = defaultPort);
        !portRegex && (portRegex = defaultPort);

        // matches * or specific port
        return (
            portRegex === MATCH_ALL ||
            portRegex === port
        );
    }
476211
def port(self):
        """"""
        self._port = self.lib.iperf_get_test_server_port(self._test)
        return self._port
1138228
def remove_port(port)
      case port.type
      when :input
        input_ports.delete(port.name)
      when :output
        output_ports.delete(port.name)
      end
    end
1354460
def http_client(self, port=None):
        
        # Local import to avoid potential circularity.
        from seaworthy.client import ContainerHttpClient
        client = ContainerHttpClient.for_container(self, container_port=port)
        self._http_clients.append(client)
        return client
1183320
def get_port_by_ref(self, port_ref):
        '''

        '''
        with self._mutex:
            for p in self.ports:
                if p.object._is_equivalent(port_ref):
                    return p
            return None
409377
def do_get_port_config(self, line):
        

        def f(p, args):
            try:
                source, port = args
            except:
                print("argument error")
                return
            o = p.get_config(source)
            for p in o.resources.port:
                if p.resource_id != port:
                    continue
                print(p.resource_id)
                conf = p.configuration
                for k in self._port_settings:
                    try:
                        v = getattr(conf, k)
                    except AttributeError:
                        continue
                    print('%s %s' % (k, v))

        self._request(line, f)