pyslha.py

changeset 195
880af4ab57ba
parent 194
b6709078072b
child 196
7caa9b877b18
equal deleted inserted replaced
194:b6709078072b 195:880af4ab57ba
106 elif len(entry) == 2: 106 elif len(entry) == 2:
107 self.entries[entry[0]] = entry[1] 107 self.entries[entry[0]] = entry[1]
108 else: 108 else:
109 self.entries[tuple(entry[:-1])] = entry[-1] 109 self.entries[tuple(entry[:-1])] = entry[-1]
110 110
111 def items(self, key): 111 def items(self, key=None):
112 return self.entries.iteritems() 112 return self.entries.iteritems()
113 113
114 @property 114 @property
115 def value(self): 115 def value(self):
116 if len(self.entries) != 1: 116 if len(self.entries) != 1:
117 raise AccessError("Request for unique value of a multi-value block") 117 raise AccessError("Request for unique value of a multi-value block")
118 return self.entries.values()[0]
118 119
119 def __len__(self): 120 def __len__(self):
120 return len(self.entries) 121 return len(self.entries)
121 122
122 def __getitem__(self, key): 123 def __getitem__(self, key):

mercurial