Utilities/binplistlib.py

changeset 4544
5145cf800bb0
parent 4436
52ec6b6b3432
child 4631
5c1a96925da4
equal deleted inserted replaced
4543:2e6a880670e9 4544:5145cf800bb0
117 """ 117 """
118 Special method to return an object representation. 118 Special method to return an object representation.
119 119
120 @return object representation (string) 120 @return object representation (string)
121 """ 121 """
122 return "Uid(%d)" % self 122 return "Uid({0:d})".format(self)
123 123
124 124
125 class Data(bytes): 125 class Data(bytes):
126 """ 126 """
127 Class implementing a wrapper around bytes types for representing Data 127 Class implementing a wrapper around bytes types for representing Data
525 @return unicode encoded string 525 @return unicode encoded string
526 """ 526 """
527 actual_length = length * 2 527 actual_length = length * 2
528 data = self.contents[ 528 data = self.contents[
529 self.currentOffset:self.currentOffset + actual_length] 529 self.currentOffset:self.currentOffset + actual_length]
530 # unpack not needed?!! data = unpack(">%ds" % (actual_length), data)[0]
531 self.currentOffset += actual_length 530 self.currentOffset += actual_length
532 return data.decode('utf_16_be') 531 return data.decode('utf_16_be')
533 532
534 def readDate(self): 533 def readDate(self):
535 """ 534 """
608 """ 607 """
609 Special method to generate a representation of the object. 608 Special method to generate a representation of the object.
610 609
611 @return object representation (string) 610 @return object representation (string)
612 """ 611 """
613 return "<HashableWrapper: %s>" % [self.value] 612 return "<HashableWrapper: {0}>".format([self.value])
614 613
615 614
616 class BoolWrapper(object): 615 class BoolWrapper(object):
617 """ 616 """
618 Class wrapping a boolean value. 617 Class wrapping a boolean value.
629 """ 628 """
630 Special method to generate a representation of the object. 629 Special method to generate a representation of the object.
631 630
632 @return object representation (string) 631 @return object representation (string)
633 """ 632 """
634 return "<BoolWrapper: %s>" % self.value 633 return "<BoolWrapper: {0}>".format(self.value)
635 634
636 635
637 class PlistWriter(object): 636 class PlistWriter(object):
638 """ 637 """
639 Class implementing the plist writer. 638 Class implementing the plist writer.

eric ide

mercurial