List all available backends.
171351
def list_backends(_):
    """"""
    backends = [b.__name__ for b in available_backends()]
    print('\n'.join(backends))
983004
def list_queues(backend='sqlite'):
    '''
    
    '''
    queue_funcs = salt.loader.queues(__opts__)
    cmd = '{0}.list_queues'.format(backend)
    if cmd not in queue_funcs:
        raise SaltInvocationError('Function "{0}" is not available'.format(cmd))
    ret = queue_funcs[cmd]()
    return ret
1310648
def backend_run(self):
        """"""
        key = self.model.hash
        if self.use_memory_cache and self.get_memory_cache(key):
            return self._results
        if self.use_disk_cache and self.get_disk_cache(key):
            return self._results
        results = self._backend_run()
        if self.use_memory_cache:
            self.set_memory_cache(results, key)
        if self.use_disk_cache:
            self.set_disk_cache(results, key)
        return results
1268760
def list_(ctx, search, backend):
    
    projects = ctx.obj['projects_db'].search(search, backend=backend)
    projects = sorted(projects, key=lambda project: project.name.lower())
    ctx.obj['view'].search_results(projects)
580464
def get_backend(name):
    """"""

    for backend in _BACKENDS:
        if backend.NAME == name:
            return backend
    raise KeyError("Backend %r not available" % name)
42733
def get_available_backends():
    
    backends = get_config().get('BACKENDS', {})

    if backends:
        return backends

    # Try to get backend settings from old style
    # POST_OFFICE = {
    #     'EMAIL_BACKEND': 'mybackend'
    # }
    backend = get_config().get('EMAIL_BACKEND')
    if backend:
        warnings.warn('Please use the new POST_OFFICE["BACKENDS"] settings',
                      DeprecationWarning)

        backends['default'] = backend
        return backends

    # Fall back to Django's EMAIL_BACKEND definition
    backends['default'] = getattr(
        settings, 'EMAIL_BACKEND',
        'django.core.mail.backends.smtp.EmailBackend')

    # If EMAIL_BACKEND is set to use PostOfficeBackend
    # and POST_OFFICE_BACKEND is not set, fall back to SMTP
    if 'post_office.EmailBackend' in backends['default']:
        backends['default'] = 'django.core.mail.backends.smtp.EmailBackend'

    return backends
600626
def list_available_tools(self):
        
        benchmarks = []

        if self.alternative_config_dir:
            for n in glob.glob(os.path.join(self.alternative_config_dir, self.BENCHMARKS_DIR, '*.conf')):
                benchmarks.append(BenchmarkToolConfiguration(n))

        for n in glob.glob(os.path.join(self.default_config_dir, self.BENCHMARKS_DIR, '*.conf')):
            benchmarks.append(BenchmarkToolConfiguration(n))

        return benchmarks
959969
def register_backends(vars):
    
    new_backends = {x.replace('Backend', ''): cls
                    for x, cls in vars.items()
                    if inspect.isclass(cls) and issubclass(cls, Backend)}
    available_backends.update(new_backends)
635890
def _merge_groups(self, backends_list):
        
        ret = {}
        for backends in backends_list:
            for b in backends:
                if b not in ret:
                    ret[b] = set([])
                for group in backends[b]:
                    ret[b].add(group)
        for b in ret:
            ret[b] = list(ret[b])
            ret[b].sort()
        return ret
1065307
def available_backends():
    """"""
    print 'The following LiveSync agents are available:'
    for name, backend in current_plugin.backend_classes.iteritems():
        print cformat('  - %{white!}{}%{reset}: {} ({})').format(name, backend.title, backend.description)
807991
def _get_backend(args):
    """"""
    if args.backend == 'gatttool':
        backend = GatttoolBackend
    elif args.backend == 'bluepy':
        backend = BluepyBackend
    elif args.backend == 'pygatt':
        backend = PygattBackend
    else:
        raise Exception('unknown backend: {}'.format(args.backend))
    return backend
94057
def get_backend(backend):
    """"""
    if backend == "random":
        backends = list_backends()
        random.shuffle(backends)
        return backends[0]

    return backend
620361
def set_backend(self, backend):
        """"""
        if isinstance(backend, str):
            name = backend
            args = []
            kwargs = {}
        elif isinstance(backend, (tuple, list)):
            name = ''
            args = []
            kwargs = {}
            for i in range(len(backend)):
                if i == 0:
                    name = backend[i]
                else:
                    if isinstance(backend[i], dict):
                        kwargs.update(backend[i])
                    else:
                        args += backend[i]
        else:
            raise TypeError("Backend must be string, tuple, or list")
        if name in available_backends:
            self.backend = name
            self._backend = available_backends[name]()
        elif name is None:
            # The base class should not be called.
            raise Exception(("A backend (e.g. 'jNeuroML' or 'NEURON') "
                             "must be selected"))
        else:
            raise Exception("Backend %s not found in backends.py"
                            % name)
        self._backend.model = self
        self._backend.init_backend(*args, **kwargs)
795910
def _init_backends(self):
        

        # fetch auth backends from config file
        self._backends = {}
        for section in self._config.sections():

            # does the section define an auth backend?
            section_components = section.rsplit('.', 1)
            if section_components[0] == 'auth.backends':
                auth_backend = section_components[1]
                self._backends[auth_backend] = eval(self._config.get(section, 'type'))

        self._logger.debug("Registered auth backends %s" % str(self._backends))
1217775
def list_services(self, limit=None, marker=None):
        """"""
        return self._services_manager.list(limit=limit, marker=marker)
458017
def get_backends_by_class(self, backend_class):
        
        return [backend for backend in self._backends_registry.values() if isinstance(backend, backend_class)]
936910
def list(self):
        """"""
        connection = self._backend._get_connection()
        return list(self._backend.list(connection))