Skip to content

Commit 730bf2a

Browse files
committed
Add version attribute
1 parent c6f37e6 commit 730bf2a

File tree

8 files changed

+37
-21
lines changed

8 files changed

+37
-21
lines changed

examples/neuroml2/NeuroML2.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ Some description...
1010
</tr>
1111

1212

13+
<tr>
14+
<td><b>version</b></td>
15+
<td>str</td>
16+
<td><i>NeuroML version used</i></td>
17+
</tr>
18+
19+
1320
</table>
1421

1522
### Allowed children

examples/neuroml2/NeuroML2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Some description...
99
Allowed field Data Type Description
1010
=============== =========== ================================
1111
**id** str The id of the NeuroML 2 document
12+
**version** str NeuroML version used
1213
=============== =========== ================================
1314

1415
**Allowed children**

examples/neuroml2/NeuroML2.specification.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{
22
"NeuroML": {
3-
"definition": "Some description... ",
3+
"definition": "Some description...",
44
"allowed_parameters": {
55
"id": {
66
"type": "str",
77
"description": "The id of the NeuroML 2 document"
8+
},
9+
"version": {
10+
"type": "str",
11+
"description": "NeuroML version used"
812
}
913
},
1014
"allowed_children": {
@@ -15,7 +19,7 @@
1519
}
1620
},
1721
"Network": {
18-
"definition": "Some description... ",
22+
"definition": "Some description...",
1923
"allowed_parameters": {
2024
"id": {
2125
"type": "str",
@@ -30,7 +34,7 @@
3034
}
3135
},
3236
"Population": {
33-
"definition": "Some description... ",
37+
"definition": "Some description...",
3438
"allowed_parameters": {
3539
"id": {
3640
"type": "str",
@@ -46,4 +50,4 @@
4650
}
4751
}
4852
}
49-
}
53+
}

examples/neuroml2/NeuroML2.specification.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
NeuroML:
2-
definition: 'Some description... '
2+
definition: Some description...
33
allowed_parameters:
44
id:
55
type: str
66
description: The id of the NeuroML 2 document
7+
version:
8+
type: str
9+
description: NeuroML version used
710
allowed_children:
811
networks:
912
type: Network
1013
description: The networks present
1114
Network:
12-
definition: 'Some description... '
15+
definition: Some description...
1316
allowed_parameters:
1417
id:
1518
type: str
@@ -19,7 +22,7 @@ Network:
1922
type: Population
2023
description: the pops in the net
2124
Population:
22-
definition: 'Some description... '
25+
definition: Some description...
2326
allowed_parameters:
2427
id:
2528
type: str

examples/neuroml2/TestNeuroML.bson

26 Bytes
Binary file not shown.

examples/neuroml2/TestNeuroML.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"TestNeuroML": {
3+
"version": "NeuroML_v2.3",
34
"networks": {
45
"net0": {
56
"populations": {
@@ -11,4 +12,4 @@
1112
}
1213
}
1314
}
14-
}
15+
}

examples/neuroml2/TestNeuroML.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
TestNeuroML:
2+
version: NeuroML_v2.3
23
networks:
34
net0:
45
populations:

examples/neuroml2/neuroml2_spec.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@modelspec.define
1010
class Population(Base):
1111
"""
12-
Some description...
12+
Some description...
1313
1414
Args:
1515
id: The id of the population
@@ -21,10 +21,11 @@ class Population(Base):
2121
component: str = field(default=None, validator=optional(instance_of(str)))
2222
size: int = field(default=None, validator=optional(instance_of(int)))
2323

24+
2425
@modelspec.define
2526
class Network(Base):
2627
"""
27-
Some description...
28+
Some description...
2829
2930
Args:
3031
id: The id of the network
@@ -39,21 +40,23 @@ class Network(Base):
3940
@modelspec.define
4041
class NeuroML(Base):
4142
"""
42-
Some description...
43+
Some description...
4344
4445
Args:
4546
id: The id of the NeuroML 2 document
47+
version: NeuroML version used
4648
networks: The networks present
4749
"""
4850

4951
id: str = field(validator=instance_of(str))
52+
version: str = field(validator=instance_of(str))
5053

5154
networks: List[Network] = field(factory=list)
5255

5356

54-
if __name__ == '__main__':
57+
if __name__ == "__main__":
5558

56-
nml_doc = NeuroML(id="TestNeuroML")
59+
nml_doc = NeuroML(id="TestNeuroML", version="NeuroML_v2.3")
5760
net = Network(id="net0")
5861
nml_doc.networks.append(net)
5962

@@ -62,28 +65,25 @@ class NeuroML(Base):
6265
print(nml_doc)
6366
print(nml_doc.id)
6467

65-
nml_doc.to_json_file("%s.json"%nml_doc.id)
66-
nml_doc.to_yaml_file("%s.yaml"%nml_doc.id)
67-
nml_doc.to_bson_file("%s.bson"%nml_doc.id)
68-
#nml_doc.to_xml_file("%s.xml"%nml_doc.id)
68+
nml_doc.to_json_file("%s.json" % nml_doc.id)
69+
nml_doc.to_yaml_file("%s.yaml" % nml_doc.id)
70+
nml_doc.to_bson_file("%s.bson" % nml_doc.id)
71+
# nml_doc.to_xml_file("%s.xml"%nml_doc.id)
6972

7073
print(" >> Full document details in YAML format:\n")
7174

7275
print(nml_doc.to_yaml())
7376

74-
7577
doc_md = nml_doc.generate_documentation(format="markdown")
7678

7779
with open("NeuroML2.md", "w") as d:
7880
d.write(doc_md)
7981

80-
8182
doc_rst = nml_doc.generate_documentation(format="rst")
8283

8384
with open("NeuroML2.rst", "w") as d:
8485
d.write(doc_rst)
8586

86-
8787
print("\n >> Generating specification in dict form...")
8888
doc_dict = nml_doc.generate_documentation(format="dict")
8989

@@ -99,4 +99,3 @@ class NeuroML(Base):
9999
yy = yaml.dump(doc_dict, indent=4, sort_keys=False)
100100
print(yy)
101101
d.write(yy)
102-

0 commit comments

Comments
 (0)