Skip to content

Commit

Permalink
Merge f5bac5e into 64acda4
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Jul 2, 2021
2 parents 64acda4 + f5bac5e commit f4365d8
Show file tree
Hide file tree
Showing 14 changed files with 148 additions and 123 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
# 0.15.1 (2021-07-01)

- Fixed handling of no file extension to use YAML by default.

# 0.15 (2021-05-26)

- Removed `auto_load`/`auto_save` model options.
Expand Down
2 changes: 1 addition & 1 deletion datafiles/formats.py
Expand Up @@ -80,7 +80,7 @@ class YAML(Formatter):

@classmethod
def extensions(cls):
return {'.yml', '.yaml'}
return {'', '.yml', '.yaml'}

@classmethod
def deserialize(cls, file_object):
Expand Down
5 changes: 5 additions & 0 deletions datafiles/tests/test_formats.py
Expand Up @@ -12,6 +12,11 @@ def describe_serialize():
def data():
return {'key': "value", 'items': [1, 'a', None]}

def describe_default():
def it_uses_yaml_when_no_extension(expect, data):
text = formats.serialize(data, '')
expect(text).contains("key: value")

def describe_yaml():
def it_indents_blocks_by_default(expect, data):
text = formats.serialize(data, '.yaml')
Expand Down
22 changes: 11 additions & 11 deletions notebooks/file_inference.ipynb
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "0d70930e",
"id": "ca89e9e9",
"metadata": {
"tags": []
},
Expand All @@ -13,7 +13,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2b7fef04",
"id": "8f98d0f7",
"metadata": {
"tags": []
},
Expand All @@ -22,7 +22,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Writing files/sample.yml\n"
"Overwriting files/sample.yml\n"
]
}
],
Expand All @@ -40,7 +40,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "332c0881",
"id": "40f9ddf4",
"metadata": {
"tags": []
},
Expand All @@ -67,7 +67,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ba89cb72",
"id": "87188346",
"metadata": {
"tags": []
},
Expand All @@ -79,7 +79,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ced33fbc",
"id": "c4a08c5b",
"metadata": {
"tags": []
},
Expand All @@ -106,7 +106,7 @@
},
{
"cell_type": "markdown",
"id": "95b19dee",
"id": "6d775612",
"metadata": {
"tags": []
},
Expand All @@ -117,7 +117,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a46341e8",
"id": "2cb4efe6",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -175,7 +175,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "47641380",
"id": "24038452",
"metadata": {
"tags": []
},
Expand All @@ -189,7 +189,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "84874d7e",
"id": "83cb5ee3",
"metadata": {
"tags": []
},
Expand All @@ -201,7 +201,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "47520aec",
"id": "be55c2aa",
"metadata": {
"tags": []
},
Expand Down
24 changes: 12 additions & 12 deletions notebooks/format_options.ipynb
Expand Up @@ -3,7 +3,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "f1d2edfd",
"id": "214cd15c",
"metadata": {
"tags": []
},
Expand All @@ -17,7 +17,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "deea7e95",
"id": "c266bfbc",
"metadata": {
"tags": []
},
Expand All @@ -42,7 +42,7 @@
},
{
"cell_type": "markdown",
"id": "b0ef234f",
"id": "087383ee",
"metadata": {
"tags": []
},
Expand All @@ -53,7 +53,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d5b7cc47",
"id": "1145ddf5",
"metadata": {
"tags": []
},
Expand All @@ -71,7 +71,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d147486e",
"id": "ea87464a",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -108,7 +108,7 @@
},
{
"cell_type": "markdown",
"id": "1c9483c2",
"id": "d0f4ad4b",
"metadata": {
"tags": []
},
Expand All @@ -119,7 +119,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ba8ca2f4",
"id": "7667a0a4",
"metadata": {
"tags": []
},
Expand All @@ -137,7 +137,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e7a69a4b",
"id": "f6a88b70",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -169,7 +169,7 @@
},
{
"cell_type": "markdown",
"id": "fc1629c3",
"id": "26b77b70",
"metadata": {
"tags": []
},
Expand All @@ -180,7 +180,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "002dac5d",
"id": "9d44e25e",
"metadata": {
"tags": []
},
Expand All @@ -198,7 +198,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d82b5438",
"id": "f9217eec",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -228,7 +228,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "17a2dc10",
"id": "8038f68b",
"metadata": {
"tags": []
},
Expand Down
14 changes: 7 additions & 7 deletions notebooks/generic_types.ipynb
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "493ec4e5",
"id": "a426c08f",
"metadata": {
"tags": []
},
Expand All @@ -13,7 +13,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "979e4589",
"id": "0d5fd492",
"metadata": {
"tags": []
},
Expand All @@ -27,7 +27,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "f60245e0",
"id": "36e8e600",
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -73,7 +73,7 @@
},
{
"cell_type": "markdown",
"id": "8149f440",
"id": "ef61ad77",
"metadata": {
"tags": []
},
Expand All @@ -84,15 +84,15 @@
{
"cell_type": "code",
"execution_count": null,
"id": "35fef0b1",
"id": "552421bf",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"Dictish(contents=[<__main__.Pair object at 0x10d6e7790>, <__main__.Pair object at 0x10d6e7610>])"
"Dictish(contents=[<__main__.Pair object at 0x118807490>, <__main__.Pair object at 0x1188079d0>])"
]
},
"execution_count": null,
Expand All @@ -107,7 +107,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "796ad97b",
"id": "5245f90d",
"metadata": {
"tags": []
},
Expand Down

0 comments on commit f4365d8

Please sign in to comment.