Skip to content

Commit d04c5f6

Browse files
authored
Merge pull request #15 from ModECI/development
To 0.2.5 with fix for docstrings
2 parents 79f4663 + 6614cb3 commit d04c5f6

File tree

8 files changed

+23
-17
lines changed

8 files changed

+23
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,4 @@ cython_debug/
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162162
.idea/
163+
/examples/document.specification.bson

examples/document.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Document
2-
A model for documents
2+
A model for documents.
33

44
### Allowed parameters
55
<table>
@@ -38,7 +38,7 @@ A model for documents
3838
</table>
3939

4040
## Section
41-
A model of a section of the <a href="#document">Document</a>. Will contain one <a href="#paragraph">Paragraph</a> or more
41+
A model of a section of the <a href="#document">Document</a>. Will contain one <a href="#paragraph">Paragraph</a> or more.
4242

4343
### Allowed parameters
4444
<table>
@@ -63,7 +63,7 @@ A model of a section of the <a href="#document">Document</a>. Will contain one <
6363
</table>
6464

6565
## Paragraph
66-
A model of a paragraph
66+
A model of a paragraph.
6767

6868
### Allowed parameters
6969
<table>

examples/document.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@modelspec.define
1010
class Paragraph(Base):
1111
"""
12-
A model of a paragraph
12+
A model of a paragraph.
1313
1414
Args:
1515
contents: Paragraph contents, which make up the _Section_s.
@@ -21,7 +21,8 @@ class Paragraph(Base):
2121
@modelspec.define
2222
class Section(Base):
2323
"""
24-
A model of a section of the :class:`Document`. Will contain one :class:`Paragraph` or more
24+
A model of a section of the :class:`Document`.
25+
Will contain one :class:`Paragraph` or more.
2526
2627
Args:
2728
id: The id of the section
@@ -35,7 +36,7 @@ class Section(Base):
3536
@modelspec.define
3637
class Document(Base):
3738
"""
38-
A model for documents
39+
A model for documents.
3940
4041
Args:
4142
id: The unique id of the document

examples/document.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
========
22
Document
33
========
4-
A model for documents
4+
A model for documents.
55

66
**Allowed parameters**
77

@@ -24,7 +24,7 @@ Allowed child Data Type Description
2424
=======
2525
Section
2626
=======
27-
A model of a section of the <a href="#document">Document</a>. Will contain one <a href="#paragraph">Paragraph</a> or more
27+
A model of a section of the <a href="#document">Document</a>. Will contain one <a href="#paragraph">Paragraph</a> or more.
2828

2929
**Allowed parameters**
3030

@@ -45,7 +45,7 @@ Allowed child Data Type Description
4545
=========
4646
Paragraph
4747
=========
48-
A model of a paragraph
48+
A model of a paragraph.
4949

5050
**Allowed parameters**
5151

examples/document.specification.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Document": {
3-
"definition": "A model for documents",
3+
"definition": "A model for documents.",
44
"allowed_parameters": {
55
"id": {
66
"type": "str",
@@ -23,7 +23,7 @@
2323
}
2424
},
2525
"Section": {
26-
"definition": "A model of a section of the :class:`Document`. Will contain one :class:`Paragraph` or more",
26+
"definition": "A model of a section of the :class:`Document`. Will contain one :class:`Paragraph` or more.",
2727
"allowed_parameters": {
2828
"id": {
2929
"type": "str",
@@ -38,7 +38,7 @@
3838
}
3939
},
4040
"Paragraph": {
41-
"definition": "A model of a paragraph",
41+
"definition": "A model of a paragraph.",
4242
"allowed_parameters": {
4343
"contents": {
4444
"type": "str",

examples/document.specification.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Document:
2-
definition: A model for documents
2+
definition: A model for documents.
33
allowed_parameters:
44
id:
55
type: str
@@ -16,7 +16,7 @@ Document:
1616
description: The sections of the document
1717
Section:
1818
definition: A model of a section of the :class:`Document`. Will contain one :class:`Paragraph`
19-
or more
19+
or more.
2020
allowed_parameters:
2121
id:
2222
type: str
@@ -26,7 +26,7 @@ Section:
2626
type: Paragraph
2727
description: The paragraphs
2828
Paragraph:
29-
definition: A model of a paragraph
29+
definition: A model of a paragraph.
3030
allowed_parameters:
3131
contents:
3232
type: str

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.2.4"
1+
__version__ = "0.2.5"
22

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

src/modelspec/base_types.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,11 @@ def _parse_definition(cls) -> str:
373373
p = parse(cls.__doc__)
374374

375375
# Extract the description, use the long description if available.
376-
return p.long_description if p.long_description else p.short_description
376+
if p.long_description:
377+
definition = f"{p.short_description} {p.long_description}"
378+
else:
379+
definition = p.short_description
380+
return definition
377381

378382
@classmethod
379383
def _parse_allowed_fields(cls) -> Dict[str, Tuple[str, Any]]:

0 commit comments

Comments
 (0)