Skip to content

Commit bf070a3

Browse files
committed
Made contract type constraints more consistent
"Using string_or_none" rather than "non_empty_string | None"
1 parent 3612851 commit bf070a3

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

CHANGES.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Started sending event vendor parameter through on querystring (#55)
99
Changed track screen view to use an unstructured event (#53)
1010
Added ability to name individual instances of the Python Tracker (#52)
1111
Validated GET payload in all integration tests (#33) (TODO)
12-
Added support for Python 3.2 (#41) (TODO)
1312
Added support for Python 2.7 (#42)
1413
Fixed versions in requirements.txt (#47)
1514
Added platform and tracker version to payload (#50)

snowplow_tracker/tracker.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def set_platform(self, value):
130130
def set_user_id(self, user_id):
131131
"""
132132
:param user_id: User ID
133-
:type user_id: str
133+
:type user_id: non_empty_string
134134
"""
135135
self.standard_nv_pairs["uid"] = user_id
136136

@@ -214,11 +214,11 @@ def track(self, pb, snowplow_schema=True):
214214
def track_page_view(self, page_url, page_title=None, referrer=None, tstamp=None):
215215
"""
216216
:param page_url: URL of the viewed page
217-
:type page_url: non_empty_string | None
217+
:type page_url: non_empty_string
218218
:param page_title: Title of the viewed page
219-
:type page_title: non_empty_string | None
219+
:type page_title: string_or_none
220220
:param referrer: Referrer of the page
221-
:type referrer: non_empty_string | None
221+
:type referrer: string_or_none
222222
"""
223223
pb = payload.Payload(tstamp)
224224
pb.add("e", "pv") # pv: page view
@@ -276,9 +276,9 @@ def track_ecommerce_transaction_item(self, ti_id, ti_sku, ti_price, ti_quantity,
276276
:param ti_quantity: Item quantity
277277
:type ti_quantity: int
278278
:param ti_name: Item name
279-
:type ti_name: non_empty_string | None
279+
:type ti_name: string_or_none
280280
:param ti_category: Item category
281-
:type ti_category: non_empty_string | None
281+
:type ti_category: string_or_none
282282
"""
283283
pb = payload.Payload(tstamp)
284284
pb.add("e", "ti")
@@ -296,7 +296,7 @@ def track_screen_view(self, name, id_=None, tstamp=None):
296296
:param name: The name of the screen view event
297297
:type name: non_empty_string
298298
:param id_: Screen view ID
299-
:type id_: non_empty_string | None
299+
:type id_: string_or_none
300300
"""
301301
return self.track_unstruct_event("screen_view", {"name": name, "id": id_}, tstamp, True)
302302

@@ -310,10 +310,10 @@ def track_struct_event(self, category, action, label=None, property_=None, value
310310
:type action: non_empty_string
311311
:param label: Refer to the object the action is
312312
performed on
313-
:type label: non_empty_string | None
313+
:type label: string_or_none
314314
:param property_: Property associated with either the action
315315
or the object
316-
:type property_: non_empty_string | None
316+
:type property_: string_or_none
317317
:param value: A value associated with the user action
318318
:type value: int | float | None
319319
"""

0 commit comments

Comments
 (0)