Provide URLconf details for the ``Api``.

        And all registered ``Resources`` beneath it.

            :return list: URL's patterns
545311
def urls(self):
        
        urls = []

        for url_name in sorted(self.resources.keys()):

            resource = self.resources[url_name]
            urls.append(resource.as_url(
                api=self,
                name_prefix='-'.join(
                    (self.prefix, self.str_version)).strip('-'),
                url_prefix=self.str_version
            ))

        return patterns(self.prefix, *urls)
1042180
def get_url(self, resource, params=None):
        

        # replace placeholders

        pattern = r'\{(.+?)\}'

        resource = re.sub(pattern, lambda t: str(params.get(t.group(1), '')), resource)

        # build url

        parts = (self.endpoint, '/api/', resource)
        return '/'.join(map(lambda x: str(x).strip('/'), parts))
1112840
def to_api_repr(self):
        
        info = {}
        if self.log_name is not None:
            info["logName"] = self.log_name
        if self.resource is not None:
            info["resource"] = self.resource._to_dict()
        if self.labels is not None:
            info["labels"] = self.labels
        if self.insert_id is not None:
            info["insertId"] = self.insert_id
        if self.severity is not None:
            info["severity"] = self.severity
        if self.http_request is not None:
            info["httpRequest"] = self.http_request
        if self.timestamp is not None:
            info["timestamp"] = _datetime_to_rfc3339(self.timestamp)
        if self.trace is not None:
            info["trace"] = self.trace
        if self.span_id is not None:
            info["spanId"] = self.span_id
        if self.trace_sampled is not None:
            info["traceSampled"] = self.trace_sampled
        if self.source_location is not None:
            source_location = self.source_location.copy()
            source_location["line"] = str(source_location.pop("line", 0))
            info["sourceLocation"] = source_location
        if self.operation is not None:
            info["operation"] = self.operation
        return info
181928
def links(self):
        
        link_dict = {'self': self.resource_uri()}
        for relationship in inspect(  # pylint: disable=maybe-no-member
                self.__class__).relationships:
            if 'collection' not in relationship.key:
                instance = getattr(self, relationship.key)
                if instance:
                    link_dict[str(relationship.key)] = instance.resource_uri()
        return link_dict
1277066
def _routes(self, app):
        
        _routes = []
        prefix = self.url_prefix if self.url_prefix is not None else ""
        for rule in app.url_map.iter_rules():
            if str(rule).startswith(prefix):
                _routes.append({
                    'path':rule.rule,
                    'name':rule.endpoint,
                    'methods':list(rule.methods)
                })
        returns = {
            'api': self.name,
            'url_root': request.url_root,
            'routes': _routes
        }
        return jsonify(returns)
293358
def get_url_array(self):
        
        urlarray = []
        for urlobjects in self.__json_object["base_urls"]:
            urlarray.append(urlobjects["url"])
        return urlarray
351003
def get_local_urls(port):
    ''''''
    url_list = []
    for name, info in psutil.net_if_addrs().items():
        for addr in info:
            if AddressFamily.AF_INET == addr.family:
                url_list.append('http://{}:{}'.format(addr.address, port))
    return url_list
1280466
def get_urls(self):
        
        urls = super(PageAdmin, self).get_urls()
        my_urls = patterns('',
            (r'^add/preview$', self.admin_site.admin_view(PagePreviewView.as_view())),
            (r'^(?P<id>\d+)/preview$', self.admin_site.admin_view(PagePreviewView.as_view())),
            (r'^(?P<id>\d+)/history/(\d+)/preview$', self.admin_site.admin_view(PagePreviewView.as_view())),
        )
        return my_urls + urls
481865
def urlpatterns(self):
        '''
        '''
        if not hasattr(self, '_urlspatterns'):
            urlpatterns = []
            # load all urls
            # support .urls file and urls_conf = 'elephantblog.urls' on default module
            # decorate all url patterns if is not explicitly excluded
            for mod in leonardo.modules:
                # TODO this not work
                if is_leonardo_module(mod):

                    conf = get_conf_from_module(mod)

                    if module_has_submodule(mod, 'urls'):
                        urls_mod = import_module('.urls', mod.__name__)
                        if hasattr(urls_mod, 'urlpatterns'):
                            # if not public decorate all

                            if conf['public']:
                                urlpatterns += urls_mod.urlpatterns
                            else:
                                _decorate_urlconf(urls_mod.urlpatterns,
                                                  require_auth)
                                urlpatterns += urls_mod.urlpatterns
            # avoid circural dependency
            # TODO use our loaded modules instead this property
            from django.conf import settings
            for urls_conf, conf in six.iteritems(getattr(settings, 'MODULE_URLS', {})):
                # is public ?
                try:
                    if conf['is_public']:
                        urlpatterns += \
                            patterns('',
                                     url(r'', include(urls_conf)),
                                     )
                    else:
                        _decorate_urlconf(
                            url(r'', include(urls_conf)),
                            require_auth)
                        urlpatterns += patterns('',
                                                url(r'', include(urls_conf)))
                except Exception as e:
                    raise Exception('raised %s during loading %s' %
                                    (str(e), urls_conf))

            self._urlpatterns = urlpatterns

        return self._urlpatterns
