Custom Query (121 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (49 - 51 of 121)

Ticket Resolution Summary Owner Reporter
#58 wontfix Is there a way?? xi john.mcginnis@…

Reported by john.mcginnis@…, 7 years ago.

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?

#59 worksforme Load yaml data as utf-8 strings into a dictionary xi dukebody@…

Reported by dukebody@…, 7 years ago.

Description

Hello, I'm looking for support, but I don't know if this is the right place to ask.

I'm using PyYAML to load some nested data from an utf-8 encoded file in Python with:

import yaml
stream=file('data.yaml','r')
data=yaml.load(stream)

The data variable becomes a dictionary with unicode values where is needed. What I want is to put utf-8 strings instead of unicode values to use this data with another library: Cheetah. If I try to use the unicode-type dictionary generated by default with PyYAML I get an UnicodeDecodeError, because de Cheetah strings are in iso-8859-15 and Python tries to decode them to Unicode using ASCII charset tables, so it obiously fails.

Is there any way to get an utf-8 coded dictionary?

#60 fixed Error loading timestamps xi miki@…

Reported by miki@…, 7 years ago.

Description

Try the following script:

#!/usr/bin/env python

import syck
from datetime import datetime

for i in range(10000):
    now = datetime.now()
    dumped = syck.dump(now)
    loaded = syck.load(dumped)
    if now != loaded:
        print "original:", now
        print "result:", loaded
        print "dump:", dumped
        break

I get:

original: 2007-09-17 11:04:08.091612
result: 2007-09-17 11:04:08.916120
dump: --- !timestamp 2007-09-17T11:04:08.091612

The YAML looks OK, so the parsing is wrong.

Note: See TracQuery for help on using queries.