@@ -245,9 +245,9 @@ def capture_exception(
245245def feature_enabled (
246246 key , # type: str
247247 distinct_id , # type: str
248- groups = {} , # type: dict
249- person_properties = {} , # type: dict
250- group_properties = {} , # type: dict
248+ groups = None , # type: Optional[ dict]
249+ person_properties = None , # type: Optional[ dict]
250+ group_properties = None , # type: Optional[ dict]
251251 only_evaluate_locally = False , # type: bool
252252 send_feature_flag_events = True , # type: bool
253253 disable_geoip = None , # type: Optional[bool]
@@ -270,9 +270,9 @@ def feature_enabled(
270270 "feature_enabled" ,
271271 key = key ,
272272 distinct_id = distinct_id ,
273- groups = groups ,
274- person_properties = person_properties ,
275- group_properties = group_properties ,
273+ groups = groups or {} ,
274+ person_properties = person_properties or {} ,
275+ group_properties = group_properties or {} ,
276276 only_evaluate_locally = only_evaluate_locally ,
277277 send_feature_flag_events = send_feature_flag_events ,
278278 disable_geoip = disable_geoip ,
@@ -282,9 +282,9 @@ def feature_enabled(
282282def get_feature_flag (
283283 key , # type: str
284284 distinct_id , # type: str
285- groups = {} , # type: dict
286- person_properties = {} , # type: dict
287- group_properties = {} , # type: dict
285+ groups = None , # type: Optional[ dict]
286+ person_properties = None , # type: Optional[ dict]
287+ group_properties = None , # type: Optional[ dict]
288288 only_evaluate_locally = False , # type: bool
289289 send_feature_flag_events = True , # type: bool
290290 disable_geoip = None , # type: Optional[bool]
@@ -315,9 +315,9 @@ def get_feature_flag(
315315 "get_feature_flag" ,
316316 key = key ,
317317 distinct_id = distinct_id ,
318- groups = groups ,
319- person_properties = person_properties ,
320- group_properties = group_properties ,
318+ groups = groups or {} ,
319+ person_properties = person_properties or {} ,
320+ group_properties = group_properties or {} ,
321321 only_evaluate_locally = only_evaluate_locally ,
322322 send_feature_flag_events = send_feature_flag_events ,
323323 disable_geoip = disable_geoip ,
@@ -326,9 +326,9 @@ def get_feature_flag(
326326
327327def get_all_flags (
328328 distinct_id , # type: str
329- groups = {} , # type: dict
330- person_properties = {} , # type: dict
331- group_properties = {} , # type: dict
329+ groups = None , # type: Optional[ dict]
330+ person_properties = None , # type: Optional[ dict]
331+ group_properties = None , # type: Optional[ dict]
332332 only_evaluate_locally = False , # type: bool
333333 disable_geoip = None , # type: Optional[bool]
334334) -> Optional [dict [str , FeatureFlag ]]:
@@ -344,9 +344,9 @@ def get_all_flags(
344344 return _proxy (
345345 "get_all_flags" ,
346346 distinct_id = distinct_id ,
347- groups = groups ,
348- person_properties = person_properties ,
349- group_properties = group_properties ,
347+ groups = groups or {} ,
348+ person_properties = person_properties or {} ,
349+ group_properties = group_properties or {} ,
350350 only_evaluate_locally = only_evaluate_locally ,
351351 disable_geoip = disable_geoip ,
352352 )
@@ -355,23 +355,23 @@ def get_all_flags(
355355def get_feature_flag_result (
356356 key ,
357357 distinct_id ,
358- groups = {},
359- person_properties = {},
360- group_properties = {},
358+ groups = None , # type: Optional[dict]
359+ person_properties = None , # type: Optional[dict]
360+ group_properties = None , # type: Optional[dict]
361361 only_evaluate_locally = False ,
362362 send_feature_flag_events = True ,
363363 disable_geoip = None , # type: Optional[bool]
364364) -> Optional [FeatureFlagResult ]: # type hint for feature flag result
365365 """
366366 Get a FeatureFlagResult object which contains the flag result and payload.
367-
367+
368368 This method evaluates a feature flag and returns a FeatureFlagResult object containing:
369369 - enabled: Whether the flag is enabled
370370 - variant: The variant value if the flag has variants
371371 - payload: The payload associated with the flag (automatically deserialized from JSON)
372372 - key: The flag key
373373 - reason: Why the flag was enabled/disabled
374-
374+
375375 Example:
376376 ```python
377377 result = posthog.get_feature_flag_result('beta-feature', 'distinct_id')
@@ -385,9 +385,9 @@ def get_feature_flag_result(
385385 "get_feature_flag_result" ,
386386 key = key ,
387387 distinct_id = distinct_id ,
388- groups = groups ,
389- person_properties = person_properties ,
390- group_properties = group_properties ,
388+ groups = groups or {} ,
389+ person_properties = person_properties or {} ,
390+ group_properties = group_properties or {} ,
391391 only_evaluate_locally = only_evaluate_locally ,
392392 send_feature_flag_events = send_feature_flag_events ,
393393 disable_geoip = disable_geoip ,
@@ -398,9 +398,9 @@ def get_feature_flag_payload(
398398 key ,
399399 distinct_id ,
400400 match_value = None ,
401- groups = {},
402- person_properties = {},
403- group_properties = {},
401+ groups = None , # type: Optional[dict]
402+ person_properties = None , # type: Optional[dict]
403+ group_properties = None , # type: Optional[dict]
404404 only_evaluate_locally = False ,
405405 send_feature_flag_events = True ,
406406 disable_geoip = None , # type: Optional[bool]
@@ -410,9 +410,9 @@ def get_feature_flag_payload(
410410 key = key ,
411411 distinct_id = distinct_id ,
412412 match_value = match_value ,
413- groups = groups ,
414- person_properties = person_properties ,
415- group_properties = group_properties ,
413+ groups = groups or {} ,
414+ person_properties = person_properties or {} ,
415+ group_properties = group_properties or {} ,
416416 only_evaluate_locally = only_evaluate_locally ,
417417 send_feature_flag_events = send_feature_flag_events ,
418418 disable_geoip = disable_geoip ,
@@ -441,18 +441,18 @@ def get_remote_config_payload(
441441
442442def get_all_flags_and_payloads (
443443 distinct_id ,
444- groups = {},
445- person_properties = {},
446- group_properties = {},
444+ groups = None , # type: Optional[dict]
445+ person_properties = None , # type: Optional[dict]
446+ group_properties = None , # type: Optional[dict]
447447 only_evaluate_locally = False ,
448448 disable_geoip = None , # type: Optional[bool]
449449) -> FlagsAndPayloads :
450450 return _proxy (
451451 "get_all_flags_and_payloads" ,
452452 distinct_id = distinct_id ,
453- groups = groups ,
454- person_properties = person_properties ,
455- group_properties = group_properties ,
453+ groups = groups or {} ,
454+ person_properties = person_properties or {} ,
455+ group_properties = group_properties or {} ,
456456 only_evaluate_locally = only_evaluate_locally ,
457457 disable_geoip = disable_geoip ,
458458 )
0 commit comments