Takes a textual description of a formula and returns a RPN encoded byte
 string.
320892
def parse_formula(formula, byte_stream = false)
    # Build the parse tree for the formula
    tokens = reverse(parse(formula))

    # Add a volatile token if the formula contains a volatile function.
    # This must be the first token in the list
    #
    tokens.unshift('_vol') if check_volatile(tokens) != 0

    # The return value depends on which Worksheet.pm method is the caller
    unless byte_stream
      # Parse formula to see if it throws any errors and then
      # return raw tokens to Worksheet::store_formula()
      #
      parse_tokens(tokens)
      tokens
    else
      # Return byte stream to Worksheet::write_formula()
      parse_tokens(tokens)
    end
  end
900100
def to_text(value, encoding='utf-8'):
    
    if not value:
        return ''
    if isinstance(value, six.text_type):
        return value
    if isinstance(value, six.binary_type):
        return value.decode(encoding)
    return six.text_type(value)
348801
def to_bytes(val):
    
    if val is NoResponse:
        return val
    val = val.replace('\\r', '\r').replace('\\n', '\n')
    return val.encode()
942484
def get_description(self):
        """"""
        return DisplayText(text='Agent representing ' + str(self.id_),
                           language_type=DEFAULT_LANGUAGE_TYPE,
                           script_type=DEFAULT_SCRIPT_TYPE,
                           format_type=DEFAULT_FORMAT_TYPE,)
1031620
def from_bytes(TxIn, byte_string):
        '''
        
        '''
        outpoint = Outpoint.from_bytes(byte_string[:36])

        script_sig_len = VarInt.from_bytes(byte_string[36:45])
        script_start = 36 + len(script_sig_len)
        script_end = script_start + script_sig_len.number
        script_sig = byte_string[script_start:script_end]

        sequence = byte_string[script_end:script_end + 4]
        if script_sig == b'':
            stack_script = b''
            redeem_script = b''
        else:
            stack_script, redeem_script = TxIn._parse_script_sig(script_sig)
        return TxIn(
            outpoint=outpoint,
            stack_script=stack_script,
            redeem_script=redeem_script,
            sequence=sequence)
195456
async def text(self,
                   encoding: Optional[str]=None, errors: str='strict') -> str:
        """"""
        if self._body is None:
            await self.read()

        if encoding is None:
            encoding = self.get_encoding()

        return self._body.decode(encoding, errors=errors)
1130457
def toBytes(text, encoding=DEFAULT_ENCODING):
    
    if not text:
        return text

    if not isinstance(text, bytes_type):
        text = text.encode(encoding)

    return text
538331
def algorithm_to_text(value):
    """"""

    text = _algorithm_by_value.get(value)
    if text is None:
        text = str(value)
    return text
774501
def to_string(mnemonic):
        
        strings = {
            # Arithmetic Instructions
            ReilMnemonic.ADD: "add",
            ReilMnemonic.SUB: "sub",
            ReilMnemonic.MUL: "mul",
            ReilMnemonic.DIV: "div",
            ReilMnemonic.MOD: "mod",
            ReilMnemonic.BSH: "bsh",

            # Bitwise Instructions
            ReilMnemonic.AND: "and",
            ReilMnemonic.OR:  "or",
            ReilMnemonic.XOR: "xor",

            # Data Transfer Instructions
            ReilMnemonic.LDM: "ldm",
            ReilMnemonic.STM: "stm",
            ReilMnemonic.STR: "str",

            # Conditional Instructions
            ReilMnemonic.BISZ: "bisz",
            ReilMnemonic.JCC:  "jcc",

            # Other Instructions
            ReilMnemonic.UNKN:  "unkn",
            ReilMnemonic.UNDEF: "undef",
            ReilMnemonic.NOP:   "nop",

            # Extensions
            ReilMnemonic.SEXT: "sext",
            ReilMnemonic.SDIV: "sdiv",
            ReilMnemonic.SMOD: "smod",
            ReilMnemonic.SMUL: "smul",
        }

        return strings[mnemonic]
453347
def _extractText(self, format):
        """"""
        val = _fitz.TextPage__extractText(self, format)

        if format != 2:
            return val
        import base64, json

        class b64encode(json.JSONEncoder):
            def default(self,s):
                if not fitz_py2 and type(s) is bytes:
                    return base64.b64encode(s).decode()
                if type(s) is bytearray:
                    if fitz_py2:
                        return base64.b64encode(s)
                    else:
                        return base64.b64encode(s).decode()

        val = json.dumps(val, separators=(",", ":"), cls=b64encode, indent=1)


        return val
703473
def udom83(text: str) -> str:
    

    if not text or not isinstance(text, str):
        return ""

    text = _RE_1.sub("ัน\\1", text)
    text = _RE_2.sub("ั\\1", text)
    text = _RE_3.sub("ัน\\1", text)
    text = _RE_4.sub("ัน", text)
    text = _RE_5.sub("\\1", text)
    text = _RE_6.sub("\\1ย", text)
    text = _RE_7.sub("ม\\1", text)
    text = _RE_8.sub("ม", text)
    text = _RE_9.sub("ม", text)
    text = _RE_10.sub("", text)
    text = _RE_11.sub("", text)

    if not text:
        return ""

    sd = text[0].translate(_TRANS1)
    sd += text[1:].translate(_TRANS2)

    return (sd + "000000")[:7]
955589
def text_to_data(self, text, elt, ps):
        '''
        '''
        if self.strip: text = text.strip()
        if self.pyclass is not None:
            return self.pyclass(text.encode(UNICODE_ENCODING))
        return text.encode(UNICODE_ENCODING)
341998
def text_to_data(self, text, elt, ps):
        '''
        '''
        return String.text_to_data(self, urldecode(text), elt, ps)
1123786
def text_(s, encoding='latin-1', errors='strict'):
    '''
    
    '''
    return s.decode(encoding, errors) if isinstance(s, binary_type) else s
1242565
def repr_text(text, indent):
    """"""
    if text is None:
        return 'None'
    ret = _indent(text, amount=indent)
    return ret.lstrip(' ')
125204
def to_str(data):
    
    if isinstance(data, bytes):
        return codecs.decode(data, TEXT_ENCODING)
    return data
744896
def tcc(text: str) -> str:
    
    if not text or not isinstance(text, str):
        return ""

    p = 0
    while p < len(text):
        m = PAT_TCC.match(text[p:])
        if m:
            n = m.span()[1]
        else:
            n = 1
        yield text[p : p + n]
        p += n