Esempio n. 1
0
 def __eq__(self, other):
     for t1, t2 in zip([self.version, self.local], [other.version, other.local]):
         for v1, v2 in zip_longest(t1, t2, fillvalue=[self.fillvalue]):
             for c1, c2 in zip_longest(v1, v2, fillvalue=self.fillvalue):
                 if c1 != c2:
                     return False
     return True
Esempio n. 2
0
 def __eq__(self, other):
     for t1, t2 in zip([self.version, self.local],
                       [other.version, other.local]):
         for v1, v2 in zip_longest(t1, t2, fillvalue=[self.fillvalue]):
             for c1, c2 in zip_longest(v1, v2, fillvalue=self.fillvalue):
                 if c1 != c2:
                     return False
     return True
Esempio n. 3
0
 def __lt__(self, other):
     for t1, t2 in zip([self.version, self.local],
                       [other.version, other.local]):
         for v1, v2 in zip_longest(t1, t2, fillvalue=[]):
             for c1, c2 in zip_longest(v1, v2, fillvalue=self.fillvalue):
                 if c1 == c2:
                     continue
                 elif isinstance(c1, string_types):
                     if not isinstance(c2, string_types):
                         # str < int
                         return True
                 elif isinstance(c2, string_types):
                     # not (int < str)
                     return False
                 # c1 and c2 have the same type
                 return c1 < c2
     # self == other
     return False
Esempio n. 4
0
 def __lt__(self, other):
     for t1, t2 in zip([self.version, self.local], [other.version, other.local]):
         for v1, v2 in zip_longest(t1, t2, fillvalue=[self.fillvalue]):
             for c1, c2 in zip_longest(v1, v2, fillvalue=self.fillvalue):
                 if isinstance(c1, string_types):
                     if not isinstance(c2, string_types):
                         # str < int
                         return True
                 else:
                     if isinstance(c2, string_types):
                         # not (int < str)
                         return False
                 # c1 and c2 have the same type
                 if c1 < c2:
                     return True
                 if c2 < c1:
                     return False
                 # c1 == c2 => advance
     # self == other
     return False
Esempio n. 5
0
 def _eq(self, t1, t2):
     for v1, v2 in zip_longest(t1, t2, fillvalue=[]):
         for c1, c2 in zip_longest(v1, v2, fillvalue=self.fillvalue):
             if c1 != c2:
                 return False
     return True