@@ -388,9 +388,9 @@ def capture_exception(
388388def feature_enabled (
389389 key , # type: str
390390 distinct_id , # type: str
391- groups = {} , # type: dict
392- person_properties = {} , # type: dict
393- group_properties = {} , # type: dict
391+ groups = None , # type: Optional[ dict]
392+ person_properties = None , # type: Optional[ dict]
393+ group_properties = None , # type: Optional[ dict]
394394 only_evaluate_locally = False , # type: bool
395395 send_feature_flag_events = True , # type: bool
396396 disable_geoip = None , # type: Optional[bool]
@@ -427,9 +427,9 @@ def feature_enabled(
427427 "feature_enabled" ,
428428 key = key ,
429429 distinct_id = distinct_id ,
430- groups = groups ,
431- person_properties = person_properties ,
432- group_properties = group_properties ,
430+ groups = groups or {} ,
431+ person_properties = person_properties or {} ,
432+ group_properties = group_properties or {} ,
433433 only_evaluate_locally = only_evaluate_locally ,
434434 send_feature_flag_events = send_feature_flag_events ,
435435 disable_geoip = disable_geoip ,
@@ -439,9 +439,9 @@ def feature_enabled(
439439def get_feature_flag (
440440 key , # type: str
441441 distinct_id , # type: str
442- groups = {} , # type: dict
443- person_properties = {} , # type: dict
444- group_properties = {} , # type: dict
442+ groups = None , # type: Optional[ dict]
443+ person_properties = None , # type: Optional[ dict]
444+ group_properties = None , # type: Optional[ dict]
445445 only_evaluate_locally = False , # type: bool
446446 send_feature_flag_events = True , # type: bool
447447 disable_geoip = None , # type: Optional[bool]
@@ -477,9 +477,9 @@ def get_feature_flag(
477477 "get_feature_flag" ,
478478 key = key ,
479479 distinct_id = distinct_id ,
480- groups = groups ,
481- person_properties = person_properties ,
482- group_properties = group_properties ,
480+ groups = groups or {} ,
481+ person_properties = person_properties or {} ,
482+ group_properties = group_properties or {} ,
483483 only_evaluate_locally = only_evaluate_locally ,
484484 send_feature_flag_events = send_feature_flag_events ,
485485 disable_geoip = disable_geoip ,
@@ -488,9 +488,9 @@ def get_feature_flag(
488488
489489def get_all_flags (
490490 distinct_id , # type: str
491- groups = {} , # type: dict
492- person_properties = {} , # type: dict
493- group_properties = {} , # type: dict
491+ groups = None , # type: Optional[ dict]
492+ person_properties = None , # type: Optional[ dict]
493+ group_properties = None , # type: Optional[ dict]
494494 only_evaluate_locally = False , # type: bool
495495 disable_geoip = None , # type: Optional[bool]
496496) -> Optional [dict [str , FeatureFlag ]]:
@@ -520,9 +520,9 @@ def get_all_flags(
520520 return _proxy (
521521 "get_all_flags" ,
522522 distinct_id = distinct_id ,
523- groups = groups ,
524- person_properties = person_properties ,
525- group_properties = group_properties ,
523+ groups = groups or {} ,
524+ person_properties = person_properties or {} ,
525+ group_properties = group_properties or {} ,
526526 only_evaluate_locally = only_evaluate_locally ,
527527 disable_geoip = disable_geoip ,
528528 )
@@ -531,23 +531,23 @@ def get_all_flags(
531531def get_feature_flag_result (
532532 key ,
533533 distinct_id ,
534- groups = {},
535- person_properties = {},
536- group_properties = {},
534+ groups = None , # type: Optional[dict]
535+ person_properties = None , # type: Optional[dict]
536+ group_properties = None , # type: Optional[dict]
537537 only_evaluate_locally = False ,
538538 send_feature_flag_events = True ,
539539 disable_geoip = None , # type: Optional[bool]
540540) -> Optional [FeatureFlagResult ]: # type hint for feature flag result
541541 """
542542 Get a FeatureFlagResult object which contains the flag result and payload.
543-
543+
544544 This method evaluates a feature flag and returns a FeatureFlagResult object containing:
545545 - enabled: Whether the flag is enabled
546546 - variant: The variant value if the flag has variants
547547 - payload: The payload associated with the flag (automatically deserialized from JSON)
548548 - key: The flag key
549549 - reason: Why the flag was enabled/disabled
550-
550+
551551 Example:
552552 ```python
553553 result = posthog.get_feature_flag_result('beta-feature', 'distinct_id')
@@ -561,9 +561,9 @@ def get_feature_flag_result(
561561 "get_feature_flag_result" ,
562562 key = key ,
563563 distinct_id = distinct_id ,
564- groups = groups ,
565- person_properties = person_properties ,
566- group_properties = group_properties ,
564+ groups = groups or {} ,
565+ person_properties = person_properties or {} ,
566+ group_properties = group_properties or {} ,
567567 only_evaluate_locally = only_evaluate_locally ,
568568 send_feature_flag_events = send_feature_flag_events ,
569569 disable_geoip = disable_geoip ,
@@ -574,9 +574,9 @@ def get_feature_flag_payload(
574574 key ,
575575 distinct_id ,
576576 match_value = None ,
577- groups = {},
578- person_properties = {},
579- group_properties = {},
577+ groups = None , # type: Optional[dict]
578+ person_properties = None , # type: Optional[dict]
579+ group_properties = None , # type: Optional[dict]
580580 only_evaluate_locally = False ,
581581 send_feature_flag_events = True ,
582582 disable_geoip = None , # type: Optional[bool]
@@ -586,9 +586,9 @@ def get_feature_flag_payload(
586586 key = key ,
587587 distinct_id = distinct_id ,
588588 match_value = match_value ,
589- groups = groups ,
590- person_properties = person_properties ,
591- group_properties = group_properties ,
589+ groups = groups or {} ,
590+ person_properties = person_properties or {} ,
591+ group_properties = group_properties or {} ,
592592 only_evaluate_locally = only_evaluate_locally ,
593593 send_feature_flag_events = send_feature_flag_events ,
594594 disable_geoip = disable_geoip ,
@@ -617,18 +617,18 @@ def get_remote_config_payload(
617617
618618def get_all_flags_and_payloads (
619619 distinct_id ,
620- groups = {},
621- person_properties = {},
622- group_properties = {},
620+ groups = None , # type: Optional[dict]
621+ person_properties = None , # type: Optional[dict]
622+ group_properties = None , # type: Optional[dict]
623623 only_evaluate_locally = False ,
624624 disable_geoip = None , # type: Optional[bool]
625625) -> FlagsAndPayloads :
626626 return _proxy (
627627 "get_all_flags_and_payloads" ,
628628 distinct_id = distinct_id ,
629- groups = groups ,
630- person_properties = person_properties ,
631- group_properties = group_properties ,
629+ groups = groups or {} ,
630+ person_properties = person_properties or {} ,
631+ group_properties = group_properties or {} ,
632632 only_evaluate_locally = only_evaluate_locally ,
633633 disable_geoip = disable_geoip ,
634634 )
0 commit comments