Commit 9e40421
committed
create_from_yaml function deals with files only
Adding the ability to deal with strings containing yaml seems to repel
to much. So we stay with create_from_yaml with a bad name.
This removes the need fro StringIO to wrap strings.
Also note:
```
with open('foo.txt') as f:
y = yaml.safe_load_all(f)
for i in y:
print(i)
\# raises ValueError: I/O operation on closed file.
```
Hence, we indent the whole method body into the open block.
with open('foo.txt') as f:
y = yaml.safe_load_all(f)
for i in y:
print(i)1 parent ed67d89 commit 9e40421
1 file changed
Lines changed: 14 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 23 | | |
30 | 24 | | |
31 | 25 | | |
| |||
47 | 41 | | |
48 | 42 | | |
49 | 43 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 44 | | |
59 | 45 | | |
60 | 46 | | |
| |||
65 | 51 | | |
66 | 52 | | |
67 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
68 | 58 | | |
69 | 59 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 60 | + | |
75 | 61 | | |
76 | | - | |
| 62 | + | |
77 | 63 | | |
78 | | - | |
79 | | - | |
80 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
81 | 72 | | |
82 | 73 | | |
83 | 74 | | |
| |||
0 commit comments