Custom Query (121 matches)
Results (85 - 87 of 121)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #48 | wontfix | yaml.load does not call __init__ of objects | xi | aymanbahrain@… |
| Description |
I noticed that my init code is not called when an object is created via yaml.load. Try this one: In this example, fy.secret will raise an error about secret not an attribute of fy object. import yaml
class Field:
def __init__(self):
print 'init called'
self.secret = 'password'
f = Field()
print f.secret
fy = yaml.load(file('fld.yaml', 'r'))
print fy.hide_value
print fy.secret
have fld.yaml contain:
!!python/object:__main__.Field
hide_value: true
|
|||
| #58 | wontfix | Is there a way?? | xi | john.mcginnis@… |
| Description |
a = yaml.load("""
name: John
number: 111
""")
print a
{'name': 'John', 'number': 111}
ok so if I do: print yaml.dump(a)
{name: John, number: 11}
and print yaml.dump(a, default_flow_style=False) name: John number: 111 My question is, is there a variable in the code that could make the block style the default output without having to reference the style preference all the time? |
|||
| #68 | wontfix | PyYAML don't load datetime objects dumped with PySyck | xi | miki@… |
| Description |
>>> from datetime import datetime
>>> now = datetime.now()
>>> import syck
>>> a = {"t": now}
>>> yaml.load(syck.dump(a))
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
lib.yaml.load(syck.dump(a))
File "yaml/__init__.py", line 66, in load
File "yaml/constructor.py", line 38, in get_data
File "yaml/constructor.py", line 46, in construct_document
File "yaml/constructor.py", line 394, in construct_yaml_map
File "yaml/constructor.py", line 207, in construct_mapping
File "yaml/constructor.py", line 132, in construct_mapping
File "yaml/constructor.py", line 87, in construct_object
File "yaml/constructor.py", line 410, in construct_undefined
ConstructorError: could not determine a constructor for the tag '!timestamp'
in "<string>", line 2, column 4:
t: !timestamp 2007-10-19T14:08:44.5 ...
^
|
|||
Note: See TracQuery
for help on using queries.
