This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| To use simply copy ClassPropertyMeta and classproperty into your project | |
| """ | |
| class ClassPropertyMeta(type): | |
| def __setattr__(self, key, value): | |
| obj = self.__dict__.get(key, None) | |
| if type(obj) is classproperty: | |
| return obj.__set__(self, value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cProfile | |
| import contextlib | |
| import os | |
| @contextlib.contextmanager | |
| def profile(filename='~/python.profile', *args, **kwargs): | |
| profile = cProfile.Profile(*args, **kwargs) | |
| profile.enable() |