@@ -56,9 +56,8 @@ def track(
5656 Route OpenFeature tracking events to Flagsmith.
5757
5858 ``EXPOSURE_TRACKING_EVENT`` records a flag/variant exposure; any other
59- name becomes a plain Flagsmith event with ``details.value`` first-class.
60- No-ops unless the client was initialized with ``enable_events``. Never
61- raises (OpenFeature spec section 6): unexpected errors are logged.
59+ name becomes a plain Flagsmith event. No-ops unless the client was
60+ initialized with ``enable_events``. Never raises: errors are logged.
6261 """
6362 try :
6463 self ._track (tracking_event_name , evaluation_context , tracking_event_details )
@@ -75,9 +74,8 @@ def _track(
7574 evaluation_context : typing .Optional [EvaluationContext ],
7675 tracking_event_details : typing .Optional [TrackingEventDetails ],
7776 ) -> None :
78- # Private-attribute pragmatism: the SDK has no public events-enabled
79- # signal yet. Checked up front so disabled events never trigger
80- # network side effects (identity persistence, flag fetches).
77+ # The SDK has no public events-enabled signal; check first so
78+ # disabled events cause no network side effects.
8179 if getattr (self ._client , "_event_processor" , None ) is None :
8280 logger .debug (
8381 'Flagsmith events are disabled; dropping tracking event "%s".' ,
@@ -124,8 +122,7 @@ def _track(
124122 metadata = attributes or None ,
125123 )
126124 except ValueError :
127- # Raised when events are disabled (racing the check above) or the
128- # SDK rejects the event name.
125+ # Events disabled (racing the check above) or name rejected.
129126 logger .debug (
130127 'Flagsmith rejected tracking event "%s"; dropping it.' ,
131128 tracking_event_name ,
@@ -171,10 +168,8 @@ def _track_exposure(
171168 )
172169 return
173170
174- # Mirrors the SDK's get_experiment_flag guards, with the exposure
175- # attributed to the OF context's targeting key rather than any
176- # ambient identity. This resolution counts as a flag evaluation,
177- # exactly like get_experiment_flag itself.
171+ # Mirrors the SDK's get_experiment_flag guards, attributed to the
172+ # context's targeting key rather than any ambient identity.
178173 try :
179174 flag = self ._client .get_identity_flags (
180175 identifier = identifier ,
@@ -320,7 +315,7 @@ def _build_details(
320315 return FlagResolutionDetails (
321316 value = value ,
322317 reason = self ._parse_reason (flag , evaluation_context ),
323- # DefaultFlag has no `variant` attribute; never use bare access .
318+ # DefaultFlag has no `variant` attribute.
324319 variant = getattr (flag , "variant" , None ),
325320 flag_metadata = self ._build_flag_metadata (flag ),
326321 )
@@ -332,15 +327,12 @@ def _parse_reason(
332327 return Reason .DEFAULT
333328 if not flag .enabled :
334329 return Reason .DISABLED
335- # Offline documents may be arbitrarily old; the exposure hook treats
336- # anything but SPLIT as not fresh enough to record.
330+ # Offline documents may be arbitrarily old.
337331 if getattr (self ._client , "offline_mode" , False ):
338332 return Reason .STALE
339333 if evaluation_context .targeting_key :
340- # Engine taxonomy: a variant means a multivariate percentage-split
341- # assignment (SPLIT); TARGETING_MATCH is reserved for segment
342- # matches, which the API can't distinguish from environment
343- # defaults yet, so no-variant identity evaluations stay coarse.
334+ # A variant means a percentage-split assignment (SPLIT);
335+ # TARGETING_MATCH is reserved for segment matches.
344336 if getattr (flag , "variant" , None ) is not None :
345337 return Reason .SPLIT
346338 return Reason .TARGETING_MATCH
@@ -349,7 +341,7 @@ def _parse_reason(
349341 def _build_flag_metadata (
350342 self , flag : typing .Any
351343 ) -> typing .Dict [str , typing .Union [bool , int , str ]]:
352- # Keys are byte-identical with the JS provider (vendor-council aligned) .
344+ # Keys are byte-identical with the JS provider.
353345 metadata : typing .Dict [str , typing .Union [bool , int , str ]] = {
354346 "enabled" : flag .enabled
355347 }
@@ -369,8 +361,7 @@ def _extract_traits(
369361 if not evaluation_context or not evaluation_context .attributes :
370362 return None
371363 nested = evaluation_context .attributes .get ("traits" , {})
372- # `traits` is unpacked below; the flat `transient` key is an
373- # evaluation directive (see _is_transient), not a trait.
364+ # The flat `transient` key is an evaluation directive, not a trait.
374365 flat = {
375366 k : v
376367 for k , v in evaluation_context .attributes .items ()
0 commit comments