Check if URL is part of the current project's URLs.

    Args:
        url (str): URL to check.
        default (callable): used to filter out some URLs attached to function.

    Returns:
487749
def url_is_project(url, default='not_a_func'):
    
    try:
        u = resolve(url)
        if u and u.func != default:
            return True
    except Resolver404:
        static_url = settings.STATIC_URL
        static_url_wd = static_url.lstrip('/')
        if url.startswith(static_url):
            url = url[len(static_url):]
        elif url.startswith(static_url_wd):
            url = url[len(static_url_wd):]
        else:
            return False
        if finders.find(url):
            return True
    return False
334120
def url(self, part):
        
        return self._server.url(part, includeToken=True) if part else None
754933
def _parse_url_and_validate(cls, url):
        
        parsed_url = urlparse(url)
        if parsed_url.scheme and parsed_url.netloc:
            final_url = parsed_url.geturl()
        else:
            raise BadURLException
        return final_url
314710
def get_url(url, catch_exception=False):
    
    return _get_url(url, catch_exception, urlopen=urllib2.urlopen)
58718
def setUrl(self, url):
        
        if isUrl(url):
            self._url = url
        else:
            raise exceptions.BadUrlException(url)
        return self
678240
def url(self, var, default=NOTSET):
        
        return self.get_value(var, cast=urlparse, default=default, parse_default=True)
180863
def _get_url(self, url):
        
        url = str(url)
        if url != 'default' and not '://' in url:
            url = "file:" + urllib.pathname2url(url)
        return url
558589
def is_external_url(self, url, site_url):
        
        url_splitted = urlsplit(url)
        if not url_splitted.netloc:
            return False
        return url_splitted.netloc != urlsplit(site_url).netloc
984144
public static boolean isFileURL(URL url) {
        String protocol = url.getProtocol();
        return (URL_PROTOCOL_FILE.equals(protocol) || protocol.startsWith(URL_PROTOCOL_VFS));
    }
649893
def check_url(url):
        '''
        

        '''
        request = urllib2.Request(url)
        try:
            response = urlopen(request)
            return True, response.code
        except urllib2.HTTPError as e:
            return False, e.code
339779
def match_url(self, request):
        
        matched = False
        if self.exact_url:
            if re.match("%s$" % (self.url,), request.path):
                matched = True
        elif re.match("%s" % self.url, request.path):
            matched = True
        return matched
144832
def _is_url(url):
    
    regex = re.compile(
        r'^(?:http|ftp)s?://'  # http:// or https://
        r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'  # domain...
        r'localhost|'  # localhost...
        r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'  # ...or ip
        r'(?::\d+)?'  # optional port
        r'(?:/?|[/?]\S+)$', re.IGNORECASE)
    if regex.match(url) is not None:
        return True
    else:
        return False
516386
def url_ignore(self, project):
        
        project_list = False
        try:
            url_ignore = il['url_ignore']
        except KeyError:
            logger.error('Key Error processing url_ignore list values')

        try:
            project_exceptions = il.get('project_exceptions')
            for item in project_exceptions:
                if project in item:
                    exception_file = item.get(project)
                    with open(exception_file, 'r') as f:
                        url_list = yaml.safe_load(f)
                        project_list = url_list['url_ignore']
        except KeyError:
            logger.info('No url_ignore for %s', project)

        if project_list:
            url_ignore = url_ignore + project_list
            url_ignore_re = re.compile("|".join(url_ignore), flags=re.IGNORECASE)
            return url_ignore_re
        else:
            url_ignore_re = re.compile("|".join(url_ignore), flags=re.IGNORECASE)
            return url_ignore_re
