Remove the port number from a URI

    :param uri: full URI that Twilio requested on your server

    :returns: full URI without a port number
    :rtype: str
431666
def remove_port(uri):
    
    new_netloc = uri.netloc.split(':')[0]
    new_uri = uri._replace(netloc=new_netloc)
    return new_uri.geturl()
457923
def get_port_map(self, id_or_uri):
        
        uri = self._client.build_uri(id_or_uri) + self.PORT_MAP_PATH
        return self._client.get(id_or_uri=uri)
783388
def remove_nio(self, port_number):
        

        if port_number not in self._nios:
            raise DynamipsError("Port {} is not allocated".format(port_number))

        # remove VCs mapped with the port
        for source, destination in self._active_mappings.copy().items():
            source_port, source_dlci = source
            destination_port, destination_dlci = destination
            if port_number == source_port:
                log.info('Frame Relay switch "{name}" [{id}]: unmapping VC between port {source_port} DLCI {source_dlci} and port {destination_port} DLCI {destination_dlci}'.format(name=self._name,
                                                                                                                                                                                     id=self._id,
                                                                                                                                                                                     source_port=source_port,
                                                                                                                                                                                     source_dlci=source_dlci,
                                                                                                                                                                                     destination_port=destination_port,
                                                                                                                                                                                     destination_dlci=destination_dlci))
                yield from self.unmap_vc(source_port, source_dlci, destination_port, destination_dlci)
                yield from self.unmap_vc(destination_port, destination_dlci, source_port, source_dlci)

        nio = self._nios[port_number]
        if isinstance(nio, NIOUDP):
            self.manager.port_manager.release_udp_port(nio.lport, self._project)

        log.info('Frame Relay switch "{name}" [{id}]: NIO {nio} removed from port {port}'.format(name=self._name,
                                                                                                 id=self._id,
                                                                                                 nio=nio,
                                                                                                 port=port_number))

        del self._nios[port_number]
        return nio
629907
protected function removeAdditionalUriData($uri)
    {
        if (strpos($uri, '?') !== false) {
            return substr($uri, 0, strpos($uri, '?'));
        } else if (strpos($uri, '#') !== false) {
            return substr($uri, 0, strpos($uri, '#'));
        }
        
        return $uri;
    }
346344
def get(self, uri):
        
        uri = self.URI + uri
        return self._client.get(uri)
76431
public static String findURITransport(URI uri, int messageContentLength) {
		String transport = ListeningPoint.UDP;
		if(uri instanceof SipURI) {
			SipURI sipURI = (SipURI) uri;
			if(sipURI.isSecure()) {
				transport = ListeningPoint.TLS;
			} else {
				String transportParam = sipURI.getTransportParam();

				if (transportParam != null
						&& transportParam.equalsIgnoreCase(ListeningPoint.TLS)) {
					transport = ListeningPoint.TLS;
				} // 
				else if (transportParam != null
						&& transportParam.equalsIgnoreCase(ListeningPointExt.WS)) {
					transport = ListeningPointExt.WS;
				} else if (transportParam != null
						&& transportParam.equalsIgnoreCase(ListeningPointExt.WSS)) {
					transport = ListeningPointExt.WSS;
				}
				// moved TCP at the bottom to avoid having TCP being chosen because of message Content Length being too big for WebRTC
				//Fix by Filip Olsson for Issue 112
				else if ((transportParam != null
						&& transportParam.equalsIgnoreCase(ListeningPoint.TCP)) || 
						messageContentLength > 4096) {
					transport = ListeningPoint.TCP;
				} 
				
			}
		}
		return transport;
	}
982993
def iri(uri_string):
        
        uri_string = str(uri_string)
        if uri_string[:1] == "?":
            return uri_string
        if uri_string[:1] == "[":
            return uri_string
        if uri_string[:1] != "<":
            uri_string = "<{}".format(uri_string.strip())
        if uri_string[len(uri_string)-1:] != ">":
            uri_string = "{}>".format(uri_string.strip())
        return uri_string
