Returns the singleton instance. Upon its first call, it creates a
        new instance of the decorated class and calls its `__init__` method.
        On all subsequent calls, the already created instance is returned.
978499
def getInstance(self):
        
        try:
            return self._instance
        except AttributeError:
            self._instance = self._decorated()
            return self._instance
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
116546
public static function singleton()
    {
        $returnValue = null;

        
        $cacheName = get_called_class();
        if (!isset(self::$instances[$cacheName])) {
        	self::$instances[$cacheName] = new $cacheName();
        }
        
        $returnValue = self::$instances[$cacheName];
        

        return $returnValue;
    }
852730
public static function getInstance()
    {
        $sClass = get_called_class();

        if (!isset(self::$_aInstances[$sClass])) {
            self::$_aInstances[$sClass] = new $sClass();
        }

        return self::$_aInstances[$sClass];
    }
1156461
def getInstance(cls, *args):
        '''
        
        '''
        if not cls.__singleton:
            cls.__singleton = Heroku(*args)
        return cls.__singleton
1333994
final public static function getInstance()
  {
    $className = get_called_class();
    
    if (!isset(self::$_instances[$className])) {
      self::$_instances[$className] = new static();
    }
    self::$_instances[$className]->initialize();

    return self::$_instances[$className];
  }
869568
def get_instance(cls):
        
        if not cls.prepared:
            raise SingletonNotPreparedError(
                "prepare must be called before get_instance"
            )

        if hasattr(cls.local, 'tchannel') and cls.local.tchannel is not None:
            return cls.local.tchannel

        cls.local.tchannel = cls.tchannel_cls(*cls.args, **cls.kwargs)

        return cls.local.tchannel
346472
def instance(self_or_cls,**params):
        

        if isinstance (self_or_cls,ParameterizedMetaclass):
            cls = self_or_cls
        else:
            p = params
            params = dict(self_or_cls.get_param_values())
            params.update(p)
            params.pop('name')
            cls = self_or_cls.__class__

        inst=Parameterized.__new__(cls)
        Parameterized.__init__(inst,**params)
        if 'name' in params:  inst.__name__ = params['name']
        else:                 inst.__name__ = self_or_cls.name
        return inst
344489
public static function getInstance()
    {
        if (null === self::$instance) {
            $class          = new \ReflectionClass(__CLASS__);
            self::$instance = $class->newInstanceArgs(func_get_args());
        }

        return self::$instance;
    }
1316967
def new(self, name, *args, **kwargs):
        '''
        '''
        if name in self._instance_map:
            raise ValueError('Instance {0} is already initialized'
                             .format(name))

        instance = self._class_map[name](*args, **kwargs)
        self._instance_map[name] = instance
        return instance
695395
protected T createInstance() {
        try {
            Constructor<T> ctor = clazz.getDeclaredConstructor();
            ctor.setAccessible(true);
            return ctor.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (SecurityException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
501385
def instance(cls, size):
        
        if not getattr(cls, "_instance", None):
            cls._instance = {}
        if size not in cls._instance:
            cls._instance[size] = ThreadPool(size)
        return cls._instance[size]
576302
public static StaxUtil getInstance() {

    if (instance == null) {
      synchronized (StaxUtilImpl.class) {
        if (instance == null) {
          StaxUtilImpl util = new StaxUtilImpl();
          util.initialize();
          instance = util;
        }
      }
    }
    return instance;
  }
1030774
def instance(cls, *args, **kwargs):
        
        if cls._instance is None:
            cls._instance = cls(*args, **kwargs)
            loaded = cls._instance.reload()
            logging.getLogger('luigi-interface').info('Loaded %r', loaded)

        return cls._instance
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
18188
def decorate_init(init_decorator):
    

    def class_decorator(cls):
        cls.__init__ = init_decorator(cls.__init__)
        return cls

    return class_decorator
738024
def __initialize_instance(self):
        
        config = self.config

        # Initialize instance of the Authentication class
        self.instance.auth = self.authentication_class(self.app, config=config)

        init_handlers = (
            handlers if config.auth_mode() else auth_mode_agnostic_handlers
        )

        for handler in init_handlers:
            if handler.keys is None:
                self.__check_method_in_auth(handler.name, handler.exception)
            else:
                if all(map(config.get, handler.keys)):
                    self.__check_method_in_auth(
                        handler.name, handler.exception
                    )

        for handler in init_handlers:
            if handler.name in self.kwargs:
                method = self.kwargs.pop(handler.name)
                setattr(self.instance.auth, handler.name, method)