Lines Matching refs:self
38 def __init__ (self, vstring=None):
40 self.parse(vstring)
42 def __repr__ (self):
43 return "%s ('%s')" % (self.__class__.__name__, str(self))
45 def __eq__(self, other):
46 c = self._cmp(other)
51 def __lt__(self, other):
52 c = self._cmp(other)
57 def __le__(self, other):
58 c = self._cmp(other)
63 def __gt__(self, other):
64 c = self._cmp(other)
69 def __ge__(self, other):
70 c = self._cmp(other)
84 # __str__ (self) - convert back to a string; should be very similar
86 # __repr__ (self) - generate Python code to recreate
88 # _cmp (self, other) - compare two version numbers ('other' may
134 def parse (self, vstring):
135 match = self.version_re.match(vstring)
143 self.version = tuple(map(int, [major, minor, patch]))
145 self.version = tuple(map(int, [major, minor])) + (0,)
148 self.prerelease = (prerelease[0], int(prerelease_num))
150 self.prerelease = None
153 def __str__ (self):
155 if self.version[2] == 0:
156 vstring = '.'.join(map(str, self.version[0:2]))
158 vstring = '.'.join(map(str, self.version))
160 if self.prerelease:
161 vstring = vstring + self.prerelease[0] + str(self.prerelease[1])
166 def _cmp (self, other):
172 if self.version != other.version:
175 if self.version < other.version:
182 # case 2: self has prerelease, other doesn't; other is greater
183 # case 3: self doesn't have prerelease, other does: self is greater
186 if (not self.prerelease and not other.prerelease):
188 elif (self.prerelease and not other.prerelease):
190 elif (not self.prerelease and other.prerelease):
192 elif (self.prerelease and other.prerelease):
193 if self.prerelease == other.prerelease:
195 elif self.prerelease < other.prerelease:
304 def __init__ (self, vstring=None):
306 self.parse(vstring)
309 def parse (self, vstring):
313 self.vstring = vstring
314 components = [x for x in self.component_re.split(vstring)
322 self.version = components
325 def __str__ (self):
326 return self.vstring
329 def __repr__ (self):
330 return "LooseVersion ('%s')" % str(self)
333 def _cmp (self, other):
339 if self.version == other.version:
341 if self.version < other.version:
343 if self.version > other.version: