def get_utf8_string(self): #_____________________________________________________________________________ assert self.begin <= self.end if self.begin == self.end: return "''" elif self.end - self.begin == 1: return utf8.unicode_to_pretty_utf8(self.begin) else: if self.end == -INTEGER_MAX: end_char = "-oo" elif self.end == INTEGER_MAX: end_char = "oo" else: end_char = utf8.unicode_to_pretty_utf8(self.end-1) return "[" + utf8.unicode_to_pretty_utf8(self.begin) + ", " + end_char + "]"
def get_utf8_string(self): #_____________________________________________________________________________ assert self.begin <= self.end if self.begin == self.end: return "''" elif self.end - self.begin == 1: return utf8.unicode_to_pretty_utf8(self.begin) else: if self.end == -sys.maxint: end_char = "-oo" elif self.end == sys.maxint: end_char = "oo" else: end_char = utf8.unicode_to_pretty_utf8(self.end-1) return "[" + utf8.unicode_to_pretty_utf8(self.begin) + ", " + end_char + "]"
def get_character_sequence(Sequence): txt = "" comment_txt = "" for letter in Sequence: comment_txt += "%s, " % utf8.unicode_to_pretty_utf8(letter) txt += "0x%X, " % letter return txt, comment_txt
def get_character_sequence(Sequence): txt = "" comment_txt = "" for letter in Sequence: comment_txt += "%s, " % utf8.unicode_to_pretty_utf8(letter) txt += "0x%X, " % letter return txt, comment_txt
def get_string(self, Option="", Delimiter=", "): assert Option in ("hex", "dec", "utf8", "") assert self.end >= self.begin if Option == "hex": __repr = lambda x: "-oo" if x == - INTEGER_MAX \ else "oo" if x == INTEGER_MAX - 1 \ else "%04X" % x elif Option == "utf8": __repr = lambda x: utf8.unicode_to_pretty_utf8(x) else: __repr = lambda x: "-oo" if x == - INTEGER_MAX \ else "oo" if x == INTEGER_MAX - 1 \ else "%s" % x if self.begin == self.end: return "[]" elif self.end - self.begin == 1: return "[" + __repr(self.begin) + "]" else: return "[" + __repr(self.begin) + Delimiter + __repr(self.end-1) + "]"
def get_string(self, Option="", Delimiter=", "): assert Option in ("hex", "dec", "utf8", "") assert self.end >= self.begin if Option == "hex": __repr = lambda x: "-oo" if x == - sys.maxint \ else "oo" if x == sys.maxint - 1 \ else "%04X" % x elif Option == "utf8": __repr = lambda x: utf8.unicode_to_pretty_utf8(x) else: __repr = lambda x: "-oo" if x == - sys.maxint \ else "oo" if x == sys.maxint - 1 \ else "%s" % x if self.begin == self.end: return "[]" elif self.end - self.begin == 1: return "[" + __repr(self.begin) + "]" else: return "[" + __repr(self.begin) + Delimiter + __repr(self.end-1) + "]"