1. Philippe Lagadec
  2. OleFileIO_PL

Commits

Philippe Lagadec  committed fab8920

Do away with @functools.total_ordering to restore Python 2.6 support
(from https://github.com/vadmium/Pillow/commit/caa609c438a9ed479f69b1749bd7a0b74874b65b)

  • Participants
  • Parent commits 796cf15
  • Branches py3

Comments (0)

Files changed (1)

File OleFileIO_PL/OleFileIO_PL.py

View file
 import io
 import sys
 import struct, array, os.path, datetime
-from functools import total_ordering
 
 #[PL] Define explicitly the public API to avoid private objects in pydoc:
 __all__ = ['OleFileIO', 'isOleFile']
 
 #--- _OleDirectoryEntry -------------------------------------------------------
 
-@total_ordering
 class _OleDirectoryEntry:
 
     """
     def __eq__(self, other):
         "Compare entries by name"
         return self.name == other.name
+
     def __lt__(self, other):
         "Compare entries by name"
         return self.name < other.name
+
+    def __ne__(self, other):
+        return not self.__eq__(other)
+
+    def __le__(self, other):
+        return self.__eq__(other) or self.__lt__(other)
+
+    # Reflected __lt__() and __le__() will be used for __gt__() and __ge__()
+
     #TODO: replace by the same function as MS implementation ?
     # (order by name length first, then case-insensitive order)