diff options
author | workfork <workfork@yandex-team.ru> | 2022-02-10 16:46:43 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:43 +0300 |
commit | 89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/python/func | |
parent | c3745173272d1cf5b0642debb40d019e7ae71094 (diff) | |
download | ydb-89db6fe2fe2c32d2a832ddfeb04e8d078e301084.tar.gz |
Restoring authorship annotation for <workfork@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python/func')
-rw-r--r-- | library/python/func/__init__.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/library/python/func/__init__.py b/library/python/func/__init__.py index 82de2e60ea..7424361635 100644 --- a/library/python/func/__init__.py +++ b/library/python/func/__init__.py @@ -44,26 +44,26 @@ def lazy_property(fn): return _lazy_property -class classproperty(object): - def __init__(self, func): - self.func = func - - def __get__(self, _, owner): - return self.func(owner) - - -class lazy_classproperty(object): - def __init__(self, func): - self.func = func - - def __get__(self, _, owner): - attr_name = '_lazy_' + self.func.__name__ - - if not hasattr(owner, attr_name): - setattr(owner, attr_name, self.func(owner)) - return getattr(owner, attr_name) - - +class classproperty(object): + def __init__(self, func): + self.func = func + + def __get__(self, _, owner): + return self.func(owner) + + +class lazy_classproperty(object): + def __init__(self, func): + self.func = func + + def __get__(self, _, owner): + attr_name = '_lazy_' + self.func.__name__ + + if not hasattr(owner, attr_name): + setattr(owner, attr_name, self.func(owner)) + return getattr(owner, attr_name) + + def memoize(limit=0, thread_local=False): assert limit >= 0 |