DIRACSingleton

mod:

DIRACSingleton

metaclass singleton implementation

class DIRAC.Core.Utilities.DIRACSingleton.DIRACSingleton(name, bases, dic)

Bases: type

Simple singleton pattern using metaclass

If you want make your class a singleton, just set the keyword argument metaclass=DIRACSingleton in its definition i.e.:

from DIRAC.Core.Utilities.DIRACSingleton import DIRACSingleton
class CheeseShop(metaclass=DIRACSingleton):
    pass
__init__(name, bases, dic)

c’tor

Parameters:
  • cls – class def

  • name – class name (becomes __name__ attr)

  • bases – tuple of parent class defs (becomes __bases__ attr)

  • dic – definition dict for class body (becomes __dict__ attr)

mro()

Return a type’s method resolution order.