| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # ------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| import json | ||
| import os | ||
| import sys | ||
| from random_filter import RandomFilter | ||
| from featuremanagement import FeatureManager, TargetingContext | ||
|
|
||
|
|
||
| script_directory = os.path.dirname(os.path.abspath(sys.argv[0])) | ||
|
|
||
| with open(script_directory + "/formatted_feature_flags.json", "r", encoding="utf-8") as f: | ||
| feature_flags = json.load(f) | ||
|
|
||
| USER_ID = "Adam" | ||
|
|
||
|
|
||
| def my_targeting_accessor() -> TargetingContext: | ||
| return TargetingContext(user_id=USER_ID) | ||
|
|
||
|
|
||
| feature_manager = FeatureManager( | ||
| feature_flags, feature_filters=[RandomFilter()], targeting_context_accessor=my_targeting_accessor | ||
| ) | ||
|
|
||
| print(feature_manager.is_enabled("TestVariants")) | ||
| print(feature_manager.get_variant("TestVariants").configuration) | ||
|
|
||
| USER_ID = "Ellie" | ||
|
|
||
| print(feature_manager.is_enabled("TestVariants")) | ||
| print(feature_manager.get_variant("TestVariants").configuration) |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.