<s> """<STR_LIT>""" <EOL> from __future__ import unicode_literals , absolute_import <EOL> from pylinkchecker . compat import urlparse <EOL> SCHEME_HTTP = "<STR_LIT:http>" <EOL> SCHEME_HTTPS = "<STR_LIT>" <EOL> SUPPORTED_SCHEMES = ( SCHEME_HTTP , SCHEME_HTTPS ) <EOL> NOT_LINK = [ <EOL> '<STR_LIT:data>' , <EOL> '<STR_LIT:#>' , <EOL> ] <EOL> def is_link ( url ) : <EOL> """<STR_LIT>""" <EOL> for prefix in NOT_LINK : <EOL> if url . startswith ( prefix ) : <EOL> return False <EOL> return True <EOL> def get_clean_url_split ( url ) : <EOL> """<STR_LIT>""" <EOL> if not url : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> split_result = urlparse . urlsplit ( url ) <EOL> if not split_result . scheme : <EOL> if split_result . netloc : <EOL> url = SCHEME_HTTP + "<STR_LIT::>" + url <EOL> else : <EOL> url = SCHEME_HTTP + "<STR_LIT>" + url <EOL> split_result = urlparse . urlsplit ( url ) <EOL> return split_result <EOL> def get_absolute_url_split ( url , base_url_split ) : <EOL> """<STR_LIT>""" <EOL> new_url = urlparse . urljoin ( base_url_split . geturl ( ) , url ) <EOL> return get_clean_url_split ( new_url ) </s>