1278124
def check_active(url, element, **kwargs):
    ''''''
    menu = yesno_to_bool(kwargs['menu'], 'menu')
    ignore_params = yesno_to_bool(kwargs['ignore_params'], 'ignore_params')

    # check missing href parameter
    if not url.attrib.get('href', None) is None:
        # get href attribute
        href = url.attrib['href'].strip()

        # href="#" is often used when links shouldn't be handled by browsers.
        # For example, Bootstrap uses this for expandable menus on
        # small screens, see
        # https://getbootstrap.com/docs/4.0/components/navs/#using-dropdowns
        if href == '#':
            return False

        # split into urlparse object
        href = urlparse.urlsplit(href)

        # cut off hashtag (anchor)
        href = href._replace(fragment='')

        # cut off get params (?key=var&etc=var2)
        if ignore_params:
            href = href._replace(query='')
            kwargs['full_path'] = urlparse.urlunsplit(
                urlparse.urlsplit(
                    kwargs['full_path']
                )._replace(query='')
            )

        # build urlparse object back into string
        href = urlparse.urlunsplit(href)

        # check empty href
        if href == '':
            # replace href with current location
            href = kwargs['full_path']
        # compare full_path with href according to menu configuration

        if menu:
            # try mark "root" (/) url as "active", in equals way
            if href == '/' == kwargs['full_path']:
                logic = True
            # skip "root" (/) url, otherwise it will be always "active"
            elif href != '/':
                # start with logic
                logic = (
                    kwargs['full_path'].startswith(href)
                    or
                    # maybe an urlquoted href was supplied
                    urlquote(kwargs['full_path']).startswith(href)
                    or
                    kwargs['full_path'].startswith(urlquote(href))
                )
            else:
                logic = False
        else:
            # equals logic
            logic = (
                kwargs['full_path'] == href
                or
                # maybe an urlquoted href was supplied
                urlquote(kwargs['full_path']) == href
                or
                kwargs['full_path'] == urlquote(href)
            )
        # "active" url found
        if logic:
            # check parent tag has "class" attribute or it is empty
            if element.attrib.get('class'):
                # prevent multiple "class" attribute adding
                if kwargs['css_class'] not in element.attrib['class']:
                    # append "active" class
                    element.attrib['class'] += ' {css_class}'.format(
                        css_class=kwargs['css_class'],
                    )
            else:
                # create or set (if empty) "class" attribute
                element.attrib['class'] = kwargs['css_class']
            return True
    # no "active" urls found
    return False
54982
def _IsValidUrl(self, url):
    
    parsed_url = urlparse.urlparse(url)
    return parsed_url.scheme in self._SUPPORTED_URL_SCHEMES
951929
def url(self, value):
        
        if value == self._defaults['url'] and 'url' in self._values:
            del self._values['url']
        else:
            self._values['url'] = value
1266686
function checkUrl(){
    var newPath = location.hash.substr(1) || '';

    if (newPath != currentPath)
    {
      // check for recursion
      if (preventRecursion(newPath))
        return;

      // save current path
      currentPath = newPath;

      var routesToLeave = [];
      var routesToEnter = [];
      var routesToMatch = [];

      allRoutes.forEach(function(route){
        var flags = route.processLocation_(newPath);

        if (flags & ROUTE_LEAVE)
          routesToLeave.push(route);
        if (flags & ROUTE_ENTER)
          routesToEnter.push(route);
        if (flags & ROUTE_MATCH)
          routesToMatch.push(route);
      });

      for (var i = 0; i < routesToLeave.length; i++)
        routeLeave(routesToLeave[i]);

      for (var i = 0; i < routesToEnter.length; i++)
        routeEnter(routesToEnter[i]);

      for (var i = 0; i < routesToMatch.length; i++)
        routeMatch(routesToMatch[i]);

      /** @cut */ flushLog(namespace + ': hash changed to "' + newPath + '"');
    }
    else
    {
      allRoutes.forEach(function(route){
        if (route.value)
        {
          routeEnter(route, true);
          routeMatch(route, true);
        }
      });

      /** @cut */ flushLog(namespace + ': checkUrl()');
    }
  }