dissect.util.feature
#
Module Contents#
Classes#
Generic enumeration. |
Functions#
Use this function for block-level feature flag control. |
|
Feature flag decorator allowing you to guard a function behind a feature flag. |
Attributes#
- class dissect.util.feature.Feature#
Bases:
enum.Enum
Generic enumeration.
Derive from this class to define new enumerations.
- LATEST = 'latest'#
- ADVANCED = 'advanced'#
- BETA = 'beta'#
- dissect.util.feature.DISSECT_FEATURES_DEFAULT = 'latest'#
- dissect.util.feature.DISSECT_FEATURES_ENV = 'DISSECT_FEATURES'#
- exception dissect.util.feature.FeatureException#
Bases:
RuntimeError
Unspecified run-time error.
- dissect.util.feature.feature_enabled(feature: Feature) bool #
Use this function for block-level feature flag control.
Usage:
def parse_blob(): if feature_enabled(Feature.BETA): self._parse_fast_experimental() else: self._parse_normal()
- dissect.util.feature.feature(flag: Feature, alternative: Callable | None = None) Callable #
Feature flag decorator allowing you to guard a function behind a feature flag.
Usage:
@feature(Feature.SOME_FLAG, fallback) def my_func( ... ) -> ...
Where
SOME_FLAG
is the feature you want to check for andfallback
is the alternative function to serve if the feature flag is NOT set.