COMPARE ORIGINAL AND FORMATTED URL
326511
def check_web_status(hsh)
      status = 'invalid' if hsh[:web_neg]&.include?('error')

      if hsh[:url] && hsh[:url_f] && status.nil?
        status = hsh[:url] != hsh[:url_f] ? 'formatted' : 'unchanged'
      end

      hsh[:web_status] = status if status.present?
      hsh
    end
682849
function isUrl (url) {
  if (!url) return false
  url = url.toString()
  return url.indexOf('http://') === 0 || url.indexOf('https://') === 0
}
1101526
def valid_url(x: str) -> bool:
    
    if isinstance(x, str) and re.match(URL_PATTERN, x):
        return True
    else:
        return False
1085347
def _normalize_check_url(self, check_url):
        

        # TODO: Write tests for this method
        split_url = urlsplit(check_url)
        host = splitport(split_url.path or split_url.netloc)[0]
        return '{0}://{1}:{2}'.format(self.scheme, host, self.port)
885442
function isWhitelisted(url) {
		return options.adiPathFilter.some(function (route) {
			return url.substr(0, route.length) === route;
		});
	}
814588
function( url, rez, params ) {
			params = params || '';

			if ( $.type( params ) === "object" ) {
				params = $.param(params, true);
			}

			$.each(rez, function(key, value) {
				url = url.replace( '$' + key, value || '' );
			});

			if (params.length) {
				url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params;
			}

			return url;
		}
121411
def compare_urls(self, url1, url2):
        # type: (str, str) -> bool
        
        return (self.normalize_url(url1) == self.normalize_url(url2))
418504
def url_match?(request_url)
      case base_url
      when String
        base_url == request_url
      when Regexp
        base_url === request_url
      when nil
        true
      else
        false
      end
    end
879324
function isUrl(string){
    if (typeof string !== 'string') {
      return false;
    }

    var match = string.match(protocolAndDomainRE);
    if (!match) {
      return false;
    }

    var everythingAfterProtocol = match[1];
    if (!everythingAfterProtocol) {
      return false;
    }

    return localhostDomainRE.test(everythingAfterProtocol) ||
        nonLocalhostDomainRE.test(everythingAfterProtocol);
  }
218749
function(originalBaseURL) {
      if (!originalBaseURL) {
        return '/base/';
      } else if (originalBaseURL.indexOf('./') === 0) {
        return originalBaseURL.replace('./', '/base/');
      } else if (originalBaseURL.indexOf('/') !== 0) {
        return '/base/' + originalBaseURL;
      } else {
        return '/base' + originalBaseURL;
      }
    }
349007
def valid_url(url):
    
    regex = re.compile(
        r'^(?:http)s?://'
        r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+'
        r'(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?))'
        r'(?:/?|[/?]\S+)$', re.IGNORECASE)
    if not regex.match(url):
        raise argparse.ArgumentTypeError('"{0}" is invalid url.'.format(url))
    return url
597585
def __valid_url(cls, url):
        """"""
        bits = urlparse(url)
        return ((bits.scheme == "http" or bits.scheme == "https") and
                _PATTERN_URL_PART.match(bits.netloc) and
                _PATTERN_URL_PART.match(bits.path))
678028
function(url) {
            url = (url || '').replace(/\#.*?$/, '');
            url = url.replace('?pjax=true&', '?').replace('?pjax=true', '').replace('&pjax=true', '');
            return url;
        }
269174
def check_url_data (self, url_data):
        """"""
        if url_data.url is None:
            url = ""
        else:
            url = url_data.url.encode("ascii", "replace")
        self.setName("CheckThread-%s" % url)
        check_url(url_data, self.logger)
685650
def validate_url(self, original_string):
        

        # nipped from stack overflow: http://stackoverflow.com/questions/827557/how-do-you-validate-a-url-with-a-regular-expression-in-python
        # I preferred this to the thorough regex approach for simplicity and
        # readability
        pieces = urlparse.urlparse(original_string)
        try:
            if self.path_only:
                assert not any([pieces.scheme, pieces.netloc])
                assert pieces.path
            else:
                assert all([pieces.scheme, pieces.netloc])
                valid_chars = set(string.letters + string.digits + ":-_.")
                assert set(pieces.netloc) <= valid_chars
                assert pieces.scheme in ['http', 'https']

        except AssertionError as e:
            raise ArgumentError(self.item_name,
                    "The input you've provided is not a valid URL.")
        return pieces
199455
def find_url_mismatches(a_url, b_url):
    
    diff_list = []
    a_parts = urllib.parse.urlparse(a_url)
    b_parts = urllib.parse.urlparse(b_url)
    # scheme
    if a_parts.scheme.lower() != b_parts.scheme.lower():
        diff_list.append(
            'Schemes differ. a="{}" b="{}" differ'.format(
                a_parts.scheme.lower(), b_parts.scheme.lower()
            )
        )
    # netloc
    if a_parts.netloc.lower() != b_parts.netloc.lower():
        diff_list.append(
            'Network locations differ. a="{}" b="{}"'.format(
                a_parts.netloc.lower(), b_parts.netloc.lower
            )
        )
    # path
    if a_parts.path != b_parts.path:
        diff_list.append(
            'Paths differ: a="{}" b="{}"'.format(a_parts.path, b_parts.path)
        )
    # fragment
    if a_parts.fragment != b_parts.fragment:
        diff_list.append(
            'Fragments differ. a="{}" b="{}"'.format(a_parts.fragment, b_parts.fragment)
        )
    # param
    a_param_list = sorted(a_parts.params.split(";"))
    b_param_list = sorted(b_parts.params.split(";"))
    if a_param_list != b_param_list:
        diff_list.append(
            'Parameters differ. a="{}" b="{}"'.format(
                ', '.join(a_param_list), ', '.join(b_param_list)
            )
        )
    # query
    a_query_dict = urllib.parse.parse_qs(a_parts.query)
    b_query_dict = urllib.parse.parse_qs(b_parts.query)
    if len(list(a_query_dict.keys())) != len(list(b_query_dict.keys())):
        diff_list.append(
            'Number of query keys differs. a={} b={}'.format(
                len(list(a_query_dict.keys())), len(list(b_query_dict.keys()))
            )
        )
    for a_key in b_query_dict:
        if a_key not in list(b_query_dict.keys()):
            diff_list.append(
                'Query key in first missing in second. a_key="{}"'.format(a_key)
            )
        elif sorted(a_query_dict[a_key]) != sorted(b_query_dict[a_key]):
            diff_list.append(
                'Query values differ. key="{}" a_value="{}" b_value="{}"'.format(
                    a_key, sorted(a_query_dict[a_key]), sorted(b_query_dict[a_key])
                )
            )
    for b_key in b_query_dict:
        if b_key not in a_query_dict:
            diff_list.append(
                'Query key in second missing in first. b_key="{}"'.format(b_key)
            )
    return diff_list
320404
private boolean checkUrl(String url) {
        try {
            URI uri = new URI(url);
            return uri.isAbsolute();
        } catch (URISyntaxException e) {
            return false;
        }
    }