🌒 .shadow
¶
If you want to run something in the shadows. Replacing your flagged object.
Usage¶
In [1]:
Copied!
from fastfeatureflag.feature_flag import feature_flag
from fastfeatureflag.feature_flag import feature_flag
In [2]:
Copied!
def in_the_shadows(*args, **kwargs):
return args, kwargs
@feature_flag().shadow(in_the_shadows)
def broken_feature():
return "broken"
def in_the_shadows(*args, **kwargs):
return args, kwargs
@feature_flag().shadow(in_the_shadows)
def broken_feature():
return "broken"
In [3]:
Copied!
broken_feature("shadow", some_input="long_shadow")
broken_feature("shadow", some_input="long_shadow")
Out[3]:
(('shadow',), {'some_input': 'long_shadow'})
Activation¶
It is possible to activate a feature_flag
and therefore get the original object.
In [4]:
Copied!
def in_the_shadows():
return "in the shadow"
@feature_flag("on").shadow(in_the_shadows)
def broken_feature():
return "broken"
def in_the_shadows():
return "in the shadow"
@feature_flag("on").shadow(in_the_shadows)
def broken_feature():
return "broken"
In [5]:
Copied!
broken_feature()
broken_feature()
Out[5]:
'broken'
Last update:
October 28, 2023
Created: October 28, 2023
Created: October 28, 2023