@@ -123,14 +123,11 @@ def track(self, pb):
123123
124124 :param pb: Payload builder
125125 :type pb: payload
126- :rtype: tracker | list(int)
126+ :rtype: tracker
127127 """
128- results = [emitter .input (pb .nv_pairs ) for emitter in self .emitters ]
129- filtered = [res for res in results if res is not None ]
130- if filtered :
131- return filtered
132- else :
133- return self
128+ for emitter in self .emitters :
129+ emitter .input (pb .nv_pairs )
130+ return self
134131
135132 @contract
136133 def complete_payload (self , pb , context , tstamp ):
@@ -144,7 +141,7 @@ def complete_payload(self, pb, context, tstamp):
144141 :type context: list(dict(string:*)) | None
145142 :param tstamp: Optional user-provided timestamp for the event
146143 :type tstamp: int | float | None
147- :rtype: tracker | list(int)
144+ :rtype: tracker
148145 """
149146 pb .add ("eid" , Tracker .get_uuid ())
150147 pb .add ("dtm" , Tracker .get_timestamp (tstamp ))
@@ -169,7 +166,7 @@ def track_page_view(self, page_url, page_title=None, referrer=None, context=None
169166 :type referrer: string_or_none
170167 :param context: Custom context for the event
171168 :type context: list(dict(string:*)) | None
172- :rtype: tracker | list(int)
169+ :rtype: tracker
173170 """
174171 pb = payload .Payload ()
175172 pb .add ("e" , "pv" ) # pv: page view
@@ -204,7 +201,7 @@ def track_ecommerce_transaction_item(self, order_id, sku, price, quantity,
204201 :type currency: string_or_none
205202 :param context: Custom context for the event
206203 :type context: list(dict(string:*)) | None
207- :rtype: tracker | list(int)
204+ :rtype: tracker
208205 """
209206 pb = payload .Payload ()
210207 pb .add ("e" , "ti" )
@@ -247,7 +244,7 @@ def track_ecommerce_transaction(self, order_id, total_value,
247244 :type items: list(dict(str:*))
248245 :param context: Custom context for the event
249246 :type context: list(dict(string:*)) | None
250- :rtype: tracker | dict(string:*)
247+ :rtype: tracker
251248 """
252249 pb = payload .Payload ()
253250 pb .add ("e" , "tr" )
@@ -273,10 +270,7 @@ def track_ecommerce_transaction(self, order_id, total_value,
273270 item ["currency" ] = currency
274271 item_results .append (self .track_ecommerce_transaction_item (** item ))
275272
276- if not isinstance (transaction_result , Tracker ):
277- return {"transaction_result" : transaction_result , "item_results" : item_results }
278- else :
279- return self
273+ return self
280274
281275 @contract
282276 def track_screen_view (self , name = None , id_ = None , context = None , tstamp = None ):
@@ -287,7 +281,7 @@ def track_screen_view(self, name=None, id_=None, context=None, tstamp=None):
287281 :type id_: string_or_none
288282 :param context: Custom context for the event
289283 :type context: list(dict(string:*)) | None
290- :rtype: tracker | list(int)
284+ :rtype: tracker
291285 """
292286 screen_view_properties = {}
293287 if name is not None :
@@ -320,7 +314,7 @@ def track_struct_event(self, category, action, label=None, property_=None, value
320314 :type value: int | float | None
321315 :param context: Custom context for the event
322316 :type context: list(dict(string:*)) | None
323- :rtype: tracker | list(int)
317+ :rtype: tracker
324318 """
325319 pb = payload .Payload ()
326320 pb .add ("e" , "se" )
@@ -342,7 +336,7 @@ def track_unstruct_event(self, event_json, context=None, tstamp=None):
342336 :type event_json: dict(string: string | dict)
343337 :param context: Custom context for the event
344338 :type context: list(dict(string:*)) | None
345- :rtype: tracker | list(int)
339+ :rtype: tracker
346340 """
347341
348342 envelope = {"schema" : UNSTRUCT_EVENT_SCHEMA , "data" : event_json }
@@ -361,15 +355,14 @@ def flush(self, async=False):
361355
362356 :param async: Whether the flush is done asynchronously. Default is False
363357 :type async: bool
364- :rtype: tracker | list(int)
358+ :rtype: tracker
365359 """
366- if async :
367- for e in self .emitters :
368- e .flush ()
369- return self
370- else :
371- results = [emitter .sync_flush () for emitter in self .emitters ]
372- return [r for r in results if r is not None ]
360+ for emitter in self .emitters :
361+ if async :
362+ emitter .flush ()
363+ else :
364+ emitter .sync_flush ()
365+ return self
373366
374367 @contract
375368 def set_subject (self , subject ):
0 commit comments