Python codecs 模块,latin_1_encode() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用codecs.latin_1_encode()

项目:vcfpy    作者:bihealth    | 项目源码 | 文件源码
def write(self, data):
        # TODO - Check bytes vs unicode
        if isinstance(data, str):
            data = codecs.latin_1_encode(data)[0]
        # block_size = 2**16 = 65536
        data_len = len(data)
        if len(self._buffer) + data_len < 65536:
            # print("Cached %r" % data)
            self._buffer += data
            return
        else:
            # print("Got %r, writing out some data..." % data)
            self._buffer += data
            while len(self._buffer) >= 65536:
                self._write_block(self._buffer[:65536])
                self._buffer = self._buffer[65536:]
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:kinect-2-libras    作者:inessadl    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:oscars2016    作者:0x0ece    | 项目源码 | 文件源码
def b(s):
        return codecs.latin_1_encode(s)[0]
项目:mongodb-monitoring    作者:jruaux    | 项目源码 | 文件源码
def b(s):
        # BSON and socket operations deal in binary data. In
        # python 3 that means instances of `bytes`. In python
        # 2.6 and 2.7 you can create an alias for `bytes` using
        # the b prefix (e.g. b'foo').
        # See http://python3porting.com/problems.html#nicer-solutions
        return codecs.latin_1_encode(s)[0]
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def b(s):
        # BSON and socket operations deal in binary data. In
        # python 3 that means instances of `bytes`. In python
        # 2.6 and 2.7 you can create an alias for `bytes` using
        # the b prefix (e.g. b'foo'). Python 2.4 and 2.5 don't
        # provide this marker so we provide this compat function.
        # In python 3.x b('foo') results in b'foo'.
        # See http://python3porting.com/problems.html#nicer-solutions
        return codecs.latin_1_encode(s)[0]
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def b(s):
        # BSON and socket operations deal in binary data. In
        # python 3 that means instances of `bytes`. In python
        # 2.6 and 2.7 you can create an alias for `bytes` using
        # the b prefix (e.g. b'foo'). Python 2.4 and 2.5 don't
        # provide this marker so we provide this compat function.
        # In python 3.x b('foo') results in b'foo'.
        # See http://python3porting.com/problems.html#nicer-solutions
        return codecs.latin_1_encode(s)[0]
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def b(s):
        # BSON and socket operations deal in binary data. In
        # python 3 that means instances of `bytes`. In python
        # 2.6 and 2.7 you can create an alias for `bytes` using
        # the b prefix (e.g. b'foo'). Python 2.4 and 2.5 don't
        # provide this marker so we provide this compat function.
        # In python 3.x b('foo') results in b'foo'.
        # See http://python3porting.com/problems.html#nicer-solutions
        return codecs.latin_1_encode(s)[0]
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def b(s):
        # BSON and socket operations deal in binary data. In
        # python 3 that means instances of `bytes`. In python
        # 2.6 and 2.7 you can create an alias for `bytes` using
        # the b prefix (e.g. b'foo'). Python 2.4 and 2.5 don't
        # provide this marker so we provide this compat function.
        # In python 3.x b('foo') results in b'foo'.
        # See http://python3porting.com/problems.html#nicer-solutions
        return codecs.latin_1_encode(s)[0]
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:llk    作者:Tycx2ry    | 项目源码 | 文件源码
def _to_bytes_impl(msg):
    if isinstance(msg, str):
      return codecs.latin_1_encode(msg, 'replace')[0]
    else:
      return msg
项目:llk    作者:Tycx2ry    | 项目源码 | 文件源码
def _to_bytes_impl(msg):
    if msg is not None and isinstance(msg, str_type):
      return codecs.latin_1_encode(msg, 'replace')[0]
    else:
      return msg
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:spiderfoot    作者:wi-fi-analyzer    | 项目源码 | 文件源码
def _to_bytes_impl(msg):
    if isinstance(msg, str):
      return codecs.latin_1_encode(msg, 'replace')[0]
    else:
      return msg
项目:spiderfoot    作者:wi-fi-analyzer    | 项目源码 | 文件源码
def _to_bytes_impl(msg):
    if msg is not None and isinstance(msg, str_type):
      return codecs.latin_1_encode(msg, 'replace')[0]
    else:
      return msg
项目:eyeD3    作者:nicfit    | 项目源码 | 文件源码
def b(x, encoder=None):
    if isinstance(x, BytesType):
        return x
    else:
        import codecs
        encoder = encoder or codecs.latin_1_encode
        return encoder(x)[0]
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:ambient-jenkins-statuuus    作者:polandy    | 项目源码 | 文件源码
def encode(x):
        return codecs.latin_1_encode(x)[0]
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:habilitacion    作者:GabrielBD    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:Orator-Google-App-Engine    作者:MakarenaLabs    | 项目源码 | 文件源码
def b(s):
        return codecs.latin_1_encode(s)[0]
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:threatdetectionservice    作者:flyballlabs    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:Indushell    作者:SecarmaLabs    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:Liljimbo-Chatbot    作者:chrisjim316    | 项目源码 | 文件源码
def b(s):
        return codecs.latin_1_encode(s)[0]
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def b(s):
        return codecs.latin_1_encode(s)[0]
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:news-for-good    作者:thecodinghub    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:CaScale    作者:Thatsillogical    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:jak    作者:dispel    | 项目源码 | 文件源码
def b(x):
        if isinstance(x, six.binary_type):
            return x
        else:
            return codecs.latin_1_encode(x)[0]
项目:pyetje    作者:rorlika    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:respeaker_virtualenv    作者:respeaker    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:Tencent_Cartoon_Download    作者:Fretice    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:infinite-lorem-ipsum    作者:patjm1992    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:fieldsight-kobocat    作者:awemulya    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:chalktalk_docs    作者:loremIpsum1771    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:python-group-proj    作者:Sharcee    | 项目源码 | 文件源码
def b(s):
        return codecs.latin_1_encode(s)[0]
项目:python-group-proj    作者:Sharcee    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]
项目:covar_me_app    作者:CovarMe    | 项目源码 | 文件源码
def b(s):
        # BSON and socket operations deal in binary data. In
        # python 3 that means instances of `bytes`. In python
        # 2.6 and 2.7 you can create an alias for `bytes` using
        # the b prefix (e.g. b'foo').
        # See http://python3porting.com/problems.html#nicer-solutions
        return codecs.latin_1_encode(s)[0]
项目:covar_me_app    作者:CovarMe    | 项目源码 | 文件源码
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0]