Custom Query (121 matches)
Results (25 - 27 of 121)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #42 | wontfix | List objects are unhashable | xi | dfnord@… |
| Description |
Even though yaml specification allows lists ("flow collections on yaml jargon") to be keys, pyaml fails to use them, as lists are unhashable. For instance, loading "[1, 2]: something" gives the error "found unacceptable key (list objects are unhashable)" As a away around this, flow collections could be translated into a simple hasheable subclass of list, such as: class HasheableList(list):
#############################
## Public Methods
#############################
def __hash__(self):
return hash(tuple(self))
|
|||
| #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? |
|||
