Ignore:
Timestamp:
12/29/08 12:24:05 (6 years ago)
Author:
xi
Message:

Added basic support for Python 3 (Thanks idadesub(at)users(dot)sourceforge(dot)net).

Location:
pyyaml/trunk/lib3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/lib3/yaml/composer.py

    r258 r328  
    22__all__ = ['Composer', 'ComposerError'] 
    33 
    4 from error import MarkedYAMLError 
    5 from events import * 
    6 from nodes import * 
     4from .error import MarkedYAMLError 
     5from .events import * 
     6from .nodes import * 
    77 
    88class ComposerError(MarkedYAMLError): 
    99    pass 
    1010 
    11 class Composer(object): 
     11class Composer: 
    1212 
    1313    def __init__(self): 
     
    6767            if anchor not in self.anchors: 
    6868                raise ComposerError(None, None, "found undefined alias %r" 
    69                         % anchor.encode('utf-8'), event.start_mark) 
     69                        % anchor, event.start_mark) 
    7070            return self.anchors[anchor] 
    7171        event = self.peek_event() 
     
    7474            if anchor in self.anchors: 
    7575                raise ComposerError("found duplicate anchor %r; first occurence" 
    76                         % anchor.encode('utf-8'), self.anchors[anchor].start_mark, 
     76                        % anchor, self.anchors[anchor].start_mark, 
    7777                        "second occurence", event.start_mark) 
    7878        self.descend_resolver(parent, index) 
     
    8989        event = self.get_event() 
    9090        tag = event.tag 
    91         if tag is None or tag == u'!': 
     91        if tag is None or tag == '!': 
    9292            tag = self.resolve(ScalarNode, event.value, event.implicit) 
    9393        node = ScalarNode(tag, event.value, 
     
    100100        start_event = self.get_event() 
    101101        tag = start_event.tag 
    102         if tag is None or tag == u'!': 
     102        if tag is None or tag == '!': 
    103103            tag = self.resolve(SequenceNode, None, start_event.implicit) 
    104104        node = SequenceNode(tag, [], 
     
    118118        start_event = self.get_event() 
    119119        tag = start_event.tag 
    120         if tag is None or tag == u'!': 
     120        if tag is None or tag == '!': 
    121121            tag = self.resolve(MappingNode, None, start_event.implicit) 
    122122        node = MappingNode(tag, [], 
Note: See TracChangeset for help on using the changeset viewer.