Retrieve a list of resources from Neutron server.
337216
def retrieve_list(self, parsed_args):
        """"""
        neutron_client = self.get_client()
        _extra_values = parse_args_to_dict(self.values_specs)
        _merge_args(self, parsed_args, _extra_values,
                    self.values_specs)
        search_opts = self.args2search_opts(parsed_args)
        search_opts.update(_extra_values)
        if self.pagination_support:
            page_size = parsed_args.page_size
            if page_size:
                search_opts.update({'limit': page_size})
        if self.sorting_support:
            keys = parsed_args.sort_key
            if keys:
                search_opts.update({'sort_key': keys})
            dirs = parsed_args.sort_dir
            len_diff = len(keys) - len(dirs)
            if len_diff > 0:
                dirs += ['asc'] * len_diff
            elif len_diff < 0:
                dirs = dirs[:len(keys)]
            if dirs:
                search_opts.update({'sort_dir': dirs})
        data = self.call_server(neutron_client, search_opts, parsed_args)
        collection = _get_resource_plural(self.resource, neutron_client)
        return data.get(collection, [])
1192287
def index():
    """"""
    kwdb = current_app.kwdb

    libraries = get_collections(kwdb, libtype="library")
    resource_files = get_collections(kwdb, libtype="resource")

    return flask.render_template("libraryNames.html",
                                 data={"libraries": libraries,
                                       "version": __version__,
                                       "resource_files": resource_files
                                   })
548716
def list_extensions(request):
    
    neutron_api = neutronclient(request)
    try:
        extensions_list = neutron_api.list_extensions()
    except exceptions.ServiceCatalogException:
        return {}
    if 'extensions' in extensions_list:
        return tuple(extensions_list['extensions'])
    else:
        return ()
995018
def resources(self):
        """"""
        return [self.pdf.getPage(i) for i in range(self.pdf.getNumPages())]
1061799
def _list(self, uri, obj_class=None, body=None, return_raw=False,
            other_keys=None):
        
        if body:
            resp, resp_body = self.api.method_post(uri, body=body)
        else:
            resp, resp_body = self.api.method_get(uri)
        if return_raw:
            return (resp, resp_body)
        if obj_class is None:
            obj_class = self.resource_class

        data = self._data_from_response(resp_body)
        ret = [obj_class(self, res, loaded=False) for res in data if res]
        if other_keys:
            keys = utils.coerce_to_list(other_keys)
            other = [self._data_from_response(resp_body, key) for key in keys]
            return (ret, other)
        else:
            return ret
655850
def _load_resources(self):
        """"""

        for t in self.doc.find('Root.Table'):
            for c in t.find('Table.Column'):
                if c.get_value('datatype') == 'geometry':
                    c['transform'] = '^empty_str'
                    c['datatype'] = 'text'

        return super()._load_resources()
338047
def _retrieve_resources(self, url, class_, full):
        ''''''
        objects_to_return = []
        response = self.session.get(url)
        if response.status_code == 200:
            result = response.json()
            resources = result['results']
            objects_to_return.extend([class_(session=self.session, **resource)
                                      for resource in resources])
            while full and result['next'] is not None:
                response = self.session.get(result['next'])
                if response.status_code == 200:
                    result = response.json()
                    resources = result['results']
                    objects_to_return.extend([class_(session=self.session,
                                                     **resource)
                                              for resource in resources])
                else:
                    raise RuntimeError("Failed downloading data with status {}"
                            ". The response was: '{}'"
                            .format(response.status_code, response.text))
            return objects_to_return
        else:
            raise RuntimeError("Failed downloading data with status {}"
                    ". The response was: '{}'"
                    .format(response.status_code, response.text))
615076
def sources(self):
        """"""
        res = self.client.service.Sources(self.userdata, 0)
        return [ustr(x[0]) for x in res[0]]
