Convert single record's values to str
519668
def to_one_str(cls, value, *args, **kwargs):
        
        if kwargs.get('wrapper'):
            return cls._wrapper_to_one_str(value)

        return _es.to_dict_str(value)
515382
def _serialize_record(self, record):
        """"""
        f = self._empty_to_dot
        row = [record.CHROM, record.POS]
        row.append(f(";".join(record.ID)))
        row.append(f(record.REF))
        if not record.ALT:
            row.append(".")
        else:
            row.append(",".join([f(a.serialize()) for a in record.ALT]))
        row.append(f(record.QUAL))
        row.append(f(";".join(record.FILTER)))
        row.append(f(self._serialize_info(record)))
        if record.FORMAT:
            row.append(":".join(record.FORMAT))
        row += [
            self._serialize_call(record.FORMAT, record.call_for_sample[s])
            for s in self.header.samples.names
        ]
        print(*row, sep="\t", file=self.stream)
1088351
def to_str(s, encoding=None, errors='strict'):
    
    encoding = encoding or 'utf-8'

    if is_strlike(s):
        if six.PY2:
            return s.encode(encoding, errors) if isinstance(s, unicode) else s
        else:
            return s.decode(encoding, errors) if isinstance(s, bytes) else s
    else:
        return str(s)
1125606
def get_record_value(request, uid, keyword, default=None):
    """"""
    value = request.get(keyword)
    if not value:
        return default
    if not isinstance(value, list):
        return default
    return value[0].get(uid, default) or default
444362
def _record_from_json(value, field):
    """"""
    if _not_null(value, field):
        record = {}
        record_iter = zip(field.fields, value["f"])
        for subfield, cell in record_iter:
            converter = _CELLDATA_FROM_JSON[subfield.field_type]
            if subfield.mode == "REPEATED":
                value = [converter(item["v"], subfield) for item in cell["v"]]
            else:
                value = converter(cell["v"], subfield)
            record[subfield.name] = value
        return record
647218
def _make_record(self,row):
        """"""
        res = dict(zip(self.all_fields,row))
        for k in self.types:
            res[k] = self.types[k](res[k])
        return res
296215
def _get_record_attrs(out_keys):
    
    if len(out_keys) == 1:
        attr = list(out_keys.keys())[0]
        if out_keys[attr]:
            return attr, out_keys[attr]
    return None, None
826015
def toStr (self, separator = ':'):
        
        return separator.join(('{:02x}'.format(x) for x in self.__value))
206399
def value_to_db(self, value):
        

        assert isinstance(value, str)

        array = value.split("-")
        length = len(array) - 3

        assert length >= 0
        assert array[0] == 'S'

        array = array[1:2] + [length, 0, 0, 0, 0, 0] + array[2:]
        array = [int(i) for i in array]

        return struct.pack('<bbbbbbbb' + 'I' * length, *array)
340109
def __toString(self, values):
		
		for key in values:
			if not values[key] is str:
				values[key] = str(values[key])
		return values
294091
def process_bind_param(self, value: Optional[List[str]],
                           dialect: Dialect) -> str:
        """"""
        retval = self._strlist_to_dbstr(value)
        return retval
538311
def to_str(v, encode=None):
    
    if isinstance(v, basestring_type):
        return v

    if isinstance(v, dict):
        return to_dict_str(v, encode)

    if isinstance(v, Iterable):
        return to_list_str(v, encode)

    if encode:
        return encode(v)
    else:
        return default_encode(v)
1190277
def record_to_objects(self):
        """"""
        from ambry.orm.exc import NotFoundError

        fr = self.record

        contents = fr.unpacked_contents

        if not contents:
            return

        # Zip transposes an array when in the form of a list of lists, so this transposes so
        # each row starts with the heading and the rest of the row are the values
        # for that row. The bool and filter return false when none of the values
        # are non-empty. Then zip again to transpose to original form.

        non_empty_rows = drop_empty(contents)

        s = self._dataset._database.session

        for i, row in enumerate(non_empty_rows):

            if i == 0:
                header = row
            else:
                d = dict(six.moves.zip(header, row))

                if 'widths' in d:
                    del d['widths']  # Obsolete column in old spreadsheets.

                if 'table' in d:
                    d['dest_table_name'] = d['table']
                    del d['table']

                if 'order' in d:
                    d['stage'] = d['order']
                    del d['order']

                if 'dest_table' in d:
                    d['dest_table_name'] = d['dest_table']
                    del d['dest_table']

                if 'source_table' in d:
                    d['source_table_name'] = d['source_table']
                    del d['source_table']

                d['d_vid'] = self._dataset.vid

                d['state'] = 'synced'

                try:
                    ds = self._dataset.source_file(str(d['name']))
                    ds.update(**d)
                except NotFoundError:
                    name = d['name']
                    del d['name']

                    try:
                        ds = self._dataset.new_source(name, **d)
                    except:
                        print(name, d)
                        import pprint
                        pprint.pprint(d)
                        raise
                except:  # Odd error with 'none' in keys for d
                    print('!!!', header)
                    print('!!!', row)
                    raise

                s.merge(ds)

        self._dataset._database.commit()
622948
def from_str(value):
    '''
    
    '''
    if value == 'none':
        value = None
    if value:
        value = str(value)
        if value.startswith('"') and value.endswith('"'):
            value = value[1:-1]
        value = value.replace('\\"', '"')

    return value
1259522
def to_str(s):
    
    if isinstance(s, bytes):
        s = s.decode('utf-8')
    elif not isinstance(s, str):
        s = str(s)
    return s
210342
def from_record(cls, record, crs):
        """"""
        if 'type' not in record:
            raise TypeError("The data isn't a valid record.")

        return cls(to_shape(record), crs)
947414
def read_data(record, bytes, attribute_set)
      attribute, length = attribute_set
      content = bytes.slice!(0, length).pack('C*')

      if attribute == :data && record.type_format == BINARY
        content = StringIO.new(content)
      end

      record.send "#{attribute.to_s}=", content
      bytes.slice!(0, 4 - (length & 3)) if (length & 3) != 0
    end