Fabian Peter Hammerle 7 years ago
parent
commit
79d92b41e4
1 changed files with 4 additions and 19 deletions
  1. 4 19
      dingguo/__init__.py

+ 4 - 19
dingguo/__init__.py

@@ -35,6 +35,9 @@ class _YamlInitConstructor(yaml.YAMLObject):
         #         for (k, v) in loader.construct_mapping(node, deep = True).items()
         #     })
 
+    def __ne__(self, other):
+        return not (self == other)
+
 class Figure(_YamlInitConstructor):
 
     yaml_tag = u"!figure"
@@ -65,9 +68,6 @@ class Figure(_YamlInitConstructor):
     def __eq__(self, other):
         return type(self) == type(other) and self.value == other.value and self.unit == other.unit
 
-    def __ne__(self, other):
-        return not (self == other)
-
     @classmethod
     def to_yaml(cls, dumper, figure):
         return dumper.represent_mapping(
@@ -149,7 +149,7 @@ class Sum(ScalarFigure):
                 currency = attr[1],
                 )
 
-class Discount(yaml.YAMLObject):
+class Discount(_YamlInitConstructor):
 
     yaml_tag = u'!discount'
 
@@ -168,9 +168,6 @@ class Discount(yaml.YAMLObject):
         return (type(self) == type(other)
                 and vars(self) == vars(other))
 
-    def __ne__(self, other):
-        return not (self == other)
-
 class Order(_YamlInitConstructor):
 
     yaml_tag = u'!order'
@@ -210,9 +207,6 @@ class Order(_YamlInitConstructor):
         return (type(self) == type(other)
                 and vars(self) == vars(other))
 
-    def __ne__(self, other):
-        return not (self == other)
-
 class Item(_YamlInitConstructor):
 
     yaml_tag = u'!item'
@@ -231,9 +225,6 @@ class Item(_YamlInitConstructor):
         return (type(self) == type(other)
                 and vars(self) == vars(other))
 
-    def __ne__(self, other):
-        return not (self == other)
-
 class Article(Item):
 
     yaml_tag = u'!article'
@@ -396,9 +387,6 @@ class OrderRegistry(yaml.YAMLObject):
     def __eq__(self, other):
         return type(self) == type(other) and vars(self) == vars(other)
 
-    def __ne__(self, other):
-        return not self == other
-
 class Person(_YamlInitConstructor):
 
     yaml_tag = u'!person'
@@ -435,9 +423,6 @@ class Person(_YamlInitConstructor):
     def __eq__(self, other):
         return type(self) == type(other) and vars(self) == vars(other)
 
-    def __ne__(self, other):
-        return not self == other
-
     def __repr__(self):
         return self.__class__.__name__ + '(%s)' % ', '.join([
             '%s=%r' % (k, v) for k, v in vars(self).items()