Add a port object to the definition

        :param port: port definition
        :type port: PortDef
554506
def add_port(self, port):
        
        self.ports.append(port)
        if port.io_type not in self.port_seqs:
            self.port_seqs[port.io_type] = 0
        self.port_seqs[port.io_type] += 1
        port.sequence = self.port_seqs[port.io_type]
        return self
679594
def port_type(arg):
	""""""
	error_msg = "{0} is not a valid port".format(repr(arg))
	try:
		arg = ast.literal_eval(arg)
	except ValueError:
		raise argparse.ArgumentTypeError(error_msg)
	if arg < 0 or arg > 65535:
		raise argparse.ArgumentTypeError(error_msg)
	return arg
467042
public void bind(ExposedPort exposedPort, Binding binding) {
        if (ports.containsKey(exposedPort)) {
            Binding[] bindings = ports.get(exposedPort);
            ports.put(exposedPort, (Binding[]) ArrayUtils.add(bindings, binding));
        } else {
            if (binding == null) {
                ports.put(exposedPort, null);
            } else {
                ports.put(exposedPort, new Binding[] {binding});
            }
        }
    }
43943
void configurePort(String port) {

        if (StringUtils.isNotBlank(port)) {
            try {
                this.port = Integer.parseInt(port);
                log.info("Using port {}", this.port);
            } catch (NumberFormatException e) {
                log.info("Unable to parse server PORT variable ({}). Defaulting to port {}", port, this.port);
            }
        }
    }
274327
def add(self, port, pkt):
        '''
        
        '''
        id = len(self._buffer) + 1
        if id > self._buffsize:
            raise FullBuffer()

        self._buffer[id] = (port, deepcopy(pkt))
        return id
365433
public UriComponentsBuilder port(int port) {
		Assert.isTrue(port >= -1, "'port' must not be < -1");
		this.port = String.valueOf(port);
		resetSchemeSpecificPart();
		return this;
	}
1025140
def create_ports(port, mpi, rank):
        """"""
        if port == "random" or port is None:
            # ports will be filled in using random binding
            ports = {}
        else:
            port = int(port)
            ports = {
                "REQ": port + 0,
                "PUSH": port + 1,
                "SUB": port + 2
            }
        # if we want to communicate with separate domains
        # we have to setup a socket for each of them
        if mpi == 'all':
            # use a socket for each rank rank
            for port in ports:
                ports[port] += (rank * 3)
        return ports
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.')
251280
def build_data_input(cls, name='input'):
        
        return cls(name, PortDirection.INPUT, type=PortType.DATA)
778221
def _fix_port_assignment(self):
        

        port_name = ''
        port_number = None

        if self._port:
            if isinstance(self._port, int):
                port_number = self._port
                port_name = get_port_name(port_number)
            elif isinstance(self._port, string_types):
                port_name = self._port
                port_number = get_port_number(port_name)
            else:
                raise ValueError('Cannot assign port name/number '
                        'based on port assignment type %r' % self._port)

            self._port = port_number
            self._portname = port_name or ''
676348
def addInputPort(self, node, name,
                     i: Union[Value, RtlSignalBase],
                     side=PortSide.WEST):
        
        root = self.node
        port = node.addPort(name, PortType.INPUT, side)
        netCtxs = self.netCtxs

        if isinstance(i, LPort):
            root.addEdge(i, port)
        elif isConst(i):
            i = i.staticEval()
            c, wasThereBefore = self.netCtxs.getDefault(i)
            if not wasThereBefore:
                v = ValueAsLNode(root, i).east[0]
                c.addDriver(v)
            c.addEndpoint(port)
        elif i.hidden:
            # later connect driver of this signal to output port
            ctx, wasThereBefore = netCtxs.getDefault(i)
            if not wasThereBefore:
                self.lazyLoadNet(i)
            ctx.addEndpoint(port)
        else:
            portCtx = self.portCtx
            rootCtx, _ = self.rootNetCtxs.getDefault(i)

            if self.isVirtual:
                # later connect signal in root to input port or input port of
                # wrap node
                rootCtx.addEndpoint(port)
            else:
                # spot input port on this wrap node if required
                isNewlySpotted = (i, PortType.INPUT) not in portCtx.data
                src = portCtx.register(i, PortType.INPUT)
                # connect input port on wrap node with specified output port
                ctx, _ = netCtxs.getDefault(i)
                ctx.addDriver(src)
                ctx.addEndpoint(port)

                if isNewlySpotted:
                    # get input port from parent view
                    _port = portCtx.getOutside(i, PortType.INPUT)
                    rootCtx.addEndpoint(_port)
1342451
def _initialize(cls, port, secret):
        
        cls._port = port
        cls._secret = secret
54604
def port(self, check=False):
        
        if not self.__ports:  # refresh ports if sequence is empty
            self.refresh()

        try:
            port = self.__ports.pop()
            if check:
                while not self.__check_port(port):
                    self.release_port(port)
                    port = self.__ports.pop()
        except (IndexError, KeyError):
            raise IndexError("Could not find a free port,\nclosed ports: {closed}".format(closed=self.__closed))
        self.__closed.add(port)
        return port
503155
public function setPort($port)
    {
        if (!ctype_digit($port)) {
            trigger_error('Port must be a positive integer: ' . var_export($port, true), E_USER_ERROR);
        }
        $this->port = $port;
    }
1294677
def delete_port(self, port):
        '''
        
        '''
        port_id = self._find_port_id(port)
        ret = self.network_conn.delete_port(port=port_id)
        return ret if ret else True
44619
public static AltsServerBuilder forPort(int port) {
    NettyServerBuilder nettyDelegate = NettyServerBuilder.forAddress(new InetSocketAddress(port));
    return new AltsServerBuilder(nettyDelegate);
  }
604451
def add_port(zone, port, permanent=True):
    '''
    
    '''
    cmd = '--zone={0} --add-port={1}'.format(zone, port)

    if permanent:
        cmd += ' --permanent'

    return __firewall_cmd(cmd)