Return always the same instance of the backend class
421261
def create(cls):
        
        if cls not in cls._instances:
            cls._instances[cls] = cls()

        return cls._instances[cls]
978499
def getInstance(self):
        
        try:
            return self._instance
        except AttributeError:
            self._instance = self._decorated()
            return self._instance
127926
def get_instance(self, payload):
        
        return EntityInstance(self._version, payload, service_sid=self._solution['service_sid'], )
105830
def response_class(self, cls):
        
        s = self._clone()
        s._response_class = cls
        return s
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
423767
def default_instance(cls):
        
        if cls._instance is None:
            with cls._instance_lock:
                if cls._instance is None:
                    cls._instance = FlowsLogger()

        return cls._instance
219896
def read_backend(self):
        '''
        '''
        session = self.session
        if session is not None:
            if self._field:
                return session.model(self._field.model).read_backend
            else:
                return session.model(self).read_backend
23636
def ensure_backend(resource, backend, backends, opt, managed=True):
    """"""
    existing_mount = find_backend(resource.mount, backends)
    if not existing_mount:
        new_mount = backend(resource, opt, managed=managed)
        backends.append(new_mount)
        return new_mount

    return existing_mount
790773
def getInstance(cls, *args):
        '''
        
        '''
        if not cls.__singleton:
            cls.__singleton = Openshift(*args)
        return cls.__singleton
779372
public com.google.api.Backend getBackend() {
    return backend_ == null ? com.google.api.Backend.getDefaultInstance() : backend_;
  }
631333
def instance(cls, hostname=None, auth=None, protocol=None, port=None, database=None):
        

        if cls.class_instance is None:
            if hostname is None and auth is None and protocol is None and port is None and database is None:
                cls.class_instance = Client(hostname='localhost')
            else:
                cls.class_instance = Client(hostname=hostname, auth=auth, protocol=protocol, port=port, database=database)
        else:
            if hostname is not None:
                cls.class_instance.hostname = hostname

            if protocol is not None:
                cls.class_instance.hostname = protocol

            if port is not None:
                cls.class_instance.hostname = port

            if database is not None:
                cls.class_instance.database = database

            if auth is not None:
                cls.class_instance.auth = auth

            cls.class_instance._create_api()

        return cls.class_instance
1248599
private static function _getInstance()
    {
        static $i;
        if (!isset($i)) {
            $c = Kwf_Config::getValue('benchmarkClass');
            if (!class_exists($c)) {
                $c = 'Kwf_Benchmark';
            }
            $i = new $c();
        }
        return $i;
    }
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
580464
def get_backend(name):
    """"""

    for backend in _BACKENDS:
        if backend.NAME == name:
            return backend
    raise KeyError("Backend %r not available" % name)
730967
def get_instance(self):
        
        try:
            return self._instance
        except AttributeError:
            self._instance = self._decorated()
            return self._instance
856289
def get_consistent_resource(self):
        
        http_client = HttpClient()
        response, _ = http_client.get(
            routes.url(routes.REFUND_RESOURCE, resource_id=self.id, payment_id=self.payment_id)
        )
        return Refund(**response)
654274
def get_listener_instance(self, cls):
        
        with self._lock:
            for listener in self._listeners:
                if isinstance(listener, cls):
                    return listener