1 import collate
._strings
3 class Collator(object):
4 def cmp(self
, string1
, string2
):
5 """Return negative if a < b, zero if a == b, positive if a > b."""
6 return cmp(self
.key(string1
), self
.key(string2
))
8 def sortemekey(self
, string
, invalid
=float('inf')):
10 for sorteme
in collate
._strings
.sortemes(string
):
11 num
, alpha
= collate
._strings
.numeric(sorteme
, invalid
)
13 keys
.append(self
.key(alpha
))
16 # Shove the sortkeyed original string on the end to resolve
18 return (keys
, self
.key(string
))