def __lt__(self, rhs): if not isinstance(rhs, Decimal64): raise YPYDataValidationError( "Decimal64 comparision error, invalid rhs\n") if self.s is None: return True if rhs.s is None: return False getcontext().prec = 18 self_dec = Decimal(self.s) rhs_dec = Decimal(rhs.s) return self_dec < rhs_dec
def __eq__(self, rhs): if not isinstance(rhs, Empty): raise YPYDataValidationError( "Empty comparision error, invalid rhs\n") return True
def __ne__(self, rhs): if not isinstance(rhs, Decimal64): raise YPYDataValidationError( "Decimal64 comparision error, invalid rhs\n") return self.__cmp__(rhs) != 0
def insert(self, key, item): if item in self: raise YPYDataValidationError("{} already in list".format(item)) lst_item = YListItem(item, self.parent, self.name) super(YLeafList, self).insert(key, lst_item)