def url_to_parts(url):
 scheme = urlparse(url).scheme
 schemeless = url[(len(scheme) + 3):]
 parts = urlparse((u'http://' + schemeless))
 path = (parts.path or u'')
 path = (path[1:] if (path and (path[0] == u'/')) else path)
 return urlparts(scheme, (unquote((parts.hostname or u'')) or None), parts.port, (unquote((parts.username or u'')) or None), (unquote((parts.password or u'')) or None), (unquote((path or u'')) or None), dict(parse_qsl(parts.query)))

def url_to_parts ( url ) : scheme = urlparse ( url ) . scheme schemeless = url [ ( len ( scheme ) + 3 ) : ] parts = urlparse ( ( u'http://' + schemeless ) ) path = ( parts . path or u'' ) path = ( path [ 1 : ] if ( path and ( path [ 0 ] == u'/' ) ) else path ) return urlparts ( scheme , ( unquote ( ( parts . hostname or u'' ) ) or None ) , parts . port , ( unquote ( ( parts . username or u'' ) ) or None ) , ( unquote ( ( parts . password or u'' ) ) or None ) , ( unquote ( ( path or u'' ) ) or None ) , dict ( parse_qsl ( parts . query ) ) )
parse url into :class:urlparts tuple of components .