Skip to content

Commit

Permalink
Merge pull request #24 from lsst/tickets/DM-11693
Browse files Browse the repository at this point in the history
Use cls instead of self for metaclasses for N804
  • Loading branch information
brianv0 committed Sep 20, 2018
2 parents ab3db49 + 16c36be commit bc759ec
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions python/lsst/ctrl/pool/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,14 @@ class definition).
"__new__" in the class).
"""

def __init__(self, name, bases, dict_):
super(SingletonMeta, self).__init__(name, bases, dict_)
self._instance = None
def __init__(cls, name, bases, dict_):
super(SingletonMeta, cls).__init__(name, bases, dict_)
cls._instance = None

def __call__(self, *args, **kwargs):
if self._instance is None:
self._instance = super(SingletonMeta, self).__call__(*args, **kwargs)
return self._instance
def __call__(cls, *args, **kwargs):
if cls._instance is None:
cls._instance = super(SingletonMeta, cls).__call__(*args, **kwargs)
return cls._instance


class Debugger(with_metaclass(SingletonMeta, object)):
Expand Down Expand Up @@ -1181,8 +1181,8 @@ class PoolWrapperMeta(type):
The 'context' is automatically supplied to these methods as the first argument.
"""

def __call__(self, context="default"):
instance = super(PoolWrapperMeta, self).__call__(context)
def __call__(cls, context="default"):
instance = super(PoolWrapperMeta, cls).__call__(context)
pool = PoolMaster()
for name in ("map", "mapNoBalance", "mapToPrevious",
"reduce", "reduceNoBalance", "reduceToPrevious",
Expand Down

0 comments on commit bc759ec

Please sign in to comment.