810538
def get_context(request, context=None):
    """"""
    if context is None:
        context = {}

    network_config = getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {})

    context['launch_instance_allowed'] = policy.check(
        (("compute", "os_compute_api:servers:create"),), request)
    context['instance_quota_exceeded'] = _quota_exceeded(request, 'instances')
    context['create_network_allowed'] = policy.check(
        (("network", "create_network"),), request)
    context['network_quota_exceeded'] = _quota_exceeded(request, 'network')
    context['create_router_allowed'] = (
        network_config.get('enable_router', True) and
        policy.check((("network", "create_router"),), request))
    context['router_quota_exceeded'] = _quota_exceeded(request, 'router')
    context['console_type'] = getattr(settings, 'CONSOLE_TYPE', 'AUTO')
    context['show_ng_launch'] = (
        base.is_service_enabled(request, 'compute') and
        getattr(settings, 'LAUNCH_INSTANCE_NG_ENABLED', True))
    context['show_legacy_launch'] = (
        base.is_service_enabled(request, 'compute') and
        getattr(settings, 'LAUNCH_INSTANCE_LEGACY_ENABLED', False))
    return context
788268
def resource_list(cls):
        
        items = cls.list({'items_per_page': 500})
        ret = [str(ip['id']) for ip in items]
        ret.extend([ip['ip'] for ip in items])
        return ret
626600
@Override
    public Collection<URL> getResources(String resName)
    {
        try
        {
            return new EnumerationList<URL>(delegate.getResources(resName));
        } catch (IOException e)
        {
            throw new ResourceLoadingException(Tr.formatMessage(tc,
                                                                "error.loading.resource.CWOWB1005E",
                                                                resName
                            ), e);

        }
    }
237784
def get_python_files(self):
        """"""
        return [resource for resource in self.get_files()
                if self.pycore.is_python_file(resource)]
220339
def get(cls, parent=None):
        
        data = cls._process_request(connection.get, parent=parent)
        return cls._load_resources(data)
834522
def get_resources(self):
        
        status, _, body = self._request('GET', '/',
                                        {'Accept': 'application/json'})
        if status == 200:
            tmp, resources = json.loads(bytes_to_str(body)), {}
            for k in tmp:
                # The keys and values returned by json.loads() are unicode,
                # which will cause problems when passed into httplib later
                # (expecting bytes both in Python 2.x and 3.x).
                # We just encode the resource paths into bytes, with an
                # encoding consistent with what the resources module expects.
                resources[k] = tmp[k].encode('utf-8')
            return resources
        else:
            return {}
1025275
async def get_data(self, resource):
        """"""
        url = '{}{}'.format(
            self.base_url, self.endpoint.format(resource=resource))

        try:
            with async_timeout.timeout(5, loop=self._loop):
                response = await self._session.get(url)

            _LOGGER.info(
                "Response from Netdata: %s", response.status)
            data = await response.json()
            _LOGGER.debug(data)
            self.values = {k: v for k, v in zip(
                data['labels'], data['data'][0])}

        except (asyncio.TimeoutError, aiohttp.ClientError, socket.gaierror):
            _LOGGER.error("Can not load data from Netdata")
            raise exceptions.NetdataConnectionError()
1370548
def get_resources_nodes(call=None, resFilter=None):
    '''
    
    '''
    log.debug('Getting resource: nodes.. (filter: %s)', resFilter)
    resources = query('get', 'cluster/resources')

    ret = {}
    for resource in resources:
        if 'type' in resource and resource['type'] == 'node':
            name = resource['node']
            ret[name] = resource

    if resFilter is not None:
        log.debug('Filter given: %s, returning requested '
                  'resource: nodes', resFilter)
        return ret[resFilter]

    log.debug('Filter not given: %s, returning all resource: nodes', ret)
    return ret
625450
def get_resources(self):
        
        if self.retrieved:
            raise errors.IllegalState('List has already been retrieved.')
        self.retrieved = True
        return objects.ResourceList(self._results, runtime=self._runtime)