Python codecs.latin_1_encode() Examples

The following are 30 code examples of codecs.latin_1_encode(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module codecs , or try the search function .
Example #1
Source File: str_tools.py    From stem with GNU Lesser General Public License v3.0 6 votes vote down vote up
def _to_bytes(msg: Union[str, bytes]) -> bytes:
  """
  Provides the ASCII bytes for the given string. This is purely to provide
  python 3 compatability, normalizing the unicode/ASCII change in the version
  bump. For an explanation of this see...

  http://python3porting.com/problems.html#nicer-solutions

  :param msg: string to be converted

  :returns: ASCII bytes for string
  """

  if isinstance(msg, str):
    return codecs.latin_1_encode(msg, 'replace')[0]  # type: ignore
  else:
    return msg 
Example #2
Source File: latin_1.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #3
Source File: py3compat.py    From activitypub with Mozilla Public License 2.0 5 votes vote down vote up
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] 
Example #4
Source File: latin_1.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #5
Source File: temp.py    From dagbldr with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def b(x): # deal with b'foo' versus 'foo'
    import codecs
    return codecs.latin_1_encode(x)[0] 
Example #6
Source File: temp.py    From dagbldr with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def b(x): # deal with b'foo' versus 'foo'
    import codecs
    return codecs.latin_1_encode(x)[0] 
Example #7
Source File: latin_1.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #8
Source File: latin_1.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #9
Source File: latin_1.py    From unity-python with MIT License 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #10
Source File: latin_1.py    From android_universal with MIT License 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #11
Source File: latin_1.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #12
Source File: latin_1.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #13
Source File: latin_1.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #14
Source File: py3compat.py    From integrations-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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] 
Example #15
Source File: latin_1.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #16
Source File: compat.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def b(s):
        return codecs.latin_1_encode(s)[0] 
Example #17
Source File: latin_1.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #18
Source File: compat.py    From bottle-jwt with GNU General Public License v3.0 5 votes vote down vote up
def b(string):
        return codecs.latin_1_encode(string)[0] 
Example #19
Source File: latin_1.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #20
Source File: latin_1.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #21
Source File: compat.py    From komodo-wakatime with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def b(s):
        return codecs.latin_1_encode(s)[0] 
Example #22
Source File: latin_1.py    From PhonePi_SampleServer with MIT License 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #23
Source File: latin_1.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #24
Source File: latin_1.py    From datafari with Apache License 2.0 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #25
Source File: compat.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def b(s):
        return codecs.latin_1_encode(s)[0] 
Example #26
Source File: latin_1.py    From python2017 with MIT License 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #27
Source File: latin_1.py    From ImageFusion with MIT License 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #28
Source File: latin_1.py    From ImageFusion with MIT License 5 votes vote down vote up
def encode(self, input, final=False):
        return codecs.latin_1_encode(input,self.errors)[0] 
Example #29
Source File: py3compat.py    From opsbro with MIT License 5 votes vote down vote up
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] 
Example #30
Source File: py3compat.py    From pyRevit with GNU General Public License v3.0 5 votes vote down vote up
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]