Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(4)  |  Derive(0)  |  Import(3)
converts first 256 unicodes 1-1

            def rawBytes(s):
        '''converts first 256 unicodes 1-1'''
        return s.encode('latin1') if isinstance(s,unicode) else s
        


src/r/e/reportlab-3.1.8/src/reportlab/lib/pdfencrypt.py   reportlab(Download)
"""helpers for pdf encryption/decryption"""
import sys, os, tempfile
from reportlab.lib.utils import getBytesIO, md5, asBytes, int2Byte, char2int, rawUnicode, rawBytes, isPy3
from reportlab.pdfgen.canvas import Canvas
from reportlab.pdfbase import pdfutils
    return out
 
PadString = rawBytes(''.join(chr(int(c, 16)) for c in padding.strip().split()))
 
def encryptionkey(password, OwnerKey, Permissions, FileId1, revision=2):
        assert documentId is not None, "Revision 3 algorithm needs the document ID!"
        h = md5(PadString)
        h.update(rawBytes(documentId))
        tmp = h.digest()
        tmp = ArcIV(encryptionkey).encode(tmp)

src/r/e/reportlab-3.1.8/src/reportlab/graphics/renderPS.py   reportlab(Download)
 
from reportlab.pdfbase.pdfmetrics import getFont, stringWidth, unicode2T1 # for font info
from reportlab.lib.utils import getBytesIO, getStringIO, asBytes, char2int, rawBytes, asNative, isUnicode
from reportlab.lib.rl_accel import fp_str
from reportlab.lib.colors import black
 
        self._t1_re_encode()
        _f.write(rawBytes(self._sep.join(self.code)))
        if _f is not f:
            _f.close()

src/r/e/reportlab-3.1.8/src/reportlab/lib/rl_accel.py   reportlab(Download)
 
if _py_funcs:
    from reportlab.lib.utils import isBytes, isUnicode, isSeq, isPy3, rawBytes, asNative, asUnicode, asBytes
    from math import log
    from struct import unpack
    def calcChecksum(data):
        """Calculates TTF-style checksums"""
        data = rawBytes(data)
        if len(data)&3: data = data + (4-(len(data)&3))*b"\0"
        return sum(unpack(">%dl" % (len(data)>>2), data)) & 0xFFFFFFFF