Merge pull request #327 from Deixx/with-any-trait

Get cache modes which have any of the provided traits
This commit is contained in:
Michał Mielewczyk 2020-02-10 09:02:50 +01:00 committed by GitHub
commit cbcbf979bf

View File

@ -57,6 +57,12 @@ class CacheMode(Enum):
m for m in CacheMode if all(map(lambda t: t in CacheMode.get_traits(m), flags)) m for m in CacheMode if all(map(lambda t: t in CacheMode.get_traits(m), flags))
] ]
@staticmethod
def with_any_trait(flags: CacheModeTrait):
return [
m for m in CacheMode if any(map(lambda t: t in CacheMode.get_traits(m), flags))
]
class SeqCutOffPolicy(Enum): class SeqCutOffPolicy(Enum):
full = 0 full = 0