X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/357027375ff8867f42ca34bcbfb5a78b5b185fc3..7e113c61d336d677b96ff0ed55a5f81eb2b80d53:/src/wolnelektury/management/profile.py diff --git a/src/wolnelektury/management/profile.py b/src/wolnelektury/management/profile.py index 90e5ec5f5..6978ea831 100644 --- a/src/wolnelektury/management/profile.py +++ b/src/wolnelektury/management/profile.py @@ -1,17 +1,20 @@ - +# -*- coding: utf-8 -*- +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# import cProfile import functools import os _object = None + def profile(meth): def _wrapper(self, *args, **kwargs): - object = self - setattr(object, "__%s" % meth.__name__, meth) - cProfile.runctx('object.__%s(object, *args, **kwargs)' % (meth.__name__, ), globals(), locals(), - "profile.%d" % os.getpid()) + setattr(self, "__%s" % meth.__name__, meth) + cProfile.runctx( + 'object.__%s(object, *args, **kwargs)' % (meth.__name__, ), globals(), locals(), + 'profile.%d' % os.getpid()) functools.update_wrapper(_wrapper, meth) return _wrapper -