mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Repository now parses languages and manifests
This commit is contained in:
parent
d77d01cd22
commit
5ca8f4ffa8
8 changed files with 114 additions and 23 deletions
16
pre_commit/util.py
Normal file
16
pre_commit/util.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
class cached_property(object):
|
||||
"""Like @property, but caches the value."""
|
||||
|
||||
def __init__(self, func):
|
||||
self.__name__ = func.__name__
|
||||
self.__module__ = func.__module__
|
||||
self.__doc__ = func.__doc__
|
||||
self._func = func
|
||||
|
||||
def __get__(self, obj, cls):
|
||||
if obj is None:
|
||||
return self
|
||||
value = self._func(obj)
|
||||
obj.__dict__[self.__name__] = value
|
||||
return value
|
||||
Loading…
Add table
Add a link
Reference in a new issue