Skip to content
Snippets Groups Projects
Commit e2390f0c authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Cleanup cached_property decorator

parent e8f1db77
No related branches found
No related tags found
1 merge request!21Resolve "Reduce the amount of uproot.open (to one)"
Pipeline #9179 passed with warnings
...@@ -11,13 +11,15 @@ BASKET_CACHE_SIZE = 110 * 1024**2 ...@@ -11,13 +11,15 @@ BASKET_CACHE_SIZE = 110 * 1024**2
class cached_property: class cached_property:
def __init__(self, func): """A simple cache decorator for properties."""
self.func = func def __init__(self, function):
self.function= function
def __get__(self, obj, cls): def __get__(self, obj, cls):
if obj is None: return self if obj is None:
value = obj.__dict__[self.func.__name__] = self.func(obj) return self
return value prop = obj.__dict__[self.function.__name__] = self.function(obj)
return prop
class OfflineKeys: class OfflineKeys:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment