~inkscape.dev/inkscape-devlibs/trunk

« back to all changes in this revision

Viewing changes to python/Lib/encodings/undefined.py

  • Committer: Eduard Braun
  • Date: 2016-10-22 16:54:41 UTC
  • Revision ID: eduard.braun2@gmx.de-20161022165441-gfp6agtut9nh4p22
Update Python to version 2.7.12

Included modules:
  coverage 4.2
  lxml 3.6.4
  numpy 1.11.2
  scour 0.35
  six 1.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
""" Python 'undefined' Codec
2
 
 
3
 
    This codec will always raise a ValueError exception when being
4
 
    used. It is intended for use by the site.py file to switch off
5
 
    automatic string to Unicode coercion.
6
 
 
7
 
Written by Marc-Andre Lemburg (mal@lemburg.com).
8
 
 
9
 
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
10
 
 
11
 
"""
12
 
import codecs
13
 
 
14
 
### Codec APIs
15
 
 
16
 
class Codec(codecs.Codec):
17
 
 
18
 
    def encode(self,input,errors='strict'):
19
 
        raise UnicodeError("undefined encoding")
20
 
 
21
 
    def decode(self,input,errors='strict'):
22
 
        raise UnicodeError("undefined encoding")
23
 
 
24
 
class IncrementalEncoder(codecs.IncrementalEncoder):
25
 
    def encode(self, input, final=False):
26
 
        raise UnicodeError("undefined encoding")
27
 
 
28
 
class IncrementalDecoder(codecs.IncrementalDecoder):
29
 
    def decode(self, input, final=False):
30
 
        raise UnicodeError("undefined encoding")
31
 
 
32
 
class StreamWriter(Codec,codecs.StreamWriter):
33
 
    pass
34
 
 
35
 
class StreamReader(Codec,codecs.StreamReader):
36
 
    pass
37
 
 
38
 
### encodings module API
39
 
 
40
 
def getregentry():
41
 
    return codecs.CodecInfo(
42
 
        name='undefined',
43
 
        encode=Codec().encode,
44
 
        decode=Codec().decode,
45
 
        incrementalencoder=IncrementalEncoder,
46
 
        incrementaldecoder=IncrementalDecoder,
47
 
        streamwriter=StreamWriter,
48
 
        streamreader=StreamReader,
49
 
    )
 
1
""" Python 'undefined' Codec
 
2
 
 
3
    This codec will always raise a ValueError exception when being
 
4
    used. It is intended for use by the site.py file to switch off
 
5
    automatic string to Unicode coercion.
 
6
 
 
7
Written by Marc-Andre Lemburg (mal@lemburg.com).
 
8
 
 
9
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
 
10
 
 
11
"""
 
12
import codecs
 
13
 
 
14
### Codec APIs
 
15
 
 
16
class Codec(codecs.Codec):
 
17
 
 
18
    def encode(self,input,errors='strict'):
 
19
        raise UnicodeError("undefined encoding")
 
20
 
 
21
    def decode(self,input,errors='strict'):
 
22
        raise UnicodeError("undefined encoding")
 
23
 
 
24
class IncrementalEncoder(codecs.IncrementalEncoder):
 
25
    def encode(self, input, final=False):
 
26
        raise UnicodeError("undefined encoding")
 
27
 
 
28
class IncrementalDecoder(codecs.IncrementalDecoder):
 
29
    def decode(self, input, final=False):
 
30
        raise UnicodeError("undefined encoding")
 
31
 
 
32
class StreamWriter(Codec,codecs.StreamWriter):
 
33
    pass
 
34
 
 
35
class StreamReader(Codec,codecs.StreamReader):
 
36
    pass
 
37
 
 
38
### encodings module API
 
39
 
 
40
def getregentry():
 
41
    return codecs.CodecInfo(
 
42
        name='undefined',
 
43
        encode=Codec().encode,
 
44
        decode=Codec().decode,
 
45
        incrementalencoder=IncrementalEncoder,
 
46
        incrementaldecoder=IncrementalDecoder,
 
47
        streamwriter=StreamWriter,
 
48
        streamreader=StreamReader,
 
49
    )