File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -214,16 +214,16 @@ def _find_or_create_user_id():
214214 ):
215215 uid = generate_id ()
216216 if new .exists ():
217- uid = new .read_text (encoding = "utf8" ). strip ()
217+ uid = json . load ( new .open (encoding = "utf8" ))[ "user_id" ]
218218 else :
219219 if old .exists ():
220220 uid = json .load (old .open (encoding = "utf8" ))["user_id" ]
221- new . write_text ( uid , encoding = "utf8" )
221+ json . dump ({ "user_id" : uid }, new . open ( "w" , encoding = "utf8" ) )
222222
223223 # only for non-DVC packages,
224224 # write legacy file in case legacy DVC is installed later
225225 if not old .exists () and uid .lower () != "do-not-track" :
226- old . write_text ( f'{{ "user_id": " { uid } "}}' , encoding = "utf8" )
226+ json . dump ({ "user_id" : uid }, old . open ( "w" , encoding = "utf8" ) )
227227
228228 return uid
229229 except Timeout :
You can’t perform that action at this time.
0 commit comments