String representation.
480446
def to_string(self, verbose=0):
        """"""
        lines = []
        app = lines.append
        for i, cycle in enumerate(self):
            app("")
            app("RELAXATION STEP: %d" % (i + 1))
            app(cycle.to_string(verbose=verbose))

        return "\n".join(lines)
1351559
def string_tag(name, value):
    """"""
    return name.encode('utf-8') + \
        len(value).to_bytes(4, byteorder='big') + \
        value.encode('utf-8')
635279
def _asString(self, value):
        """"""
        if sys.version_info[0] == 3:
            if isinstance(value, str):
                return value
            elif isinstance(value, bytes):
                return value.decode('utf-8')
        elif sys.version_info[0] == 2:
            return value.encode('ascii')
29830
def get_representation(self, prefix="", suffix="\n"):
        
        res = []
        if self.hidden:
            res.append(prefix + " - " + str(self._name)
                       + " : xxxxxxxx" + suffix)
        else:
            default = self.default
            if default is None:
                default = " - "
            a = prefix + " - "
            a += str(self._name) + " : "
            if isinstance(default, types.UnicodeType):
                a += default
            else:
                a += str(default)
            a += suffix
            res.append(a)
        return res
171330
def str_(name):
  """"""
  if isinstance(name, bytes) and not isinstance(name, str):
    return name.decode('utf8')
  else:
    return name
693881
def read_string(self):
        
        length = self.read_int()
        return str(self.read(length).decode("UTF-8"))
1311459
def from_string(self, value):
        """"""
        # Remove optional []
        if value.startswith('[') and value.endswith(']'):
            text = value[1:-1].strip()
        else:
            text = value.strip()
        # Result is a list
        result = []
        # If value starts with '(' assume a list of pairs
        if text.startswith('('):
            tokens = text.split(',')
            if len(tokens) % 2 != 0:
                raise ValueError('not a valid list of pairs')
            pos = 0
            while (pos < len(tokens)):
                val1 = float(tokens[pos].strip()[1:].strip())
                val2 = float(tokens[pos + 1].strip()[:-1])
                result.append((val1, val2))
                pos += 2
        else:
            for val in text.split(','):
                result.append(float(val))
        # Ensure that the result contains at least two elements
        if len(result) < 2:
            raise ValueError('invalid number of elements in list: ' + str(len(result)))
        return result
41640
def as_strings(self):
        """"""
        ret = []
        for x in self.children:
            if isinstance(x, (Key, Comment)):
                ret.append(x.as_strings)
            else:
                for y in x.as_strings:
                    ret.append(y)
        if ret:
            ret[-1] = re.sub('}\n+$', '}\n', ret[-1])
        return ret
1045305
def encode(strs):
    
    res = ''
    for string in strs.split():
        res += str(len(string)) + ":" + string
    return res
1197305
def _printed_len(some_string):
  """"""
  return len([x for  x in ANSI_ESC_RE.sub('', some_string)
              if x in string.printable])
709267
def encode(string):
		

		result=".".join([ str(ord(s)) for s in string ])
		return  "%s." % (len(string)) + result
163904
def _render_str(self, string):
        """"""
        if isinstance(string, StrLabel):
            string = string._render(string.expr)
        string = str(string)
        if len(string) == 0:
            return ''
        name, supers, subs = split_super_sub(string)
        return render_unicode_sub_super(
            name, subs, supers, sub_first=True, translate_symbols=True,
            unicode_sub_super=self._settings['unicode_sub_super'])
610691
private void xdr_string(String s) {
    byte[] bytes = s.getBytes();
    int len = bytes.length;
    xdr_int(len);
    System.arraycopy(bytes, 0, buffer, offset, len);
    offset += len;
    pad();
  }
1098215
private void outputString(String s) throws SAXException {
        handler.characters(s.toCharArray(), 0, s.length());
    }
1278227
def writeString(self, u):
        
        s = self.context.getBytesForString(u)

        self.writeBytes(s)
835515
def mapping_to_str(mapping):
    """"""
    result = ["<"]
    for i, (key, value) in enumerate(mapping.items()):
        if i > 0:
            result.append(",")
        result += [key, "=", serialize_for_header(key, value)]
    result += [">"]
    return "".join(result)
462497
def encode_string(self, value):
        """"""
        if not isinstance(value, str): return value
        try:
            return unicode(value, 'utf-8')
        except: # really, this should throw an exception.
                # in the interest of not breaking current
                # systems, however:
            arr = []
            for ch in value:
                arr.append(unichr(ord(ch)))
            return u"".join(arr)