Return Singleton instance.
5065
public static function getInstance() {

		if( !isset( self::$instance ) ) {

			self::$instance	= new CoreProperties();

			self::$instance->init( CoreGlobal::CONFIG_CORE );
		}

		return self::$instance;
	}
1080576
def get_singleton(self):
        
        only_value = None
        for value in six.itervalues(self.ordered_dict):
            # This loop will raise if it runs more than once.
            if only_value is not None:
                raise ValueError("%r is not a singleton." % self)

            only_value = value

        if only_value is self.__UnsetSentinel or only_value is None:
            raise ValueError("%r is empty." % self)

        return only_value
688068
public static function singleton()
    {
        if (!isset(self::$_instance)) {
            $c = __CLASS__;
            self::$_instance = new $c;
        }

        return self::$_instance;
    }
888717
def singleton(cls):
    
    import inspect

    # Create a structure to store instances of any singletons that get
    # created.
    instances = {}

    # Make sure that the constructor for this class doesn't take any
    # arguments.  Since singletons can only be instantiated once, it doesn't
    # make any sense for the constructor to take arguments.  If the class 
    # doesn't implement its own constructor, don't do anything.  This case is 
    # considered specially because it causes a TypeError in python 3.3 but not 
    # in python 3.4.
    if cls.__init__ is not object.__init__:
        argspec = inspect.getfullargspec(cls.__init__)
        if len(argspec.args) != 1 or argspec.varargs or argspec.varkw:
            raise TypeError("Singleton classes cannot accept arguments to the constructor.")


    def get_instance():
        """ Creates and returns the singleton object.  This function is what 
        gets returned by this decorator. """

        # Check to see if an instance of this class has already been
        # instantiated.  If it hasn't, create one.  The `instances` structure
        # is technically a global variable, so it will be preserved between
        # calls to this function.
        if cls not in instances:
            instances[cls] = cls()

        # Return a previously instantiated object of the requested type.
        return instances[cls]

    # Return the decorator function.
    return get_instance
948421
public static function get_instance() : Core {

		if ( null === self::$_instance ) {
			self::$_instance = new Core();
		}

		return self::$_instance;
	}
398825
def instances(cls):
        
        l = [i for i in cls.allinstances() if isinstance(i, cls)]
        return l
628995
def singleton_per_scope(_cls, _scope=None, _renew=False, *args, **kwargs):
    """"""

    result = None

    singletons = SINGLETONS_PER_SCOPES.setdefault(_scope, {})

    if _renew or _cls not in singletons:
        singletons[_cls] = _cls(*args, **kwargs)

    result = singletons[_cls]

    return result
1334691
private static function initInstance(): Instance
    {
        $instance = new Instance();
        $instance->setOptions(Config::get('translator'));
        $instance->init();
        return $instance;
    }
890159
public static PojoUtil getInstance() {

    if (instance == null) {
      PojoUtilImpl impl = null;
      synchronized (PojoUtilImpl.class) {
        if (instance == null) {
          impl = new PojoUtilImpl();
          impl.initialize();
          instance = impl;
        }
      }
    }
    return instance;
  }
61405
def init(options=None, ini_paths=None, argv=None,
         strict=False, **parser_kwargs):
    
    global SINGLETON
    SINGLETON = Config(
        options=options,
        ini_paths=ini_paths,
        argv=argv,
        **parser_kwargs)
    SINGLETON.parse(argv, strict=strict)
    return SINGLETON
521750
public static SystemUtil getInstance() {

    if (instance == null) {
      synchronized (SystemUtilImpl.class) {
        if (instance == null) {
          instance = new SystemUtilImpl();
        }
      }
    }
    return instance;
  }
733420
def _get_instance(self):
        """"""
        resource = self._connect()

        try:
            instance = resource.Instance(self.running_instance_id)
        except Exception:
            raise EC2CloudException(
                'Instance with ID: {instance_id} not found.'.format(
                    instance_id=self.running_instance_id
                )
            )
        return instance
899689
public static function getInstance(string $name = 'default'): self
    {
        if (!isset(self::$instances[$name])) {
            self::setInstance($name, new self());
        }

        return self::$instances[$name];
    }
356029
public static function singleton()
    {
        $returnValue = null;

        
        
        if(is_null(self::$instance)){
        	$class = __CLASS__;				//used in case of subclassing
        	self::$instance = new $class();
        }
        $returnValue = self::$instance;
        
        

        return $returnValue;
    }
824645
public static function singleton()
    {
        $returnValue = null;

        
        if (is_null(self::$singleton)) {
        	self::$singleton = new self();
        }
        $returnValue = self::$singleton;
        

        return $returnValue;
    }
580689
def InstanceOf(cls, **kwargs):
    """"""
    return Property(types=cls, load=cls.load, **kwargs)
412
public static function getInstance ()
    {
        // If this class is used for multiple singletons, we need to keep
        // track of multiple singleton objects, one for each class name
        static $instances = array();

        // Get class name to use. Use late static binding here,
        // if method is overriden by derived classes.
        $singletonClassName = static::_getInstanceClassName();

        // If already instantiated, use that
        if (isset($instances[$singletonClassName])) {
            return $instances[$singletonClassName];
        }

        // Otherwise create new instance
        $instances[$singletonClassName] = new $singletonClassName (static::_getInstanceFuseValue());

        return $instances[$singletonClassName];
    }