694191
def port=(new_port)
      if new_port != nil && new_port.respond_to?(:to_str)
        new_port = Addressable::URI.unencode_component(new_port.to_str)
      end

      if new_port.respond_to?(:valid_encoding?) && !new_port.valid_encoding?
        raise InvalidURIError, "Invalid encoding in port"
      end

      if new_port != nil && !(new_port.to_s =~ /^\d+$/)
        raise InvalidURIError,
          "Invalid port number: #{new_port.inspect}"
      end

      @port = new_port.to_s.to_i
      @port = nil if @port == 0

      # Reset dependent values
      remove_instance_variable(:@authority) if defined?(@authority)
      remove_instance_variable(:@normalized_port) if defined?(@normalized_port)
      remove_composite_values

      # Ensure we haven't created an invalid URI
      validate()
    end
166959
public static URI removeServer(URI uri) {
        try {
            return new URI(null, null, null, -1, uri.getPath(), uri.getQuery(), uri.getFragment());
        } catch (URISyntaxException e) {
            throw new InvalidUriException(e);
        }

    }
602586
@Deprecated
    public final B uri(String uri) {
        final URI parsed = URI.create(requireNonNull(uri, "uri"));
        final String host = parsed.getHost();
        final int port = parsed.getPort();
        checkArgument(host != null, "uri: %s (must contain a host part)", uri);
        if (port < 0) {
            host(host);
        } else {
            host(host, port);
        }
        return self();
    }
571058
def clean_url(url)
      uri = URI.parse(url)
      uri.query = CGI.parse(uri.query || '').reject { |k| k == 'api_key' }.to_query
      uri.to_s
    end
680291
def delete(expnum, ccd, version, ext, prefix=None):
    
    uri = get_uri(expnum, ccd=ccd, version=version, ext=ext, prefix=prefix)
    remove(uri)
612945
def url_to_host_port(url, port=None):
    
    if not url.startswith('http://') and not url.startswith('https://'):
        url = 'http://' + url

    if not port:
        port = RPC_SERVER_PORT

    urlinfo = urllib2.urlparse.urlparse(url)
    hostport = urlinfo.netloc

    parts = hostport.split('@')
    if len(parts) > 2:
        return None, None

    if len(parts) == 2:
        hostport = parts[1]

    parts = hostport.split(':')
    if len(parts) > 2:
        return None, None

    if len(parts) == 2:
        try:
            port = int(parts[1])
            assert 0 < port and port < 65535, 'Invalid port'
        except TypeError:
            return None, None

    return parts[0], port
311103
def request_uri(self):
        
        result = '/{0}'.format(self.path.lstrip('/'))
        if self.query is not None and self.query != '' and self.query != {}:
            result += '?{0}'.format(self.encoded_query())
        if self.fragment is not None and self.fragment != '':
            result += '#{0}'.format(self.fragment)
        return result
426996
public static String shortenUrl( URI uri )
    {
        return uri.getScheme() + "://" + uri.getHost() + uri.getPath();
    }
1025496
def parse_uri(self, uri=None):

		'''
		
		'''

		# no uri provided, assume root
		if not uri:
			return rdflib.term.URIRef(self.root)

		# string uri provided
		elif type(uri) == str:

			# assume "short" uri, expand with repo root
			if type(uri) == str and not uri.startswith('http'):
				return rdflib.term.URIRef("%s%s" % (self.root, uri))

			# else, assume full uri
			else:
				return rdflib.term.URIRef(uri)

		# already rdflib.term.URIRef
		elif type(uri) == rdflib.term.URIRef:
			return uri

		# unknown input
		else:
			raise TypeError('invalid URI input')
93770
def absolute_uri(self, location=None, scheme=None, **query):
        
        if not is_absolute_uri(location):
            if location or location is None:
                location = self.full_path(location, **query)
            if not scheme:
                scheme = self.is_secure and 'https' or 'http'
            base = '%s://%s' % (scheme, self.get_host())
            return '%s%s' % (base, location)
        elif not scheme:
            return iri_to_uri(location)
        else:
            raise ValueError('Absolute location with scheme not valid')