this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at trunk 60 lines 1.7 kB view raw
1#!/usr/bin/env python3 2# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) 3# WARNING: This is a temporary copy of code from the cpython library to 4# facilitate bringup. Please file a task for anything you change! 5# flake8: noqa 6# fmt: off 7""" Python 'ascii' Codec 8 9 10Written by Marc-Andre Lemburg (mal@lemburg.com). 11 12(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. 13 14""" 15import codecs 16 17 18### Codec APIs 19 20class Codec(codecs.Codec): 21 22 # Note: Binding these as C functions will result in the class not 23 # converting them to methods. This is intended. 24 # TODO(T54587721): Revert change once we can bind builtins as static methods 25 # encode = codecs.ascii_encode 26 # decode = codecs.ascii_decode 27 encode = staticmethod(codecs.ascii_encode) 28 decode = staticmethod(codecs.ascii_decode) 29 30class IncrementalEncoder(codecs.IncrementalEncoder): 31 def encode(self, input, final=False): 32 return codecs.ascii_encode(input, self.errors)[0] 33 34class IncrementalDecoder(codecs.IncrementalDecoder): 35 def decode(self, input, final=False): 36 return codecs.ascii_decode(input, self.errors)[0] 37 38class StreamWriter(Codec,codecs.StreamWriter): 39 pass 40 41class StreamReader(Codec,codecs.StreamReader): 42 pass 43 44class StreamConverter(StreamWriter,StreamReader): 45 46 encode = codecs.ascii_decode 47 decode = codecs.ascii_encode 48 49### encodings module API 50 51def getregentry(): 52 return codecs.CodecInfo( 53 name='ascii', 54 encode=Codec.encode, 55 decode=Codec.decode, 56 incrementalencoder=IncrementalEncoder, 57 incrementaldecoder=IncrementalDecoder, 58 streamwriter=StreamWriter, 59 streamreader=StreamReader, 60 )