|
@@ -36,6 +36,35 @@ Person(alice-mother, Carol Test, *1992-10-26)
|
|
|
|
|
|
```
|
|
|
|
|
|
+#### Multiple YAML Files
|
|
|
+
|
|
|
+```python
|
|
|
+>>> alice_yaml = '''
|
|
|
+... !person
|
|
|
+... identifier: alice
|
|
|
+... name: Alice Test
|
|
|
+... birth_date: 2019-12-23
|
|
|
+... mother: carol
|
|
|
+... '''
|
|
|
+>>> carol_yaml = '''
|
|
|
+... !person
|
|
|
+... identifier: carol
|
|
|
+... name: Carol Test
|
|
|
+... birth_date: 1992-10-26
|
|
|
+... '''
|
|
|
+>>> collection = yamily.PersonCollection()
|
|
|
+>>> for person_yaml in [alice_yaml, carol_yaml]:
|
|
|
+... person = yaml.load(person_yaml, Loader=yamily.yaml.Loader)
|
|
|
+... collection.add_person(person)
|
|
|
+Person(alice, Alice Test, *2019-12-23)
|
|
|
+Person(carol, Carol Test, *1992-10-26)
|
|
|
+>>> collection['alice'].mother
|
|
|
+Person(carol, Carol Test, *1992-10-26)
|
|
|
+>>> collection['carol'] is collection['alice'].mother
|
|
|
+True
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
### Export YAML
|
|
|
|
|
|
```python
|