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

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)

        def upack2rt(rt, encoding='ascii'):
    us = u''
    fr = ''
    offset = 0
    # convert rt strings to unicode if not already unicode
    # also generate the formatting run for the styles added
    for s, fontx in rt:
        if not isinstance(s, unicode):
            s = unicode(s, encoding)
        us += s
        if fontx is not None:
            # code in Rows.py ensures that
            # fontx can be None only for the first piece
            fr += pack(' 32767:
        raise Exception('String longer than 32767 characters')
    try:
        encs = us.encode('latin1')
        # Success here means all chars are in U+0000 to U+00FF
        # inclusive, meaning that we can use "compressed format".
        flag = 0 | 8
        n_items = len(encs)
    except UnicodeEncodeError:
        encs = us.encode('utf_16_le')
        flag = 1 | 8
        n_items = len(encs) // 2 # see comments in upack2 function above
    return pack('
    


src/x/l/xlwt-future-0.8.0/xlwt/BIFFRecords.py   xlwt-future(Download)
# -*- coding: cp1252 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from .UnicodeUtils import upack1, upack2, upack2rt
    def _add_rt_to_sst(self, rt):
        rt_str, rt_fr = upack2rt(rt, self.encoding)
        is_unicode_str = rt_str[2] == b'\x09'
        if is_unicode_str:
            atom_len = 7 # 2 byte -- len,

src/x/l/xlwt-0.7.5/xlwt/BIFFRecords.py   xlwt(Download)
# -*- coding: cp1252 -*-
from struct import pack
from UnicodeUtils import upack1, upack2, upack2rt
 
class SharedStringTable(object):
    def _add_rt_to_sst(self, rt):
        rt_str, rt_fr = upack2rt(rt, self.encoding)
        is_unicode_str = rt_str[2] == '\x09'
        if is_unicode_str:
            atom_len = 7 # 2 byte -- len,