2020from baseplate .lib .events import DebugLogger
2121from baseplate .lib .events import EventLogger
2222from baseplate .lib .file_watcher import FileWatcher
23- from baseplate .lib .file_watcher import T
2423from baseplate .lib .file_watcher import WatchedFileNotAvailableError
2524from reddit_edgecontext import ValidatedAuthenticationToken
2625from rust_decider import Decider as RustDecider
@@ -62,33 +61,43 @@ class ExperimentConfig:
6261
6362
6463class DeciderContext :
65- """DeciderContext() is used to contain all fields necessary for
64+ """:code:` DeciderContext` is used to contain all fields necessary for
6665 bucketing, targeting, and overrides.
67- :code:`DeciderContext()` is populated in :code:`make_object_for_context()`.
66+ :code:`DeciderContext` is populated in :code:`make_object_for_context()`
67+
68+ :param user_id: user's t2 id
69+ :param device_id: device installation uuid
70+ :param country_code: 2-letter country codes
71+ :param locale: ISO 639-1 primary language subtag and an optional ISO 3166-1 alpha-2 region subtag
72+ :param user_is_employee:
73+ :param logged_in: is user logged in
74+ :param oauth_client_id: OAuth Client ID
75+ :param origin_service: Service where request originated
76+ :param cookie_created_timestamp: When the authentication cookie was created
77+ :param loid_created_timestamp: Epoch milliseconds when the current LoID cookie was created
78+ :param extracted_fields: Optional dict of additional fields, e.g. app_name & build_number
6879 """
6980
70- T = TypeVar ("T" )
71-
7281 def __init__ (
7382 self ,
7483 user_id : Optional [str ] = None ,
84+ device_id : Optional [str ] = None ,
7585 country_code : Optional [str ] = None ,
7686 locale : Optional [str ] = None ,
7787 user_is_employee : Optional [bool ] = None ,
7888 logged_in : Optional [bool ] = None ,
79- device_id : Optional [str ] = None ,
8089 oauth_client_id : Optional [str ] = None ,
8190 origin_service : Optional [str ] = None ,
8291 cookie_created_timestamp : Optional [float ] = None ,
8392 loid_created_timestamp : Optional [float ] = None ,
8493 extracted_fields : Optional [dict ] = None ,
8594 ):
8695 self ._user_id = user_id
96+ self ._device_id = device_id
8797 self ._country_code = country_code
8898 self ._locale = locale
8999 self ._user_is_employee = user_is_employee
90100 self ._logged_in = logged_in
91- self ._device_id = device_id
92101 self ._oauth_client_id = oauth_client_id
93102 self ._origin_service = origin_service
94103 self ._cookie_created_timestamp = cookie_created_timestamp
@@ -100,11 +109,11 @@ def to_dict(self) -> Dict:
100109
101110 return {
102111 "user_id" : self ._user_id ,
112+ "device_id" : self ._device_id ,
103113 "country_code" : self ._country_code ,
104114 "locale" : self ._locale ,
105115 "user_is_employee" : self ._user_is_employee ,
106116 "logged_in" : self ._logged_in ,
107- "device_id" : self ._device_id ,
108117 "oauth_client_id" : self ._oauth_client_id ,
109118 "origin_service" : self ._origin_service ,
110119 "cookie_created_timestamp" : self ._cookie_created_timestamp ,
@@ -175,6 +184,8 @@ class Decider:
175184 It will automatically reload the cache when changed.
176185 """
177186
187+ T = TypeVar ("T" )
188+
178189 def __init__ (
179190 self ,
180191 decider_context : DeciderContext ,
0 commit comments