Changeset 328 for pyyaml/trunk/lib/yaml

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

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

Location:
pyyaml/trunk/lib/yaml
Files:
1 removed
4 modified

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/lib/yaml/emitter.py

    r313 r328  
    546546                    % (handle.encode('utf-8'))) 
    547547        for ch in handle[1:-1]: 
    548             if not (u'0' <= ch <= u'9' or u'A' <= ch <= 'Z' or u'a' <= ch <= 'z'    \ 
     548            if not (u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'  \ 
    549549                    or ch in u'-_'): 
    550550                raise EmitterError("invalid character %r in the tag handle: %r" 
     
    561561        while end < len(prefix): 
    562562            ch = prefix[end] 
    563             if u'0' <= ch <= u'9' or u'A' <= ch <= 'Z' or u'a' <= ch <= 'z'  \ 
     563            if u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'   \ 
    564564                    or ch in u'-;/?!:@&=+$,_.~*\'()[]': 
    565565                end += 1 
     
    591591        while end < len(suffix): 
    592592            ch = suffix[end] 
    593             if u'0' <= ch <= u'9' or u'A' <= ch <= 'Z' or u'a' <= ch <= 'z'  \ 
     593            if u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'   \ 
    594594                    or ch in u'-;/?:@&=+$,_.~*\'()[]'   \ 
    595595                    or (ch == u'!' and handle != u'!'): 
     
    614614            raise EmitterError("anchor must not be empty") 
    615615        for ch in anchor: 
    616             if not (u'0' <= ch <= u'9' or u'A' <= ch <= 'Z' or u'a' <= ch <= 'z'    \ 
     616            if not (u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'  \ 
    617617                    or ch in u'-_'): 
    618618                raise EmitterError("invalid character %r in the anchor: %r" 
  • pyyaml/trunk/lib/yaml/representer.py

    r248 r328  
    287287SafeRepresenter.add_representer(datetime.date, 
    288288        SafeRepresenter.represent_date) 
     289 
    289290SafeRepresenter.add_representer(datetime.datetime, 
    290291        SafeRepresenter.represent_datetime) 
  • pyyaml/trunk/lib/yaml/resolver.py

    r260 r328  
    193193        u'tag:yaml.org,2002:merge', 
    194194        re.compile(ur'^(?:<<)$'), 
    195         ['<']) 
     195        [u'<']) 
    196196 
    197197Resolver.add_implicit_resolver( 
     
    214214        u'tag:yaml.org,2002:value', 
    215215        re.compile(ur'^(?:=)$'), 
    216         ['=']) 
     216        [u'=']) 
    217217 
    218218# The following resolver is only for documentation purposes. It cannot work 
  • pyyaml/trunk/lib/yaml/scanner.py

    r222 r328  
    808808        length = 0 
    809809        ch = self.peek(length) 
    810         while u'0' <= ch <= u'9' or u'A' <= ch <= 'Z' or u'a' <= ch <= 'z'  \ 
     810        while u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'    \ 
    811811                or ch in u'-_': 
    812812            length += 1 
     
    847847        # See the specification for details. 
    848848        ch = self.peek() 
    849         if not (u'0' <= ch <= '9'): 
     849        if not (u'0' <= ch <= u'9'): 
    850850            raise ScannerError("while scanning a directive", start_mark, 
    851851                    "expected a digit, but found %r" % ch.encode('utf-8'), 
     
    913913        start_mark = self.get_mark() 
    914914        indicator = self.peek() 
    915         if indicator == '*': 
     915        if indicator == u'*': 
    916916            name = 'alias' 
    917917        else: 
     
    920920        length = 0 
    921921        ch = self.peek(length) 
    922         while u'0' <= ch <= u'9' or u'A' <= ch <= 'Z' or u'a' <= ch <= 'z'  \ 
     922        while u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'    \ 
    923923                or ch in u'-_': 
    924924            length += 1 
     
    13691369        ch = self.peek(length) 
    13701370        if ch != u' ': 
    1371             while u'0' <= ch <= u'9' or u'A' <= ch <= 'Z' or u'a' <= ch <= 'z'  \ 
     1371            while u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'    \ 
    13721372                    or ch in u'-_': 
    13731373                length += 1 
     
    13891389        length = 0 
    13901390        ch = self.peek(length) 
    1391         while u'0' <= ch <= u'9' or u'A' <= ch <= 'Z' or u'a' <= ch <= 'z'  \ 
     1391        while u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'    \ 
    13921392                or ch in u'-;/?:@&=+$,_.!~*\'()[]%': 
    13931393            if ch == u'%':