1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-03-13 04:55:49 +01:00

Removing unneeded from __future__ import statements.

Since we are on Python 3.6 and up, we don't need those anymore.
This commit is contained in:
2020-04-19 17:38:58 +02:00
parent 41b687ee27
commit 48fedea799
331 changed files with 1178 additions and 2067 deletions

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from io import BytesIO
from struct import calcsize, unpack, unpack_from
from collections import namedtuple
@@ -14,6 +6,11 @@ from ebook_converter.utils.fonts.utils import get_font_names2, get_font_characte
from ebook_converter.polyglot.builtins import range, unicode_type
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class UnsupportedFont(ValueError):
pass

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os
from collections import defaultdict
from threading import Thread
@@ -17,6 +9,11 @@ from ebook_converter.utils.fonts.metadata import FontMetadata, UnsupportedFont
from ebook_converter.polyglot.builtins import itervalues, unicode_type, filter
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class NoFonts(ValueError):
pass

View File

@@ -1,13 +1,10 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
from datetime import datetime, timedelta
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from datetime import datetime, timedelta
def align_block(raw, multiple=4, pad=b'\0'):
'''

View File

@@ -1,7 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'

View File

@@ -1,14 +1,11 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
from struct import pack, unpack_from
from ebook_converter.polyglot.builtins import range, unicode_type
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from struct import pack, unpack_from
from ebook_converter.polyglot.builtins import range, unicode_type
t1_operand_encoding = [None] * 256
t1_operand_encoding[0:32] = (32) * ["do_operator"]
t1_operand_encoding[32:247] = (247 - 32) * ["read_byte"]

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from struct import unpack_from, unpack, calcsize
from functools import partial
@@ -16,6 +8,11 @@ from ebook_converter.utils.fonts.sfnt.cff.constants import (cff_standard_strings
STANDARD_CHARSETS)
from ebook_converter.polyglot.builtins import iteritems, itervalues, range
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
# Useful links
# http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
# http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5177.Type2.pdf

View File

@@ -1,14 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
# Note that the code for creating a BMP table (cmap format 4) is taken with
# thanks from the fonttools project (BSD licensed).
from struct import unpack_from, calcsize, pack
from collections import OrderedDict
@@ -18,6 +7,14 @@ from ebook_converter.utils.fonts.sfnt.errors import UnsupportedFont
from ebook_converter.polyglot.builtins import range
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
# Note that the code for creating a BMP table (cmap format 4) is taken with
# thanks from the fonttools project (BSD licensed).
def split_range(start_code, end_code, cmap): # {{{
# Try to split a range of character codes into subranges with consecutive
# glyph IDs in such a way that the cmap4 subtable can be stored "most"

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from struct import unpack_from, calcsize
from collections import OrderedDict, namedtuple
@@ -13,6 +5,11 @@ from ebook_converter.utils.fonts.sfnt.errors import UnsupportedFont
from ebook_converter.polyglot.builtins import range, iteritems
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class Unpackable(object):
def __init__(self, raw, offset):

View File

@@ -1,8 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
# License: GPLv3 Copyright: 2012, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import OrderedDict
from io import BytesIO
from struct import calcsize, pack
@@ -21,6 +16,7 @@ from ebook_converter.utils.fonts.sfnt.loca import LocaTable
from ebook_converter.utils.fonts.sfnt.maxp import MaxpTable
from ebook_converter.utils.fonts.utils import checksum_of_block, get_tables, verify_checksums
# OpenType spec: http://www.microsoft.com/typography/otspec/otff.htm

View File

@@ -1,7 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'

View File

@@ -1,17 +1,14 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from struct import unpack_from
from collections import OrderedDict
from ebook_converter.utils.fonts.sfnt import UnknownTable
from ebook_converter.polyglot.builtins import iteritems
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
ARG_1_AND_2_ARE_WORDS = 0x0001 # if set args are words otherwise they are bytes
ARGS_ARE_XY_VALUES = 0x0002 # if set args are xy values, otherwise they are points
ROUND_XY_TO_GRID = 0x0004 # for the xy values if above is true

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from struct import unpack_from
from functools import partial
@@ -17,6 +9,11 @@ from ebook_converter.utils.fonts.sfnt.common import (ScriptListTable, FeatureLis
from ebook_converter.polyglot.builtins import iteritems, itervalues
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class SingleSubstitution(UnknownLookupSubTable):
formats = {1, 2}

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from struct import unpack_from, pack, calcsize
from ebook_converter.utils.fonts.sfnt import UnknownTable, DateTimeProperty, FixedProperty
@@ -14,6 +6,11 @@ from ebook_converter.utils.fonts.sfnt.loca import read_array
from ebook_converter.polyglot.builtins import zip
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class HeadTable(UnknownTable):
created = DateTimeProperty('_created')

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from struct import unpack_from, calcsize, pack, error as struct_error
from ebook_converter.utils.fonts.sfnt import (UnknownTable, FixedProperty,
@@ -14,6 +6,11 @@ from ebook_converter.utils.fonts.sfnt.errors import UnsupportedFont
from ebook_converter.polyglot.builtins import range
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class KernTable(UnknownTable):
version = FixedProperty('_version')

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import array, sys
from operator import itemgetter
from itertools import repeat
@@ -14,6 +6,11 @@ from ebook_converter.utils.fonts.sfnt import UnknownTable
from ebook_converter.polyglot.builtins import iteritems, range
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
def four_byte_type_code():
for c in 'IL':
a = array.array(c)

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from struct import unpack_from, pack
from ebook_converter.utils.fonts.sfnt import UnknownTable, FixedProperty
@@ -13,6 +5,11 @@ from ebook_converter.utils.fonts.sfnt.errors import UnsupportedFont
from ebook_converter.polyglot.builtins import zip
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class MaxpTable(UnknownTable):
version = FixedProperty('_version')

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import traceback
from collections import OrderedDict
from operator import itemgetter
@@ -16,6 +8,11 @@ from ebook_converter.utils.fonts.sfnt.container import Sfnt
from ebook_converter.utils.fonts.sfnt.errors import UnsupportedFont, NoGlyphs
from ebook_converter.polyglot.builtins import unicode_type, range, iteritems, itervalues, map
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
# TrueType outlines {{{

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import struct
from io import BytesIO
from collections import defaultdict
@@ -13,6 +5,11 @@ from collections import defaultdict
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type, range, as_bytes
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class UnsupportedFont(ValueError):
pass