diff --git a/src/calibre/customize/__init__.py b/src/calibre/customize/__init__.py index 8125b3cc5f..7a0cd04b01 100644 --- a/src/calibre/customize/__init__.py +++ b/src/calibre/customize/__init__.py @@ -66,7 +66,7 @@ class Plugin(object): # {{{ #: When more than one plugin exists for a filetype, #: the plugins are run in order of decreasing priority. #: Plugins with higher priority will be run first. - #: The highest possible priority is ``sys.maxint``. + #: The highest possible priority is ``sys.maxsize``. #: Default priority is 1. priority = 1 diff --git a/src/calibre/devices/kobo/books.py b/src/calibre/devices/kobo/books.py index 47082a29ed..acad03892f 100644 --- a/src/calibre/devices/kobo/books.py +++ b/src/calibre/devices/kobo/books.py @@ -273,10 +273,10 @@ class KTCollectionsBookList(CollectionsBookList): if is_series: if doing_dc: collections[cat_name][lpath] = \ - (book, book.get('series_index', sys.maxint), tsval) + (book, book.get('series_index', sys.maxsize), tsval) else: collections[cat_name][lpath] = \ - (book, book.get(attr+'_index', sys.maxint), tsval) + (book, book.get(attr+'_index', sys.maxsize), tsval) else: collections[cat_name][lpath] = (book, tsval, tsval) if show_debug: diff --git a/src/calibre/devices/paladin/driver.py b/src/calibre/devices/paladin/driver.py index e7d90b4294..49c2699c2e 100644 --- a/src/calibre/devices/paladin/driver.py +++ b/src/calibre/devices/paladin/driver.py @@ -350,7 +350,7 @@ class PALADIN(USBMS): values (?,?,?,?,?,?,?,?) ''' t = (title, author, book.get('comments', None), int(time.time() * 1000), - book.get('series', None), book.get('series_index', sys.maxint), lpath, + book.get('series', None), book.get('series_index', sys.maxsize), lpath, book.mime or mime_type_ext(path_to_ext(lpath))) cursor.execute(query, t) book.bookId = connection.last_insert_rowid() diff --git a/src/calibre/devices/usbms/books.py b/src/calibre/devices/usbms/books.py index 6d65e13c9c..c2ad189341 100644 --- a/src/calibre/devices/usbms/books.py +++ b/src/calibre/devices/usbms/books.py @@ -256,10 +256,10 @@ class CollectionsBookList(BookList): elif is_series: if doing_dc: collections[cat_name][lpath] = \ - (book, book.get('series_index', sys.maxint), tsval) + (book, book.get('series_index', sys.maxsize), tsval) else: collections[cat_name][lpath] = \ - (book, book.get(attr+'_index', sys.maxint), tsval) + (book, book.get(attr+'_index', sys.maxsize), tsval) else: if lpath not in collections[cat_name]: collections[cat_name][lpath] = (book, tsval, tsval) diff --git a/src/calibre/ebooks/conversion/plugins/lrf_output.py b/src/calibre/ebooks/conversion/plugins/lrf_output.py index d743a1de74..edae1f5688 100644 --- a/src/calibre/ebooks/conversion/plugins/lrf_output.py +++ b/src/calibre/ebooks/conversion/plugins/lrf_output.py @@ -55,7 +55,7 @@ class LRFOptions(object): self.ignore_colors = False from calibre.ebooks.lrf import PRS500_PROFILE self.profile = PRS500_PROFILE - self.link_levels = sys.maxint + self.link_levels = sys.maxsize self.link_exclude = '@' self.no_links_in_toc = True self.disable_chapter_detection = True diff --git a/src/calibre/ebooks/html/input.py b/src/calibre/ebooks/html/input.py index 6bd6183821..c5f7dcca4b 100644 --- a/src/calibre/ebooks/html/input.py +++ b/src/calibre/ebooks/html/input.py @@ -190,7 +190,7 @@ def depth_first(root, flat, visited=set([])): visited.add(hf) -def traverse(path_to_html_file, max_levels=sys.maxint, verbose=0, encoding=None): +def traverse(path_to_html_file, max_levels=sys.maxsize, verbose=0, encoding=None): ''' Recursively traverse all links in the HTML file. diff --git a/src/calibre/ebooks/lrf/html/table.py b/src/calibre/ebooks/lrf/html/table.py index 869febf632..43b260407e 100644 --- a/src/calibre/ebooks/lrf/html/table.py +++ b/src/calibre/ebooks/lrf/html/table.py @@ -154,7 +154,7 @@ class Cell(object): mwidth = width return parindent + mwidth + 2 - def text_block_size(self, tb, maxwidth=sys.maxint, debug=False): + def text_block_size(self, tb, maxwidth=sys.maxsize, debug=False): ts = tb.textStyle.attrs default_font = get_font(ts['fontfacename'], self.pts_to_pixels(ts['fontsize'])) parindent = self.pts_to_pixels(ts['parindent']) @@ -200,7 +200,7 @@ class Cell(object): return right+3+max(parindent, 10), bottom def text_block_preferred_width(self, tb, debug=False): - return self.text_block_size(tb, sys.maxint, debug=debug)[0] + return self.text_block_size(tb, sys.maxsize, debug=debug)[0] def preferred_width(self, debug=False): return ceil(max([self.text_block_preferred_width(i, debug=debug) for i in self.text_blocks])) diff --git a/src/calibre/ebooks/metadata/opf2.py b/src/calibre/ebooks/metadata/opf2.py index 5468c0e72d..97227867eb 100644 --- a/src/calibre/ebooks/metadata/opf2.py +++ b/src/calibre/ebooks/metadata/opf2.py @@ -714,7 +714,7 @@ class OPF(object): # {{{ def create_manifest_item(self, href, media_type, append=False): ids = [i.get('id', None) for i in self.itermanifest()] id = None - for c in range(1, sys.maxint): + for c in range(1, sys.maxsize): id = 'id%d'%c if id not in ids: break diff --git a/src/calibre/ebooks/oeb/transforms/jacket.py b/src/calibre/ebooks/oeb/transforms/jacket.py index df658a025b..cff11f0f6f 100644 --- a/src/calibre/ebooks/oeb/transforms/jacket.py +++ b/src/calibre/ebooks/oeb/transforms/jacket.py @@ -143,7 +143,7 @@ class Jacket(Base): def remove_existing_jacket(self): for x in self.oeb.spine[:4]: if XPath(JACKET_XPATH)(x.data): - self.remove_images(x, limit=sys.maxint) + self.remove_images(x, limit=sys.maxsize) self.oeb.manifest.remove(x) self.log('Removed existing jacket') break diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index 337147d8a7..105587e3e1 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -172,7 +172,7 @@ class Column(object): self.elements.sort(key=lambda x: x.bottom) self.top = self.elements[0].top self.bottom = self.elements[-1].bottom - self.left, self.right = sys.maxint, 0 + self.left, self.right = sys.maxsize, 0 for x in self: self.left = min(self.left, x.left) self.right = max(self.right, x.right) diff --git a/src/calibre/ebooks/pdf/render/engine.py b/src/calibre/ebooks/pdf/render/engine.py index 8cb0343df3..486873d2a7 100644 --- a/src/calibre/ebooks/pdf/render/engine.py +++ b/src/calibre/ebooks/pdf/render/engine.py @@ -387,7 +387,7 @@ class PdfDevice(QPaintDevice): # {{{ if m == self.PdmDepth: return 32 if m == self.PdmNumColors: - return sys.maxint + return sys.maxsize if m == self.PdmWidthMM: return int(round(self.body_width * 0.35277777777778)) if m == self.PdmHeightMM: diff --git a/src/calibre/ebooks/pdf/render/gradients.py b/src/calibre/ebooks/pdf/render/gradients.py index f4baa5ab5b..07b87f59a6 100644 --- a/src/calibre/ebooks/pdf/render/gradients.py +++ b/src/calibre/ebooks/pdf/render/gradients.py @@ -92,8 +92,8 @@ class LinearGradientPattern(Dictionary): page_rect = tuple(map(inv.map, ( QPointF(0, 0), QPointF(pixel_page_width, 0), QPointF(0, pixel_page_height), QPointF(pixel_page_width, pixel_page_height)))) - maxx = maxy = -sys.maxint-1 - minx = miny = sys.maxint + maxx = maxy = -sys.maxsize-1 + minx = miny = sys.maxsize for p in page_rect: minx, maxx = min(minx, p.x()), max(maxx, p.x()) diff --git a/src/calibre/ebooks/rtf2xml/fields_small.py b/src/calibre/ebooks/rtf2xml/fields_small.py index edbcb1f222..b15d4184de 100755 --- a/src/calibre/ebooks/rtf2xml/fields_small.py +++ b/src/calibre/ebooks/rtf2xml/fields_small.py @@ -214,7 +214,7 @@ file. see_string = '' changed_string = '' lines = my_string.split('\n') - end_bracket_count = sys.maxint + end_bracket_count = sys.maxsize for line in lines: token_info = line[:16] if token_info == 'ob tags. Default is %default')) parser.add_option('--delay', default=0, dest='delay', type='float', help=_('Minimum interval in seconds between consecutive fetches. Default is %default s'))