Skip to content

Commit 44b61a1

Browse files
committed
More in document; to v0.2.0
1 parent e0cbf1c commit 44b61a1

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

examples/document.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@
66
"paragraphs": [
77
{
88
"contents": "Blah blah blah"
9+
},
10+
{
11+
"contents": "Blah2"
912
}
1013
]
1114
},
12-
"Chapter 1": {}
15+
"Chapter 1": {
16+
"paragraphs": [
17+
{
18+
"contents": "More..."
19+
}
20+
]
21+
}
1322
}
1423
}
1524
}

examples/document.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ class Document(Base):
5454
doc.title = "My life in Python"
5555

5656
a = Section(id="Abstract")
57-
p = Paragraph(contents="Blah blah blah")
58-
a.paragraphs.append(p)
57+
a.paragraphs.append(Paragraph(contents="Blah blah blah"))
58+
a.paragraphs.append(Paragraph(contents="Blah2"))
5959
doc.sections.append(a)
60-
doc.sections.append(Section(id="Chapter 1"))
60+
61+
c1 = Section(id="Chapter 1")
62+
doc.sections.append(c1)
63+
c1.paragraphs.append(Paragraph(contents="More..."))
6164

6265
print(doc)
6366

examples/document.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ MyBook:
44
Abstract:
55
paragraphs:
66
- contents: Blah blah blah
7-
Chapter 1: {}
7+
- contents: Blah2
8+
Chapter 1:
9+
paragraphs:
10+
- contents: More...

src/modelspec/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.1.5"
1+
__version__ = "0.2.0"
22

33
from .base_types import Base, define, has, field, fields, optional, instance_of, in_
44

test_all.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ python document.py
99
cd ..
1010

1111
pytest tests
12+
13+
pre-commit run --all-files

0 commit comments

Comments
 (0)