mirror of
https://github.com/boostorg/build.git
synced 2026-02-14 00:32:11 +00:00
Make the 'cached' decorator work on methods.
[SVN r64640]
This commit is contained in:
@@ -12,9 +12,11 @@ import b2.build.feature
|
||||
from b2.exceptions import *
|
||||
from b2.util.sequence import unique
|
||||
from b2.util.set import difference
|
||||
from b2.util import cached
|
||||
|
||||
from b2.manager import get_manager
|
||||
|
||||
|
||||
def reset ():
|
||||
""" Clear the module state. This is mainly for testing purposes.
|
||||
"""
|
||||
@@ -427,7 +429,7 @@ class PropertySet:
|
||||
|
||||
return self.feature_map_.get(feature, [])
|
||||
|
||||
# FIXME: make this cached
|
||||
@cached
|
||||
def get_properties(self, feature):
|
||||
"""Returns all contained properties associated with 'feature'"""
|
||||
|
||||
|
||||
@@ -30,7 +30,10 @@ class cached(object):
|
||||
except KeyError:
|
||||
v = self.function(*args)
|
||||
self.cache[args] = v
|
||||
return v
|
||||
return v
|
||||
|
||||
def __get__(self, instance, type):
|
||||
return types.MethodType(self, instance, type)
|
||||
|
||||
def unquote(s):
|
||||
if s and s[0] == '"' and s[-1] == '"':
|
||||
|
||||
Reference in New Issue
Block a user