src/reportlab/lib/rl_accel.py
changeset 4071 8a945e72d376
parent 4026 6c8ac18e0c9c
child 4089 ca6c60fd1f62
equal deleted inserted replaced
4070:db0b387dec10 4071:8a945e72d376
    27         if testing: _py_funcs[fn] = None
    27         if testing: _py_funcs[fn] = None
    28     except ImportError:
    28     except ImportError:
    29         _py_funcs[fn] = None
    29         _py_funcs[fn] = None
    30 
    30 
    31 if _py_funcs:
    31 if _py_funcs:
    32     from reportlab.lib.utils import isBytes, isUnicode, isSeq, isPy3, rawBytes, asNative
    32     from reportlab.lib.utils import isBytes, isUnicode, isSeq, isPy3, rawBytes, asNative, asUnicode, asBytes
    33     from math import log
    33     from math import log
    34     from struct import unpack
    34     from struct import unpack
    35 
    35 
    36 if 'fp_str' in _py_funcs:
    36 if 'fp_str' in _py_funcs:
    37     _log_10 = lambda x,log=log,_log_e_10=log(10.0): log(x)/_log_e_10
    37     _log_10 = lambda x,log=log,_log_e_10=log(10.0): log(x)/_log_e_10
   310             else:
   310             else:
   311                 lastword = ''
   311                 lastword = ''
   312             out(lastword)
   312             out(lastword)
   313 
   313 
   314         r = ''.join(out.__self__)
   314         r = ''.join(out.__self__)
   315         return r.encode('latin1') if isUnicode(input) else r
   315         return asBytes(r,enc='latin1')
   316     _py_funcs['asciiBase85Decode'] = asciiBase85Decode
   316     _py_funcs['asciiBase85Decode'] = asciiBase85Decode
   317 
   317 
   318 if 'sameFrag' in _py_funcs:
   318 if 'sameFrag' in _py_funcs:
   319     def sameFrag(f,g):
   319     def sameFrag(f,g):
   320         'returns 1 if two ParaFrags map out the same'
   320         'returns 1 if two ParaFrags map out the same'