Custom Query (121 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (28 - 30 of 121)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Ticket Resolution Summary Owner Reporter
#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?

#147 fixed Loader and Dumper leave circular references around xi kristjan@…

Reported by kristjan@…, 5 years ago.

Description

In an environment where the gc module is turned off, having circular references is evil. When yaml.Loader and yaml.Dumper have finished processing a stream, they leave a bound method in their .state attribute. This causes the loaders and dumpers to stick around. We have patched this locally by doing, for example:

dumper=Dumper()
dumper.open()
try:
    for data in documents:
        dumper.represent(data)
    dumper.close()
finally:
    dumpter.state = dumper.states = None

Maybe there is a better way. Perhaps the Dumper and Loader should both have close() methods that clear the state. Another way would be to not keep instancemethods in state, but rather class methods and bind them to self at runtime.

#79 wontfix Multiple scalar values used as key creates Python hash error xi clay@…

Reported by clay@…, 7 years ago.

Description

The YAML specification suggests that a mapping can have a key made of more than one item, as in

? - Detroit Tigers
  - Chicago cubs
:
  - 2001-07-23

However, when that data is imported via yaml.load(), PyYAML exits with a yaml.constructor.ConstructorError?, saying "found unacceptable key (list objects are unhashable)"

Is there a way to force multi-value keys to be processed as tuples instead of lists?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Note: See TracQuery for help on using queries.