Skip to content

Commit

Permalink
Improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Pankrat committed Dec 25, 2017
1 parent 13f2df3 commit dbc2fe5
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions pympler/classtracker.py
Expand Up @@ -326,18 +326,17 @@ def constructor(self, *_args, **_kwargs):
# constructor and the curried arguments of the injected constructor.
# Therefore, the additional argument has a 'magic' name to make it less
# likely that an argument name clash occurs.
self._observers[cls] = _ClassObserver(constructor,
name,
resolution_level,
keep,
trace)
observer = self._observers[cls]
cls.__init__ = instancemethod(
lambda *args,
**kwds: func(observer, *args, **kwds),
None,
cls
)
observer = _ClassObserver(constructor,
name,
resolution_level,
keep,
trace)
self._observers[cls] = observer

def new_constructor(*args, **kwargs):
return func(observer, *args, **kwargs)

cls.__init__ = instancemethod(new_constructor, None, cls)

def _is_tracked(self, cls):
"""
Expand Down

0 comments on commit dbc2fe5

Please sign in to comment.