Skip to content

Commit

Permalink
Add README's demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Dec 19, 2018
1 parent cc788f3 commit 3a7da65
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 34 deletions.
21 changes: 12 additions & 9 deletions notebooks/format_options.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
"cells": [
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%%sh\n",
"\n",
"rm -f files/format_options.*"
]
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -42,7 +43,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -66,7 +67,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand All @@ -93,7 +94,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -123,6 +124,7 @@
],
"source": [
"%%sh\n",
"\n",
"cat files/format_options.json"
]
},
Expand All @@ -135,7 +137,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -159,7 +161,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -183,7 +185,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -219,7 +221,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand All @@ -241,6 +243,7 @@
],
"source": [
"%%sh\n",
"\n",
"cat files/format_options.yml"
]
}
Expand Down
37 changes: 22 additions & 15 deletions notebooks/nested_dataclass.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%%sh\n",
"\n",
"rm -f files/nested_values.yml"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from dataclasses import dataclass\n",
"\n",
Expand All @@ -29,16 +40,6 @@
" bar: Nested"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"%%sh\n",
"rm -f files/nested_values.yml"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -55,9 +56,9 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: datafiles.managers: Saving data for object: Sample(foo=42, bar=Nested(alpha=1, beta=0))\n",
"INFO: datafiles.managers: Serialized data to text (.yml): 'foo: 42\\nbar:\\n alpha: true\\n beta: false\\n'\n",
"INFO: datafiles.managers: Writing: files/nested_dataclass.yml\n"
"INFO: datafiles.managers: Loading values for <class '__main__.Sample'> instance\n",
"INFO: datafiles.managers: Deserializing: files/nested_dataclass.yml\n",
"INFO: datafiles.managers: Loaded values for object: Sample(foo=42, bar=Nested(alpha=1, beta=0))\n"
]
}
],
Expand All @@ -77,12 +78,13 @@
"foo: 42\n",
"bar:\n",
" alpha: true\n",
" beta: false\n"
" beta: true\n"
]
}
],
"source": [
"%%sh\n",
"\n",
"cat files/nested_dataclass.yml"
]
},
Expand All @@ -102,7 +104,11 @@
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: datafiles.managers: Saving data for object: Sample(foo=42, bar=Nested(alpha=1, beta=1))\n",
"INFO: datafiles.managers: Loading values for <class '__main__.Sample'> instance\n",
"INFO: datafiles.managers: Deserializing: files/nested_dataclass.yml\n",
"INFO: datafiles.managers: Setting 'foo' value: 42\n",
"INFO: datafiles.managers: Loaded values for object: Sample(foo=42, bar=Nested(alpha=True, beta=True))\n",
"INFO: datafiles.managers: Saving data for object: Sample(foo=42, bar=Nested(alpha=True, beta=1))\n",
"INFO: datafiles.managers: Serialized data to text (.yml): 'foo: 42\\nbar:\\n alpha: true\\n beta: true\\n'\n",
"INFO: datafiles.managers: Writing: files/nested_dataclass.yml\n"
]
Expand Down Expand Up @@ -137,6 +143,7 @@
],
"source": [
"%%sh\n",
"\n",
"cat files/nested_dataclass.yml"
]
}
Expand Down
7 changes: 7 additions & 0 deletions notebooks/patched_containers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"outputs": [],
"source": [
"%%sh\n",
"\n",
"rm -f files/patched_containers.*"
]
},
Expand Down Expand Up @@ -88,6 +89,7 @@
],
"source": [
"%%sh\n",
"\n",
"cat files/patched_containers.yml"
]
},
Expand Down Expand Up @@ -128,6 +130,7 @@
],
"source": [
"%%sh\n",
"\n",
"cat files/patched_containers.yml"
]
},
Expand Down Expand Up @@ -167,6 +170,7 @@
],
"source": [
"%%sh\n",
"\n",
"cat files/patched_containers.yml"
]
},
Expand Down Expand Up @@ -216,6 +220,7 @@
],
"source": [
"%%sh\n",
"\n",
"cat files/patched_containers.yml"
]
},
Expand Down Expand Up @@ -259,6 +264,7 @@
],
"source": [
"%%sh\n",
"\n",
"cat files/patched_containers.yml"
]
},
Expand Down Expand Up @@ -311,6 +317,7 @@
],
"source": [
"%%sh\n",
"\n",
"cat files/patched_containers.yml"
]
}
Expand Down

0 comments on commit 3a7da65

Please sign in to comment.