Skip to content

Commit 30a3f22

Browse files
committed
feat(toggl): read/write a user info file
1 parent 2e45fe1 commit 30a3f22

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

notebooks/toggl-to-harvest.ipynb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9+
"import json\n",
910
"import os\n",
1011
"from pathlib import Path\n",
1112
"import pandas as pd\n",
@@ -24,7 +25,16 @@
2425
" Convert a string formatted duration (e.g. 01:30) to a timedelta.\n",
2526
" \"\"\"\n",
2627
" return pd.to_timedelta(pd.to_datetime(td, format=\"%H:%M:%S\").strftime(\"%H:%M:%S\"))\n",
27-
"\n"
28+
"\n",
29+
"\n",
30+
"def read_user_info():\n",
31+
" with open(USER_INFO_FILE, \"r\") as ui:\n",
32+
" return json.load(ui)\n",
33+
"\n",
34+
"\n",
35+
"def write_user_info(info):\n",
36+
" with open(USER_INFO_FILE, \"w\") as ui:\n",
37+
" json.dump(info, ui, indent=2)"
2838
]
2939
},
3040
{

0 commit comments

Comments
 (0)