(cls, url, encoding)
return cls(
            parsed.scheme, parsed.hostname,
            port, parsed.path, parsed.params,
            parsed.query,  parsed.fragment
        )
Parse the provided url, and return a URL instance
Parse the provided url, and return a URL instance
Parse the provided url and return a URL instance
def parse(cls, url, encoding):
        '''Parse the provided url, and return a URL instance'''

        if isinstance(url, text_type):
            parsed = urlparse(url.encode('utf-8'))
        else:
            parsed = urlparse(url.decode(encoding).encode('utf-8'))

        if isinstance(parsed.port, int):
            port = (
                str(parsed.port).encode("utf-8")
                if parsed.port not in (80, 443)
                else None
            )
        else:
            port = None

        return cls(
            parsed.scheme, parsed.hostname,
            port, parsed.path, parsed.params,
            parsed.query,  parsed.fragment
        )
def parse ( cls , url , encoding ) : if isinstance ( url , text_type ) : parsed = urlparse ( url . encode ( 'utf-8' ) ) else : parsed = urlparse ( url . decode ( encoding ) . encode ( 'utf-8' ) ) if isinstance ( parsed . port , int ) : port = ( str ( parsed . port ) . encode ( "utf-8" ) if parsed . port not in ( 80 , 443 ) else None ) else : port = None return cls ( parsed . scheme , parsed . hostname , port , parsed . path , parsed . params , parsed . query , parsed . fragment )