Output data as raw string (default)
436256
def raw(self, output):
        """"""
        if isinstance(output, (list, tuple)):
            output = '\n'.join(map(str, output))
        self.outfile.write(str(output))
819958
def _printstr(self, args, call_info=None):
        """"""
        # unicode sandwich, everything printed should be a byte string
        s = "\n"

        for arg in args:
            #s += arg.encode('utf-8', 'pout.replace')
            s += arg

        if call_info:
            s += "({}:{})\n\n".format(self._get_path(call_info['file']), call_info['line'])

        return s
118301
def normal_print(raw):
    ''' '''
    lines = raw.split('\n')
    for line in lines:
        if line:
            print(line + '\n')
410350
def _write_data(data, fp):
    """"""
    fp.write("@data\n")

    def to_str(x):
        if pandas.isnull(x):
            return '?'
        else:
            return str(x)

    data = data.applymap(to_str)
    n_rows = data.shape[0]
    for i in range(n_rows):
        str_values = list(data.iloc[i, :].apply(_check_str_array))
        line = ",".join(str_values)
        fp.write(line)
        fp.write("\n")
351240
def dumps(self):
        """"""

        error = {'code': self.code,
                 'message': str(self.message)}

        if self.data is not None:
            error['data'] = self.data

        return error
763249
def dump(self, f, indent=''):
        """"""
        if self.__unit is None:
            print(("%s%s %s" % (indent, self.__name, self.__value)).rstrip(), file=f)
        else:
            print(("%s%s [%s] %s" % (indent, self.__name, self.__unit, self.__value)).rstrip(), file=f)
1107845
function output(data, format) {
    switch(format) {
        case 'json':
            return json(data, 2);
        case 'min':
            return json(data);
        case 'unix':
            return unix(data);
        default:
            throw `Invalid format: ${format}`;
    }
}
1245530
def serialize_output(output):
    
    if not ('value' in output and 'script_hex' in output):
        raise Exception('Invalid output')

    return ''.join([
        hexlify(struct.pack('<Q', output['value'])), # pack into 8 bites
        hexlify(variable_length_int(len(output['script_hex'])/2)),
        output['script_hex']
    ])
1196735
def raw_encode(data):
    """"""
    content_type = 'application/data'
    payload = data
    if isinstance(payload, unicode):
        content_encoding = 'utf-8'
        payload = payload.encode(content_encoding)
    else:
        content_encoding = 'binary'
    return content_type, content_encoding, payload
185836
def outputdata(self, data):
        
        if not isinstance(data, bytes):
            data = str(data).encode(self.encoding)
        self.output(MemoryStream(data))
678812
def format_info(raw):
    
    logging.debug(_('raw[0]: %s'), raw[0])
    results, sense = raw
    # A scenario where ORM really stands out.
    new = '\n'.join(
        '{} {} {} {}'.format(
            i[0], sense.kind_id_to_name(i[1]),
            sense.file_id_to_name(i[2]).lower(),
            i[3] + ' ' if i[3] else '').strip()
        for i in results)
    return new
1352463
function stringToCP(raw) {
  if (raw instanceof Array) {
    return raw;
  }
  raw = raw.split(',');
  raw[0] = raw[0].trim();
  raw[1] = Number(raw[1].trim());
  return raw;
}
896391
def raw(self):
        
        if self.input_string:
            return self.input_string[self.raw_start:self.raw_end]
        return None
284687
def bytes_to_string(raw_data: bytes, prefix: bool = False) -> str:
        """"""
        prefix_string = ''
        if prefix:
            prefix_string = '0x'
        suffix = ''.join([format(c, "02x") for c in raw_data])
        return prefix_string + suffix.upper()
90537
def dump_rawdata(self):
        """"""
        if hasattr(self, 'transport'):
            attrs = vars(self.transport)
            return ', '.join("%s: %s" % item for item in attrs.items())
637214
def dump(self,indent='',depth=0):
        """"""
        out = []
        out.append( indent+_ustr(self.asList()) )
        keys = self.items()
        keys.sort()
        for k,v in keys:
            if out:
                out.append('\n')
            out.append( "%s%s- %s: " % (indent,('  '*depth), k) )
            if isinstance(v,ParseResults):
                if v.keys():
                    out.append( v.dump(indent,depth+1) )
                else:
                    out.append(_ustr(v))
            else:
                out.append(_ustr(v))
        return "".join(out)
700987
def encode(raw):
    """"""
    return raw \
        .replace(bytes([SLIP_ESC]), bytes([SLIP_ESC, SLIP_ESC_ESC])) \
        .replace(bytes([SLIP_END]), bytes([SLIP_ESC, SLIP_ESC_END]))