Skip to content

Commit d35eda2

Browse files
committed
move _get_dynamic_config_value()
1 parent 707114c commit d35eda2

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

reddit_decider/__init__.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -696,32 +696,6 @@ def get_all_variants_for_identifier_without_expose(
696696

697697
return parsed_choices
698698

699-
def _get_dynamic_config_value(
700-
self,
701-
feature_name: str,
702-
default: Any,
703-
dc_types: List[str],
704-
) -> Any:
705-
if self._internal is None:
706-
logger.error("rs_decider is None--did not initialize.")
707-
return default
708-
709-
ctx = self._decider_context.to_dict()
710-
711-
try:
712-
decision = self._internal.choose(feature_name=feature_name, context=ctx)
713-
except FeatureNotFoundException as exc:
714-
warnings.warn(str(exc))
715-
return default
716-
except DeciderException as exc:
717-
logger.info(str(exc))
718-
return default
719-
720-
if decision.value_type not in dc_types:
721-
return default
722-
723-
return decision.value
724-
725699
def get_bool(self, feature_name: str, default: bool = False) -> bool:
726700
"""Fetch a Dynamic Configuration of boolean type.
727701
@@ -834,6 +808,32 @@ def get_all_dynamic_configs(self) -> List[Dict[str, Any]]:
834808

835809
return parsed_configs
836810

811+
def _get_dynamic_config_value(
812+
self,
813+
feature_name: str,
814+
default: Any,
815+
dc_types: List[str],
816+
) -> Any:
817+
if self._internal is None:
818+
logger.error("rs_decider is None--did not initialize.")
819+
return default
820+
821+
ctx = self._decider_context.to_dict()
822+
823+
try:
824+
decision = self._internal.choose(feature_name=feature_name, context=ctx)
825+
except FeatureNotFoundException as exc:
826+
warnings.warn(str(exc))
827+
return default
828+
except DeciderException as exc:
829+
logger.info(str(exc))
830+
return default
831+
832+
if decision.value_type not in dc_types:
833+
return default
834+
835+
return decision.value
836+
837837
def _decision_to_dc_dict(self, decision: Decision) -> Dict[str, Any]:
838838
return {
839839
"name": decision.feature_name,

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-r requirements-transitive.txt
22
baseplate==2.0.0a1
33
black==21.4b2
4-
reddit-decider==1.2.30
4+
reddit-decider==1.2.29
55
flake8==3.9.1
66
mypy==0.790
77
pyramid==2.0 # required for `from baseplate.frameworks.pyramid import BaseplateRequest` which calls `import pyramid.events`

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
install_requires=[
2020
"baseplate>=2.0.0a1,<3.0",
2121
"reddit-edgecontext>=1.0.0a3,<2.0",
22-
"reddit-decider~=1.2.30",
22+
"reddit-decider~=1.2.29",
2323
"typing_extensions>=3.10.0.0,<5.0",
2424
],
2525
package_data={"reddit_experiments": ["py.typed"]},

0 commit comments

Comments
 (0)