Check whether we have any Deep Water native backends available
337394
public static boolean haveBackend() {
    for (DeepWaterParameters.Backend b : DeepWaterParameters.Backend.values()) {
      if (DeepwaterMojoModel.createDeepWaterBackend(b.toString()) != null) return true;
    }
    return false;
  }
1254864
def _preflight_check(desired, fromrepo, **kwargs):
    '''
    
    '''
    if 'pkg.check_db' not in __salt__:
        return {}
    ret = {'suggest': {}, 'no_suggest': []}
    pkginfo = __salt__['pkg.check_db'](
        *list(desired.keys()), fromrepo=fromrepo, **kwargs
    )
    for pkgname in pkginfo:
        if pkginfo[pkgname]['found'] is False:
            if pkginfo[pkgname]['suggestions']:
                ret['suggest'][pkgname] = pkginfo[pkgname]['suggestions']
            else:
                ret['no_suggest'].append(pkgname)
    return ret
68583
def returner(ret):
    '''
    
    '''

    _options = _get_options(ret)
    log.debug('_options %s', _options)
    _options['hostname'] = ret.get('id')

    if 'url' not in _options or _options['url'] == '':
        log.error('nagios_nrdp.url not defined in salt config')
        return

    if 'token' not in _options or _options['token'] == '':
        log.error('nagios_nrdp.token not defined in salt config')
        return

    xml = _prepare_xml(options=_options, state=ret['return'])
    res = _post_data(options=_options, xml=xml)

    return res
817877
def backends(self, back=None):
        '''
        
        '''
        if not back:
            back = self.opts['fileserver_backend']
        else:
            if not isinstance(back, list):
                try:
                    back = back.split(',')
                except AttributeError:
                    back = six.text_type(back).split(',')

        if isinstance(back, Sequence):
            # The test suite uses an ImmutableList type (based on
            # collections.Sequence) for lists, which breaks this function in
            # the test suite. This normalizes the value from the opts into a
            # list if it is based on collections.Sequence.
            back = list(back)

        ret = []
        if not isinstance(back, list):
            return ret

        # Avoid error logging when performing lookups in the LazyDict by
        # instead doing the membership check on the result of a call to its
        # .keys() attribute rather than on the LazyDict itself.
        server_funcs = self.servers.keys()
        try:
            subtract_only = all((x.startswith('-') for x in back))
        except AttributeError:
            pass
        else:
            if subtract_only:
                # Only subtracting backends from enabled ones
                ret = self.opts['fileserver_backend']
                for sub in back:
                    if '{0}.envs'.format(sub[1:]) in server_funcs:
                        ret.remove(sub[1:])
                    elif '{0}.envs'.format(sub[1:-2]) in server_funcs:
                        ret.remove(sub[1:-2])
                return ret

        for sub in back:
            if '{0}.envs'.format(sub) in server_funcs:
                ret.append(sub)
            elif '{0}.envs'.format(sub[:-2]) in server_funcs:
                ret.append(sub[:-2])
        return ret
314021
def is_fcntl_available(check_sunos=False):
    '''
    
    '''
    if check_sunos and salt.utils.platform.is_sunos():
        return False
    return HAS_FCNTL
844952
def list_backends():
    
    return ['ni'] + [name for (loader, name, ispkg) in pkgutil.iter_modules()
                     if name.startswith('pyvisa-') and not name.endswith('-script')]
770059
def guess_backend(identifier):
    
    if identifier.startswith('usb://') or identifier.startswith('0x'):
        return 'pyusb'
    elif identifier.startswith('file://') or identifier.startswith('/dev/usb/') or identifier.startswith('lp'):
        return 'linux_kernel'
    elif identifier.startswith('tcp://'):
        return 'network'
    else:
        raise ValueError('Cannot guess backend for given identifier: %s' % identifier)
998608
def peek_native(make):
    
    def peek(service, container, _stack=None):
        return make(service.peekNative(container))
    return peek
416214
def _check_virtualenv():
    
    from os import waitpid
    from subprocess import Popen, PIPE
    penvs = Popen("source /usr/local/bin/virtualenvwrapper.sh; workon",
                 shell=True, executable="/bin/bash", stdout=PIPE, stderr=PIPE)
    waitpid(penvs.pid, 0)
    envs = penvs.stdout.readlines()
    enverr = penvs.stderr.readlines()
    result = (settings.venv + '\n') in envs and len(enverr) == 0

    vms("Find virtualenv: {}".format(' '.join(envs).replace('\n', '')))
    vms("Find virtualenv | stderr: {}".format(' '.join(enverr)))
    
    if not result:
        info(envs)
        err("The virtualenv '{}' does not exist; can't use CI server.".format(settings.venv))
        if len(enverr) > 0:
            map(err, enverr)
    return result
1214675
def get_spam_checker(backend_path):
    
    try:
        backend_module = import_module(backend_path)
        backend = getattr(backend_module, 'backend')
    except (ImportError, AttributeError):
        warnings.warn('%s backend cannot be imported' % backend_path,
                      RuntimeWarning)
        backend = None
    except ImproperlyConfigured as e:
        warnings.warn(str(e), RuntimeWarning)
        backend = None

    return backend
1245512
def backend_query(self, **kwargs):
        ''''''
        q = self.construct()
        return q if isinstance(q, EmptyQuery) else q.backend_query(**kwargs)
443388
def _check_backend():
    
    # Django 1.10 does not allow
    # both settings to be set
    middleware = set(
        getattr(settings, 'MIDDLEWARE', None) or
        getattr(settings, 'MIDDLEWARE_CLASSES', None) or
        [])

    # Deprecated alias
    if "djconfig.middleware.DjConfigLocMemMiddleware" in middleware:
        return

    if "djconfig.middleware.DjConfigMiddleware" in middleware:
        return

    raise ValueError(
        "djconfig.middleware.DjConfigMiddleware "
        "is required but it was not found in "
        "MIDDLEWARE_CLASSES nor in MIDDLEWARE")
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
771435
def check_backend() -> bool:
        """"""
        try:
            call('gatttool', stdout=PIPE, stderr=PIPE)
            return True
        except OSError as os_err:
            msg = 'gatttool not found: {}'.format(str(os_err))
            _LOGGER.error(msg)
        return False
423425
def data_complete(datadir, sitedir, get_container_name):
    
    if any(not path.isdir(sitedir + x)
            for x in ('/files', '/run', '/solr')):
        return False

    if docker.is_boot2docker():
        # Inspect returns None if the container doesn't exist.
        return all(docker.inspect_container(get_container_name(x))
                for x in ('pgdata', 'venv'))

    return path.isdir(datadir + '/venv') and path.isdir(sitedir + '/postgres')
600843
def get_backend_init_list(backend_vals):
    """"""
    cmd_list = []
    for (key, val) in backend_vals.items():
        cmd_list.append('-backend-config')
        cmd_list.append(key + '=' + val)
    return cmd_list
248641
def backend_type(path, client):
    """"""
    backends = client.list_secret_backends()['data']
    vault_path = "%s/" % path
    return backends[vault_path]['type']