mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
py3: remove unneeded use of cmp
No need to carry around a polyglot implementation of cmp here, when sort(key=) works too. Fixes unnoticed error due to .sort(function) being implied as cmp= on python2, and not being permitted a positional argument on python3.
This commit is contained in:
parent
e020bbd946
commit
660b4233aa
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import sys, struct, zlib, bz2, os
|
import sys, struct, zlib, bz2, os
|
||||||
|
|
||||||
from calibre import guess_type
|
from calibre import guess_type
|
||||||
from polyglot.builtins import unicode_type, cmp
|
from polyglot.builtins import unicode_type
|
||||||
|
|
||||||
|
|
||||||
class FileStream:
|
class FileStream:
|
||||||
@ -17,10 +17,6 @@ class FileStream:
|
|||||||
return self.attr & 0x41000000 != 0x41000000
|
return self.attr & 0x41000000 != 0x41000000
|
||||||
|
|
||||||
|
|
||||||
def compareFileStream(file1, file2):
|
|
||||||
return cmp(file1.fileName, file2.fileName)
|
|
||||||
|
|
||||||
|
|
||||||
class BlockData:
|
class BlockData:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -200,7 +196,7 @@ class SNBFile:
|
|||||||
|
|
||||||
# Sort the files in file buffer,
|
# Sort the files in file buffer,
|
||||||
# requried by the SNB file format
|
# requried by the SNB file format
|
||||||
self.files.sort(compareFileStream)
|
self.files.sort(key=lambda x: x.fileName)
|
||||||
|
|
||||||
outputFile = open(outputFile, 'wb')
|
outputFile = open(outputFile, 'wb')
|
||||||
# File header part 1
|
# File header part 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user