~ubuntu-branches/ubuntu/oneiric/python-djvulibre/oneiric

« back to all changes in this revision

Viewing changes to djvu/const.py

  • Committer: Bazaar Package Importer
  • Author(s): Jakub Wilk
  • Date: 2009-11-04 20:04:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20091104200426-8msc0xwx189ljtk0
Tags: 0.1.15-1
* New upstream release.
* Update homepage URI in debian/copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
    def __init__(self, value, rank):
81
81
        self.__rank = rank
82
 
    
83
 
    def __cmp__(self, other):
84
 
        if djvu.sexpr.Symbol.__eq__(self, other):
85
 
            return 0
86
 
        if not isinstance(other, TextZoneType):
87
 
            raise TypeError('cannot compare a text zone type with other object')
88
 
        return cmp(self.__rank, other.__rank)
89
 
    
 
82
 
 
83
    def __lt__(self, other):
 
84
        if not isinstance(other, TextZoneType):
 
85
            raise TypeError('cannot compare text zone type with other object')
 
86
        return self.__rank < other.__rank
 
87
 
 
88
    def __le__(self, other):
 
89
        if not isinstance(other, TextZoneType):
 
90
            raise TypeError('cannot compare text zone type with other object')
 
91
        return self.__rank <= other.__rank
 
92
 
 
93
    def __gt__(self, other):
 
94
        if not isinstance(other, TextZoneType):
 
95
            raise TypeError('cannot compare text zone type with other object')
 
96
        return self.__rank > other.__rank
 
97
 
 
98
    def __ge__(self, other):
 
99
        if not isinstance(other, TextZoneType):
 
100
            raise TypeError('cannot compare text zone type with other object')
 
101
        return self.__rank >= other.__rank
 
102
 
90
103
    def __repr__(self):
91
104
        return '<%s.%s: %s>' % (self.__module__, self.__class__.__name__, self)
92
105