Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0411458
update: UserProfile class created, changes in decision_service, decid…
FarhanAnjum-opti Nov 4, 2024
43a0c74
update: get_variation function changed
FarhanAnjum-opti Nov 4, 2024
d462339
update: new function in decision_service
FarhanAnjum-opti Nov 6, 2024
fc976ff
update: everything implemented from java. tests are failing
FarhanAnjum-opti Nov 6, 2024
4187366
update: minor changes
FarhanAnjum-opti Nov 6, 2024
8d32180
update: user_profile_tracker added to tests
FarhanAnjum-opti Nov 8, 2024
ba44a6c
update: some tests fixed
FarhanAnjum-opti Nov 12, 2024
c78df2f
🛠️ optimizely/decision_service.py -> Added check for `ignore_user_pro…
FarhanAnjum-opti Nov 12, 2024
d02c3d8
🛠️ tests/test_decision_service.py -> Added expected decision object.
FarhanAnjum-opti Nov 12, 2024
c67bcf3
optimizely/decision_service.py -> fixed get_variations_for_feature_list
FarhanAnjum-opti Nov 12, 2024
820ba3e
optimizely/decision_service.py -> Fixed how rollout reasons are added
FarhanAnjum-opti Nov 12, 2024
309223c
tests/test_user_context.py -> fixed some tests
FarhanAnjum-opti Nov 12, 2024
ca1b248
optimizely/user_profile.py -> Updated type for `experiment_bucket_map`.
FarhanAnjum-opti Nov 13, 2024
d0bc332
all unit tests passing
FarhanAnjum-opti Nov 13, 2024
e6e442a
lint check
FarhanAnjum-opti Nov 13, 2024
0c92722
fix: typechecks added
FarhanAnjum-opti Nov 20, 2024
af9715e
more types updated
FarhanAnjum-opti Nov 20, 2024
e2d7c91
all typechecks passing
FarhanAnjum-opti Nov 20, 2024
cc4da7e
gha typechecks fixed
FarhanAnjum-opti Nov 20, 2024
dd62075
all typecheck should pass
FarhanAnjum-opti Nov 20, 2024
2477d11
lint check should pass
FarhanAnjum-opti Nov 20, 2024
27ef846
removed unnecessary comments
FarhanAnjum-opti Nov 20, 2024
e2810c8
removed comments from test
FarhanAnjum-opti Nov 20, 2024
9228727
optimizely/decision_service.py -> Removed user profile save logic
FarhanAnjum-opti Nov 21, 2024
b33a92b
optimizely/user_profile.py -> Updated experiment_bucket_map type
FarhanAnjum-opti Nov 22, 2024
1dd1eef
optimizely/decision_service.py -> Commented out profile loading
FarhanAnjum-opti Nov 22, 2024
6387ca2
optimizely/decision_service.py -> Removed unused profile loading
FarhanAnjum-opti Nov 25, 2024
8359498
optimizely/user_profile.py -> Reverted back to variation ID retrieval…
FarhanAnjum-opti Nov 26, 2024
b825ab4
optimizely/user_profile.py -> Added error handling logic
FarhanAnjum-opti Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
gha typechecks fixed
  • Loading branch information
FarhanAnjum-opti committed Nov 20, 2024
commit cc4da7ee0dc733332c9a866c4ea8dea9fce48f7c
8 changes: 4 additions & 4 deletions optimizely/user_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def __init__(self, user_id: str, user_profile_service: Optional[UserProfileServi
self.profile_updated = False
self.user_profile = UserProfile(user_id, {})

def get_user_profile(self):
def get_user_profile(self) -> None:
return self.user_profile

def load_user_profile(self, reasons: Optional[list[str]]=[], error_handler: Optional[BaseErrorHandler]=None):
def load_user_profile(self, reasons: Optional[list[str]]=[], error_handler: Optional[BaseErrorHandler]=None) -> None:
reasons = reasons if reasons else []
try:
user_profile = self.user_profile_service.lookup(self.user_id) if self.user_profile_service else None
Expand Down Expand Up @@ -146,7 +146,7 @@ def load_user_profile(self, reasons: Optional[list[str]]=[], error_handler: Opti
if self.user_profile is None:
self.user_profile = UserProfile(self.user_id, {})

def update_user_profile(self, experiment: Experiment, variation: Variation):
def update_user_profile(self, experiment: Experiment, variation: Variation) -> None:
if experiment.id in self.user_profile.experiment_bucket_map:
decision = self.user_profile.experiment_bucket_map[experiment.id]
if isinstance(decision, decision_service.Decision):
Expand All @@ -163,7 +163,7 @@ def update_user_profile(self, experiment: Experiment, variation: Variation):
# self.logger.info(f'Updated variation "{variation.id}" of experiment "{experiment.id}" for user "{self.user_profile.user_id}".')


def save_user_profile(self, error_handler: Optional[BaseErrorHandler] = None):
def save_user_profile(self, error_handler: Optional[BaseErrorHandler] = None) -> None:
if not self.profile_updated:
return
try:
Expand Down