Return the port subcomponent of the URI authority as an
        :class:`int`, or `default` if the original URI reference did
        not contain a port or if the port was empty.
493195
def getport(self, default=None):
        
        port = self.port
        if port:
            return int(port)
        else:
            return default
172024
public function port(int $defaultPort = null)
    {
        if ($this->parsedUri->hasPort()) {
            return $this->parsedUri->port();
        }

        return $defaultPort;
    }
529976
def get(self, uri):
        
        return self.send_request(
            "{0}://{1}:{2}{3}{4}".format(
                self.get_protocol(),
                self.host,
                self.port,
                uri,
                self.client_id
            )
        )
652718
def from_uri(cls, uri, socket_timeout=None, auto_decode=False):
        
        parts = six.moves.urllib.parse.urlparse(uri)
        if parts.scheme.lower() not in ('beanstalk', 'beanstalkd'):
            raise ValueError('Invalid scheme %s' % parts.scheme)
        ipv6_md = re.match(r'^\[([0-9a-fA-F:]+)\](:[0-9]+)?$', parts.netloc)
        if ipv6_md:
            host = ipv6_md.group(1)
            port = ipv6_md.group(2) or '11300'
            port = port.lstrip(':')
        elif ':' in parts.netloc:
            host, port = parts.netloc.rsplit(':', 1)
        else:
            host = parts.netloc
            port = 11300
        port = int(port)
        return cls(host, port, socket_timeout=socket_timeout, auto_decode=auto_decode)
1356792
def _get_connection(self, uri, headers=None):
    
    connection = None
    if uri.scheme == 'https':
      if not uri.port:
        connection = httplib.HTTPSConnection(uri.host)
      else:
        connection = httplib.HTTPSConnection(uri.host, int(uri.port))
    else:
      if not uri.port:
        connection = httplib.HTTPConnection(uri.host)
      else:
        connection = httplib.HTTPConnection(uri.host, int(uri.port))
    return connection
1031167
function _getHostAddress (uri, defaultHost, defaultPort) {
      const addr = {};

      if (uri === undefined) { // If no uri, use default
        addr.protocol = 'http://';
        addr.port = defaultPort;
        addr.host = defaultHost;
      } else { // Otherwise parse provided uri
        const uriSplit = uri.replace(/http:\/\/|https:\/\//, '').split(':', 2);

        addr.protocol = (uri.toLowerCase().indexOf('https') == 0 ? 'https://' : 'http://');

        if (uriSplit.length == 0) {
          throw new Error('Invalid webdriveruri specified:' + uri);
        } else if (uriSplit.length < 2) {
          addr.port = defaultPort;
        } else {
          addr.port = uriSplit[1];
        }
        addr.host = uriSplit[0];
      }
      return addr.protocol + addr.host + ':' + addr.port;
    }
213805
public function getDefaultPort()
    {
        if (!$this->hasDefaultPort()) throw new UrlException(sprintf(
            "No default port for URL '%s'",
            $this->_inputString
        ));

        $scheme = $this->getScheme();
        if ($scheme == 'http') return 80;
        elseif ($scheme == 'https') return 443;
        else throw new UrlException("No default port for scheme '$scheme'");
    }
208047
def reduce_uri(self, uri, default_port=True):
        """"""
        # note HTTP URLs do not have a userinfo component
        parts = urlsplit(uri)
        if parts[1]:
            # URI
            scheme = parts[0]
            authority = parts[1]
            path = parts[2] or '/'
        else:
            # host or host:port
            scheme = None
            authority = uri
            path = '/'
        host, port = splitport(authority)
        if default_port and port is None and scheme is not None:
            dport = {"http": 80,
                     "https": 443,
                     }.get(scheme)
            if dport is not None:
                authority = "%s:%d" % (host, dport)
        return authority, path
144851
def port_uri_segment(self):
        
        if self._port_uri_segment is None:
            family = self.get_property('adapter-family')
            try:
                self._port_uri_segment = self.port_uri_segment_by_family[
                    family]
            except KeyError:
                self._port_uri_segment = ''
        return self._port_uri_segment
346344
def get(self, uri):
        
        uri = self.URI + uri
        return self._client.get(uri)
479732
static boolean usesStandardPort(URI uri) {
        int portNumber = uri.getPort();
        if (portNumber == -1) {
            return true;
        }
        String schema = uri.getScheme();
        int standardPort = schema.equals("https") ? 443 : 80;
        return portNumber == standardPort;
    }
1367242
def get_unassigned_ports(self):
        
        uri = "{}/unassignedPortsForPortMonitor".format(self.data["uri"])
        response = self._helper.do_get(uri)

        return self._helper.get_members(response)
290436
def addr(self):
        """"""
        port = self.port
        if port:
            port = int(port)
        else:
            port = default_ports.get(self.scheme or 'http')
        return (self.host, port)
1066920
def Uri(self):
		
		return ("%s://%s%s" % (("https", "http")[self._noSsl == True], self._name, (":" + str(self._port), "")[
			(((self._noSsl == False) and (self._port == 80)) or ((self._noSsl == True) and (self._port == 443)))]))
731963
def uri(self):
        """"""
        if self.__modified:
            self.__uri = self.__parse_uri()

        return self.__uri
1230577
def get_host_port(spec, default_port):
    ""
    args = (spec.split(':', 1) + [default_port])[:2]
    args[1] = int(args[1])
    return args[0], args[1]
565732
def _current_web_port(self):
        
        info = inspect_container(self._get_container_name('web'))
        if info is None:
            return None
        try:
            if not info['State']['Running']:
                return None
            return info['NetworkSettings']['Ports']['5000/tcp'][0]['HostPort']
        except TypeError:
            return None