from tomviz._wrapping import PipelineStateManagerBase

class PipelineStateManager(PipelineStateManagerBase):
    _instance = None

    # Need to define a constructor as the implementation on the C++ side is
    # static.
    def __init__(self):
        pass

    def __call__(cls):
        if cls._instance is None:
            cls._instance = super(PipelineStateManager, cls).__call__()

        return cls._instances
from tomviz._wrapping import PipelineStateManagerBase

class PipelineStateManager(PipelineStateManagerBase):
    _instance = None

    def __new__(cls, *args, **kwargs):
        if cls._instance is None:
            cls._instance = PipelineStateManagerBase.__new__(cls, *args, **kwargs)

        return cls._instance

Fix singleton to work with wrapped manager class
Fix singleton to work with wrapped manager class

Signed-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com>

  from tomviz._wrapping import PipelineStateManagerBase
  
  class PipelineStateManager(PipelineStateManagerBase):
      _instance = None
  
+     def __new__(cls, *args, **kwargs):
+         if cls._instance is None:
+             cls._instance = PipelineStateManagerBase.__new__(cls, *args, **kwargs)
-     # Need to define a constructor as the implementation on the C++ side is
-     # static.
-     def __init__(self):
-         pass
  
+         return cls._instance
-     def __call__(cls):
-         if cls._instance is None:
-             cls._instance = super(PipelineStateManager, cls).__call__()
  
-         return cls._instances
Fix singleton to work with wrapped manager class
## Code Before:
from tomviz._wrapping import PipelineStateManagerBase

class PipelineStateManager(PipelineStateManagerBase):
    _instance = None

    # Need to define a constructor as the implementation on the C++ side is
    # static.
    def __init__(self):
        pass

    def __call__(cls):
        if cls._instance is None:
            cls._instance = super(PipelineStateManager, cls).__call__()

        return cls._instances
## Instruction:
Fix singleton to work with wrapped manager class
## Code After:
from tomviz._wrapping import PipelineStateManagerBase

class PipelineStateManager(PipelineStateManagerBase):
    _instance = None

    def __new__(cls, *args, **kwargs):
        if cls._instance is None:
            cls._instance = PipelineStateManagerBase.__new__(cls, *args, **kwargs)

        return cls._instance