952316
def urlmap(patterns):
    """"""
    for pattern in patterns:
        group = getattr(pattern, 'namespace', None)
        if group is None:
            group = getattr(pattern, 'app_name', None)
        path = '/' + get_pattern(pattern).lstrip('^').rstrip('$')
        if isinstance(pattern, PATTERNS):
            yield (group, pattern.name), path
        elif isinstance(pattern, RESOLVERS):
            subpatterns = pattern.url_patterns
            for (_, name), subpath in urlmap(subpatterns):
                yield (group, name), path.rstrip('/') + subpath
467865
def get_urls(self):
        
        info = '%s_%s' % (self.model._meta.app_label, self.model._meta.model_name)

        def pat(regex, fn):
            return url(regex, self.admin_site.admin_view(fn), name='%s_%s' % (info, fn.__name__))

        url_patterns = [
            pat(r'^([0-9]+)/delete-translation/$', self.delete_translation),
            pat(r'^([0-9]+)/([a-z\-]+)/publish/$', self.publish_article),
            pat(r'^([0-9]+)/([a-z\-]+)/unpublish/$', self.unpublish),
            pat(r'^([0-9]+)/([a-z\-]+)/preview/$', self.preview_article),
        ]

        url_patterns += super(ArticleAdmin, self).get_urls()
        return url_patterns
1164798
def get_urlpatterns(self):
        
        return [
            path(_('topics/'), self.latest_topics_feed(), name='latest_topics'),
            path(
                _('forum/<str:forum_slug>-<int:forum_pk>/topics/'),
                self.latest_topics_feed(),
                name='forum_latest_topics',
            ),
            path(
                _('forum/<str:forum_slug>-<int:forum_pk>/topics/all/'),
                self.latest_topics_feed(),
                {'descendants': True},
                name='forum_latest_topics_with_descendants',
            ),
        ]
786437
def get_api_url(server):
    
    parsed = urlparse(server)
    base_url = parsed.netloc if parsed.netloc else parsed.path
    base_url.replace('/', '')
    return 'https://' + base_url + '/apiv1'
179623
def parse_resource_from_url(self, url):
        
        # special case for the api root
        if url == '/api':
            return 'api'
        elif url == '/katello':
            return 'katello'

        match = self.resource_pattern.match(url)
        if match:
            return match.groupdict().get('resource', None)
205378
def fill_urls(self):
        

        protocol = self.dcnm_protocol
        self._org_url = '%s://%s/rest/auto-config/organizations' % (
            (protocol, self._ip))
        self._create_network_url = ('%s://%s/' % (protocol, self._ip) +
                                    'rest/auto-config/organizations'
                                    '/%s/partitions/%s/networks')
        self.host_protocol_url = '%s://%s/' % (protocol, self._ip)
        self._create_network_url = self._build_url(
            'rest/auto-config/organizations'
            '/%s/partitions/%s/networks')
        self._cfg_profile_list_url = '%s://%s/rest/auto-config/profiles' % (
            (protocol, self._ip))
        self._cfg_profile_get_url = self._cfg_profile_list_url + '/%s'
        self._global_settings_url = self._build_url(
            'rest/auto-config/settings')
        self._create_part_url = self._build_url(
            'rest/auto-config/organizations/%s/partitions')
        self._update_part_url = self._build_url(
            'rest/auto-config/organizations/%s/partitions/%s')
        self._del_org_url = self._build_url(
            'rest/auto-config/organizations/%s')
        self._del_part = self._build_url(
            'rest/auto-config/organizations/%s/partitions/%s')
        self._network_url = self._build_url(
            'rest/auto-config/organizations/%s/partitions/'
            '%s/networks/segment/%s')
        self._network_mob_url = self._build_url(
            'rest/auto-config/organizations/%s/partitions/'
            '%s/networks/vlan/%s/mobility-domain/%s')
        self._segmentid_ranges_url = self._build_url(
            'rest/settings/segmentid-ranges')
        self._login_url = self._build_url('rest/logon')
        self._logout_url = self._build_url('rest/logout')
877367
def info(self, url, limit=None):
        
        return self._limit_get('api', 'info', params=dict(url=url), limit=limit)
1045877
def get_resource_links(self, item):
        """"""
        if self.opts.self_url:
            ret = self.dict_class()
            kwargs = resolve_params(item, self.opts.self_url_kwargs or {})
            ret['self'] = self.generate_url(self.opts.self_url, **kwargs)
            return ret
        return None