id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
27,300 | list_table.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/list_table.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 18,220 | Python | .py | 426 | 30.85446 | 91 | 0.487455 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,301 | pict.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/pict.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 7,220 | Python | .py | 167 | 32.017964 | 90 | 0.477767 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,302 | footnote.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/footnote.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 11,073 | Python | .py | 244 | 34.127049 | 88 | 0.524188 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,303 | preamble_div.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/preamble_div.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 23,011 | Python | .py | 552 | 31.751812 | 91 | 0.51443 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,304 | options_trem.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/options_trem.py | import sys
class ParseOptions:
"""
Requires:
system_string --The string from the command line
options_dict -- a dictionary with the key equal to the opition, and
a list describing that option. (See below)
Returns:
A tuple. The first item in the tuple is... | 10,294 | Python | .py | 273 | 25.117216 | 95 | 0.505697 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,305 | old_rtf.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/old_rtf.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 5,163 | Python | .py | 134 | 26.507463 | 85 | 0.408367 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,306 | ParseRtf.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/ParseRtf.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 23,251 | Python | .py | 582 | 28.245704 | 88 | 0.541433 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,307 | hex_2_utf8.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/hex_2_utf8.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 22,374 | Python | .py | 561 | 28.627451 | 112 | 0.511636 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,308 | paragraph_def.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/paragraph_def.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 29,613 | Python | .py | 729 | 31.211248 | 132 | 0.521332 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,309 | tokenize.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/tokenize.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 8,555 | Python | .py | 201 | 32.701493 | 116 | 0.483325 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,310 | info.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/info.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 11,684 | Python | .py | 270 | 32.937037 | 95 | 0.513732 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,311 | styles.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/styles.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 27,689 | Python | .py | 699 | 28.761087 | 88 | 0.492212 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,312 | char_set.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/char_set.py | char_set = """
<ms_standard>
NON-BREAKING HYPEHN:_:8290:‑
LEFT DOUBLE QUOTATION MARK:ldblquote:8220:“
RIGHT DOUBLE QUOTATION MARK:rdblquote:8221:”
LEFT SINGLE QUOTATION MARK:lquote:8216:‘
RIGHT SINGLE QUOTATION MARK:rquote:8217:’
EN DASH:endash:8211:–
EM DASH:emdash:8212:ȁ... | 705,807 | Python | .py | 16,708 | 41.243656 | 160 | 0.795456 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,313 | fields_large.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/fields_large.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 15,246 | Python | .py | 363 | 32.809917 | 122 | 0.556505 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,314 | override_table.py | kovidgoyal_calibre/src/calibre/ebooks/rtf2xml/override_table.py | #########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | 8,339 | Python | .py | 196 | 32.081633 | 92 | 0.514019 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,315 | input.py | kovidgoyal_calibre/src/calibre/ebooks/rtf/input.py | __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
from lxml import etree
class InlineClass(etree.XSLTExtension):
FMTS = ('italics', 'bold', 'strike-through', 'small-caps')
def __init__(self, log):
etree.XSLTExtension.__init__(self)
self.log = log
... | 1,168 | Python | .py | 29 | 30.862069 | 69 | 0.571176 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,316 | preprocess.py | kovidgoyal_calibre/src/calibre/ebooks/rtf/preprocess.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2010, Gerendi Sandor Attila'
__docformat__ = 'restructuredtext en'
"""
RTF tokenizer and token parser. v.1.0 (1/17/2010)
Author: Gerendi Sandor Attila
At this point this will tokenize a RTF file then rebuild it from the tokens.
In the process the UTF8 ... | 11,884 | Python | .py | 287 | 26.832753 | 141 | 0.493698 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,317 | rtfml.py | kovidgoyal_calibre/src/calibre/ebooks/rtf/rtfml.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Transform OEB content into RTF markup
'''
import io
import os
import re
from binascii import hexlify
from lxml import etree
from calibre.ebooks.metadata import authors_to_string
from calibre.... | 11,622 | Python | .py | 246 | 37.678862 | 340 | 0.569701 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,318 | metadata.py | kovidgoyal_calibre/src/calibre/ebooks/chm/metadata.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import codecs
import re
from calibre import force_unicode
from calibre.ebooks.BeautifulSoup import BeautifulSoup
from calibre.ebooks.chardet import xml_to_unicode
from cali... | 5,494 | Python | .py | 148 | 29.351351 | 97 | 0.600828 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,319 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/chm/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
Used for chm input
'''
| 172 | Python | .py | 7 | 23.142857 | 56 | 0.679012 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,320 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/chm/reader.py | ''' CHM File decoding support '''
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>,' \
' and Alex Bramley <a.bramley at gmail.com>.'
import codecs
import os
import re
import struct
from chm.chm import CHMFile, chmlib
from calibre import guess_type as guess_mimetyp... | 13,908 | Python | .py | 324 | 30.484568 | 116 | 0.542669 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,321 | formatwriter.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/formatwriter.py | '''
Interface defining the necessary public functions for a pdb format writer.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
class FormatWriter:
def __init__(self, opts, log):
raise NotImplementedError()
def write_con... | 408 | Python | .py | 11 | 33.454545 | 74 | 0.709184 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,322 | header.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/header.py | '''
Read the header data from a pdb file.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import re
import struct
import time
from polyglot.builtins import long_type
class PdbHeaderReader:
def __init__(self, stream):
self.... | 2,897 | Python | .py | 68 | 34.691176 | 96 | 0.597435 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,323 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/__init__.py | __license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
class PDBError(Exception):
pass
FORMAT_READERS = None
def _import_readers():
global FORMAT_READERS
from calibre.ebooks.pdb.ereader.reader import Reader as ereader_reader
from... | 2,821 | Python | .py | 84 | 28.357143 | 75 | 0.668874 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,324 | formatreader.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/formatreader.py | '''
Interface defining the necessary public functions for a pdb format reader.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
class FormatReader:
def __init__(self, header, stream, log, options):
raise NotImplementedError()... | 401 | Python | .py | 11 | 32.818182 | 74 | 0.709091 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,325 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/plucker/reader.py | __license__ = 'GPL v3'
__copyright__ = '20011, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import os
import struct
import zlib
from collections import OrderedDict
from calibre import CurrentDir
from calibre.ebooks.compression.palmdoc import decompress_doc
from calibre.ebooks.pdb.form... | 26,725 | Python | .py | 671 | 26.007452 | 108 | 0.491134 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,326 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/pdf/reader.py | '''
Read content from palmdoc pdb file.
'''
__license__ = 'GPL v3'
__copyright__ = '2010, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
from calibre.ebooks.pdb.formatreader import FormatReader
from calibre.ptempfile import PersistentTemporaryFile
class Reader(FormatReader):
def... | 1,169 | Python | .py | 28 | 34.642857 | 85 | 0.656637 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,327 | writer.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/palmdoc/writer.py | '''
Writer content to palmdoc pdb file.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import struct
from calibre.ebooks.pdb.formatwriter import FormatWriter
from calibre.ebooks.pdb.header import PdbHeaderBuilder
from calibre.ebooks.txt... | 2,884 | Python | .py | 52 | 47.826923 | 139 | 0.639986 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,328 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/palmdoc/reader.py | '''
Read content from palmdoc pdb file.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import io
import struct
from calibre.ebooks.pdb.formatreader import FormatReader
class HeaderRecord:
'''
The first record in the file is al... | 2,258 | Python | .py | 52 | 35.903846 | 88 | 0.655693 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,329 | writer.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/ztxt/writer.py | '''
Writer content to ztxt pdb file.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import struct
import zlib
from calibre.ebooks.pdb.formatwriter import FormatWriter
from calibre.ebooks.pdb.header import PdbHeaderBuilder
from calibre.e... | 3,611 | Python | .py | 63 | 49.444444 | 140 | 0.611851 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,330 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/ztxt/__init__.py | __license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
class zTXTError(Exception):
pass
| 163 | Python | .py | 5 | 30.4 | 60 | 0.698718 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,331 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/ztxt/reader.py | '''
Read content from ztxt pdb file.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import io
import struct
import zlib
from calibre.ebooks.pdb.formatreader import FormatReader
from calibre.ebooks.pdb.ztxt import zTXTError
SUPPORTED_VE... | 3,049 | Python | .py | 66 | 38.348485 | 111 | 0.646164 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,332 | inspector.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/ereader/inspector.py | '''
Inspect the header of ereader files. This is primarily used for debugging.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import struct
import sys
from calibre.ebooks.pdb.ereader import EreaderError
from calibre.ebooks.pdb.header i... | 5,941 | Python | .py | 115 | 46.269565 | 105 | 0.511126 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,333 | writer.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/ereader/writer.py | '''
Write content to ereader pdb file.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import io
import re
import struct
import zlib
from PIL import Image
from calibre.ebooks.pdb.formatwriter import FormatWriter
from calibre.ebooks.pdb.... | 10,729 | Python | .py | 209 | 40.263158 | 158 | 0.539254 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,334 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/ereader/__init__.py | __license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import os
class EreaderError(Exception):
pass
def image_name(name, taken_names=()):
name = os.path.basename(name)
if len(name) > 32:
cut = len(name) - 32
names = ... | 576 | Python | .py | 19 | 24.894737 | 60 | 0.595628 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,335 | reader132.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/ereader/reader132.py | '''
Read content from ereader pdb file with a 132 byte header created by Dropbook.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import os
import re
import struct
import zlib
from calibre import CurrentDir
from calibre.ebooks import DR... | 8,809 | Python | .py | 173 | 40.514451 | 155 | 0.608169 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,336 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/ereader/reader.py | '''
Read content from ereader pdb file.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
from calibre.ebooks.pdb.ereader import EreaderError
from calibre.ebooks.pdb.ereader.reader132 import Reader132
from calibre.ebooks.pdb.ereader.reader2... | 1,115 | Python | .py | 25 | 38.92 | 114 | 0.704903 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,337 | reader202.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/ereader/reader202.py | '''
Read content from ereader pdb file with a 116 and 202 byte header created by Makebook.
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import os
import struct
from calibre import CurrentDir
from calibre.ebooks.metadata.opf2 import OPF... | 5,578 | Python | .py | 125 | 34.912 | 87 | 0.61105 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,338 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/haodoo/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
| 149 | Python | .py | 4 | 35 | 58 | 0.678571 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,339 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/pdb/haodoo/reader.py | '''
Read content from Haodoo.net pdb file.
'''
__license__ = 'GPL v3'
__copyright__ = '2012, Kan-Ru Chen <kanru@kanru.info>'
__docformat__ = 'restructuredtext en'
import os
import struct
from calibre import prepare_string_for_xml
from calibre.ebooks.metadata import MetaInformation
from calibre.ebooks.pdb.formatre... | 4,593 | Python | .py | 124 | 27.717742 | 90 | 0.541071 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,340 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/azw4/reader.py | '''
Read content from azw4 file.
azw4 is essentially a PDF stuffed into a MOBI container.
'''
__license__ = 'GPL v3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import os
import re
from calibre.ebooks.pdb.formatreader import FormatReader
def unwrap(stream,... | 1,579 | Python | .py | 40 | 32.6 | 87 | 0.633858 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,341 | pmlml.py | kovidgoyal_calibre/src/calibre/ebooks/pml/pmlml.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Transform OEB content into PML markup
'''
import re
from lxml import etree
from calibre.ebooks.pdb.ereader import image_name
from calibre.ebooks.pml import unipmlcode
from calibre.utils.xml_p... | 13,145 | Python | .py | 322 | 30.568323 | 137 | 0.522806 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,342 | pmlconverter.py | kovidgoyal_calibre/src/calibre/ebooks/pml/pmlconverter.py | '''
Convert pml markup to and from html
'''
__license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import io
import os
import re
from copy import deepcopy
from calibre import my_unichr, prepare_string_for_xml
from calibre.ebooks.metadata.toc import... | 27,092 | Python | .py | 682 | 25.539589 | 141 | 0.430856 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,343 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/pml/__init__.py | __license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
def r(*a):
return list(range(*a))
# Uncommon Characters supported by PML. \\a tag codes
A_CHARS = r(160, 256) + r(130, 136) + r(138, 141) + \
r(145, 152) + r(153, 157) + [159]
# Exten... | 2,639 | Python | .py | 56 | 43.267857 | 79 | 0.68932 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,344 | input.py | kovidgoyal_calibre/src/calibre/ebooks/comic/input.py | __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
Based on ideas from comiclrf created by FangornUK.
'''
import os
import time
import traceback
from calibre import extract, prints, walk
from calibre.constants import filesystem_encoding
from ca... | 11,674 | Python | .py | 278 | 30.928058 | 132 | 0.57168 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,345 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/comic/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
Convert CBR/CBZ files to LRF.
'''
import sys
def main(args=sys.argv):
return 0
if __name__ == '__main__':
sys.exit(main())
| 285 | Python | .py | 12 | 21.416667 | 56 | 0.65283 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,346 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/tcr/__init__.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
| 121 | Python | .py | 3 | 39.333333 | 60 | 0.686441 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,347 | djvubzzdec.py | kovidgoyal_calibre/src/calibre/ebooks/djvu/djvubzzdec.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2011, Anthon van der Neut <A.van.der.Neut@ruamel.eu>'
# Copyright (C) 2011 Anthon van der Neut, Ruamel bvba
# Adapted from Leon Bottou's djvulibre C++ code,
# ( ZPCodec.{cpp,h} and BSByteStream.{cpp,h} )
# that code was first converted to C removing any ... | 32,859 | Python | .py | 704 | 39.694602 | 109 | 0.505558 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,348 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/djvu/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2011, Anthon van der Neut <anthon@mnt.org>'
__docformat__ = 'restructuredtext en'
'''
Used for DJVU input
'''
| 178 | Python | .py | 7 | 23.857143 | 60 | 0.664671 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,349 | djvu.py | kovidgoyal_calibre/src/calibre/ebooks/djvu/djvu.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2011, Anthon van der Neut <A.van.der.Neut@ruamel.eu>'
# this code is based on:
# Lizardtech DjVu Reference
# DjVu v3
# November 2005
import struct
import sys
from calibre.ebooks.djvu.djvubzzdec import BZZDecoder
class DjvuChunk:
def __init__(se... | 4,418 | Python | .py | 111 | 28.153153 | 92 | 0.521567 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,350 | writer.py | kovidgoyal_calibre/src/calibre/ebooks/rb/writer.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import io
import struct
import zlib
from PIL import Image
from calibre.constants import __appname__, __version__
from calibre.ebooks.rb import HEADER, unique_name
from calibre.ebooks.rb.rbml impor... | 5,107 | Python | .py | 121 | 31.190083 | 126 | 0.545381 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,351 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/rb/__init__.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import os
HEADER = b'\xb0\x0c\xb0\x0c\x02\x00NUVO\x00\x00\x00\x00'
class RocketBookError(Exception):
pass
def unique_name(name, used_names):
name = os.path.basename(name)
if len(nam... | 653 | Python | .py | 19 | 28 | 78 | 0.601911 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,352 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/rb/reader.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import os
import struct
import zlib
from calibre import CurrentDir
from calibre.ebooks.metadata.opf2 import OPFCreator
from calibre.ebooks.metadata.rb import get_metadata
from calibre.ebooks.rb imp... | 4,388 | Python | .py | 102 | 33.176471 | 127 | 0.598071 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,353 | rbml.py | kovidgoyal_calibre/src/calibre/ebooks/rb/rbml.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Transform OEB content into RB compatible markup.
'''
import re
from calibre import prepare_string_for_xml
from calibre.ebooks.rb import unique_name
from polyglot.builtins import string_or_byte... | 7,651 | Python | .py | 192 | 30.052083 | 137 | 0.55033 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,354 | input.py | kovidgoyal_calibre/src/calibre/ebooks/odt/input.py | __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
Convert an ODT file into a Open Ebook
'''
import logging
import os
from css_parser import CSSParser
from css_parser.css import CSSRule
from lxml import etree
from odf.draw import Frame as odFram... | 12,728 | Python | .py | 281 | 32.067616 | 106 | 0.5357 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,355 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/odt/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
Handle the Open Document Format
'''
| 185 | Python | .py | 7 | 25 | 56 | 0.697143 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,356 | fb2ml.py | kovidgoyal_calibre/src/calibre/ebooks/fb2/fb2ml.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Transform OEB content into FB2 markup
'''
import re
import textwrap
import uuid
from datetime import datetime
from lxml import etree
from calibre import prepare_string_for_xml
from calibre.co... | 23,319 | Python | .py | 500 | 34.122 | 149 | 0.539963 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,357 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/fb2/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
def base64_decode(raw):
from io import BytesIO
from polyglot.binary import from_base64_bytes
# First try the python implementation as it is faster
try:
... | 1,371 | Python | .py | 43 | 22.255814 | 72 | 0.494322 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,358 | stylizer.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/stylizer.py | '''
CSS property propagation class.
'''
__license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
import copy
import logging
import numbers
import os
import re
import unicodedata
from operator import itemgetter
from weakref import WeakKeyDictionary
from xml.dom import SyntaxErr as CS... | 34,663 | Python | .py | 783 | 31.153257 | 513 | 0.543402 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,359 | normalize_css.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/normalize_css.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import numbers
from functools import wraps
from css_parser import CSSParser
from css_parser import profile as cssprofiles
from css_parser.css import PropertyValue
from tinycss.fonts3 import parse_font, seriali... | 19,739 | Python | .py | 377 | 41.257294 | 158 | 0.553235 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,360 | writer.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/writer.py | '''
Directory output OEBBook writer.
'''
__license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
import os
from calibre.ebooks.oeb.base import OPF_MIME, DirContainer, OEBError, xml2str
__all__ = ['OEBWriter']
class OEBWriter:
DEFAULT_PROFILE = 'PRS505'
"""Default rende... | 2,666 | Python | .py | 65 | 32.4 | 78 | 0.600077 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,361 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/__init__.py | __license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
| 92 | Python | .py | 2 | 45 | 66 | 0.655556 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,362 | base.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/base.py | '''
Basic support for manipulating OEB 1.x/2.0 content and metadata.
'''
__license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
__docformat__ = 'restructuredtext en'
import logging
import numbers
import os
import re
import sys
from collections import defaultdict
from itertools imp... | 72,281 | Python | .py | 1,710 | 31.711111 | 131 | 0.566475 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,363 | reader.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/reader.py | """
Container-/OPF-based input OEBBook reader.
"""
__license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
import copy
import io
import os
import re
import sys
import uuid
from collections import defaultdict
from lxml import etree
from calibre import guess_type, xml_replace_enti... | 28,491 | Python | .py | 693 | 28.510823 | 138 | 0.531034 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,364 | parse_utils.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/parse_utils.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import re
from lxml import etree, html
from calibre import force_unicode, xml_replace_entities
from calibre.constants import filesystem_encoding
from calibre.ebooks.charde... | 13,522 | Python | .py | 328 | 32.04878 | 117 | 0.581252 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,365 | bookmarks.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/iterator/bookmarks.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import numbers
import os
from io import BytesIO
from calibre.utils.zipfile import safe_replace
from polyglot.builtins import as_unicode
BM_FIELD_SEP = '*|!|?|*'
BM_LEGACY_... | 3,713 | Python | .py | 90 | 29.988889 | 97 | 0.546437 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,366 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/iterator/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os
import re
import sys
from calibre.customize.ui import available_input_formats
def is_supported(path):
ext = os.path.splitext(path)[1].replace('.', '').lower... | 1,514 | Python | .py | 33 | 40.818182 | 99 | 0.683027 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,367 | spine.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/iterator/spine.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os
import re
from collections import namedtuple
from functools import partial
from operator import attrgetter
from calibre import guess_type, replace_entities
from c... | 5,386 | Python | .py | 126 | 33.65873 | 101 | 0.591751 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,368 | book.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/iterator/book.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
'''
Iterate over the HTML files in an ebook. Useful for writing viewers.
'''
import math
import os
import re
from functools import partial
from calibre import guess_type,... | 9,757 | Python | .py | 205 | 36.160976 | 146 | 0.588606 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,369 | split.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/split.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import copy
import os
import re
from calibre.ebooks.oeb.base import OEB_DOCS, OPF, XHTML, XPNSMAP, XPath, barename
from calibre.ebooks.oeb.polish.errors import MalformedMarkup
from calibre.ebooks.oeb.polish.re... | 18,872 | Python | .py | 429 | 34.421911 | 136 | 0.606211 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,370 | errors.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/errors.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from calibre.ebooks import DRMError as _DRMError
class InvalidBook(ValueError):
pass
class DRMError(_DRMError):
def __init__(self):
super().__init__(... | 477 | Python | .py | 14 | 30.5 | 81 | 0.718404 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,371 | download.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/download.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import mimetypes
import os
import posixpath
import re
import shutil
from collections import defaultdict
from contextlib import closing
from functools import partial
from io import BytesIO
from multiprocessing.dummy import Po... | 7,272 | Python | .py | 175 | 31.462857 | 125 | 0.6 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,372 | import_book.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/import_book.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import os
import sys
from calibre.ebooks.conversion.plumber import Plumber
from calibre.ebooks.epub import initialize_container
from calibre.ebooks.oeb.polish.container import OEB_DOCS, OEB_STYLES, Container
f... | 2,814 | Python | .py | 54 | 44.037037 | 134 | 0.659141 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,373 | spell.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/spell.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import sys
from collections import Counter, defaultdict
from calibre import replace_entities
from calibre.ebooks.oeb.base import barename
from calibre.ebooks.oeb.polish.container import OPF_NAMESPACES, get_con... | 15,116 | Python | .py | 323 | 38.718266 | 121 | 0.639301 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,374 | images.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/images.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
import os
from functools import partial
from threading import Event, Thread
from calibre import detect_ncpus, filesystem_encoding, force_unicode, human_readable
from polyglot.builtins import iteritems
from polyglot.queue im... | 4,784 | Python | .py | 117 | 30.74359 | 142 | 0.586933 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,375 | container.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/container.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2013, Kovid Goyal <kovid at kovidgoyal.net>
import errno
import hashlib
import logging
import os
import re
import shutil
import sys
import unicodedata
import uuid
from collections import defaultdict
from io import BytesIO
from itertools import count
from css_parser i... | 69,169 | Python | .py | 1,463 | 36.327409 | 156 | 0.595201 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,376 | report.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/report.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import os
import posixpath
import time
import types
from collections import defaultdict, namedtuple
from itertools import chain
from calibre import force_unicode, prepare_string_for_xml
from calibre.ebooks.oeb... | 14,076 | Python | .py | 304 | 37.059211 | 153 | 0.617946 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,377 | embed.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/embed.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys
from lxml import etree
from calibre import prints
from calibre.ebooks.oeb.base import XHTML
from calibre.utils.filenames import ascii_filename
from calibre.u... | 10,669 | Python | .py | 244 | 35.942623 | 149 | 0.604062 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,378 | parsing.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/parsing.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import re
import html5_parser
from lxml.etree import Element as LxmlElement
from calibre.ebooks.chardet import strip_encoding_declarations, xml_to_unicode
from calibre.utils.cleantext import clean_xml_chars
f... | 4,420 | Python | .py | 86 | 43.965116 | 159 | 0.651842 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,379 | toc.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/toc.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import re
from collections import Counter, OrderedDict
from functools import partial
from operator import itemgetter
from lxml import etree
from lxml.builder import Elem... | 32,555 | Python | .py | 793 | 31.74401 | 153 | 0.585675 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,380 | upgrade.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/upgrade.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import sys
from calibre.ebooks.conversion.plugins.epub_input import ADOBE_OBFUSCATION, IDPF_OBFUSCATION
from calibre.ebooks.metadata.opf3 import XPath
from calibre.ebooks.metadata.opf_2_to_3 import upgrade_metadata
from cal... | 7,460 | Python | .py | 168 | 37.565476 | 106 | 0.625636 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,381 | cover.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/cover.py | __license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os
import re
import shutil
from calibre.ebooks.oeb.base import OEB_DOCS, OPF, XLINK, XPath, xml2text
from calibre.ebooks.oeb.polish.replace import get_recommended_folders, replace_links
... | 21,607 | Python | .py | 455 | 38.916484 | 109 | 0.639431 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,382 | opf.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/opf.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from lxml import etree
from calibre.ebooks.oeb.polish.container import OPF_NAMESPACES
from calibre.utils.localization import canonicalize_lang
def get_book_language(container):
for lang in container.opf_... | 1,698 | Python | .py | 40 | 33.875 | 111 | 0.608379 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,383 | hyphenation.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/hyphenation.py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
from calibre.ebooks.oeb.base import OEB_DOCS
from polyglot.builtins import iteritems
def add_soft_hyphens(container, report=None):
from calibre.utils.hyphenation.hyphenate import add_soft_hyphens_to_html
for name, ... | 983 | Python | .py | 22 | 38.363636 | 81 | 0.715481 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,384 | utils.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/utils.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import os
import re
from bisect import bisect
from calibre import guess_type as _guess_type
from calibre import replace_entities
from calibre.utils.icu import upper as icu_upper
BLOCK_TAG_NAMES = frozenset((
... | 9,930 | Python | .py | 249 | 31.365462 | 126 | 0.592301 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,385 | create.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/create.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import os
import sys
from lxml import etree
from calibre import CurrentDir, prepare_string_for_xml
from calibre.ebooks.metadata import authors_to_string
from calibre.ebooks.metadata.opf2 import metadata_to_op... | 5,316 | Python | .py | 120 | 37.991667 | 121 | 0.648852 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,386 | __init__.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
| 152 | Python | .py | 4 | 35.75 | 61 | 0.678322 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,387 | fonts.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/fonts.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from tinycss.fonts3 import parse_font, parse_font_family, serialize_font, serialize_font_family
from calibre.ebooks.oeb.base import css_text
from calibre.ebooks.oeb.normalize_css import normalize_font
from cal... | 6,233 | Python | .py | 137 | 34.678832 | 95 | 0.591111 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,388 | jacket.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/jacket.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from calibre.customize.ui import output_profiles
from calibre.ebooks.conversion.config import load_defaults
from calibre.ebooks.oeb.base import OPF, XPath
from calibre.eb... | 3,960 | Python | .py | 87 | 37.862069 | 102 | 0.656282 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,389 | cascade.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/cascade.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import re
from collections import defaultdict, namedtuple
from functools import partial
from itertools import count
from operator import itemgetter
from css_parser.css import CSSRule, CSSStyleSheet, Property
from css_select... | 11,523 | Python | .py | 242 | 38.190083 | 153 | 0.640873 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,390 | css.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/css.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import re
from collections import defaultdict
from functools import partial
from operator import itemgetter
from css_parser.css import CSSRule, CSSStyleDeclaration
from css_selectors import Select, SelectorErr... | 22,414 | Python | .py | 485 | 36.131959 | 147 | 0.624703 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,391 | stats.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/stats.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys
from functools import partial
import regex
from lxml.etree import tostring
from tinycss.fonts3 import parse_font_family
from calibre.ebooks.oeb.base import X... | 13,034 | Python | .py | 267 | 38.632959 | 158 | 0.59052 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,392 | subset.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/subset.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os
import sys
from io import BytesIO
from calibre import as_unicode, prints
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES, XPath, css_text
from calibre... | 4,751 | Python | .py | 118 | 29.915254 | 86 | 0.574058 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,393 | main.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/main.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import re
import sys
import time
from collections import namedtuple
from functools import partial
from calibre.ebooks.oeb.polish.container import get_container
from cali... | 14,929 | Python | .py | 364 | 35.192308 | 121 | 0.66085 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,394 | replace.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/replace.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import codecs
import os
import posixpath
import shutil
from collections import Counter, defaultdict
from functools import partial
from calibre import sanitize_file_name
... | 15,346 | Python | .py | 352 | 33.954545 | 133 | 0.604016 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,395 | pretty.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/pretty.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import textwrap
# from lxml.etree import Element
from calibre import force_unicode
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES, SVG, XHTML, XPNSMAP, barename, serialize
from calibre.ebooks.oeb.pol... | 8,905 | Python | .py | 206 | 35.592233 | 139 | 0.61518 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,396 | tts.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/tts.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
import io
import json
import os
import sys
from collections import defaultdict
from contextlib import suppress
from functools import partial
from typing import NamedTuple
from lxml.etree import ElementBase as Element
from lx... | 24,511 | Python | .py | 526 | 33.81749 | 144 | 0.549219 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,397 | links.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/check/links.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import os
from collections import defaultdict
from threading import Thread
from calibre import browser
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES, XHTML_MIME, urlunquote
from calibre.ebooks.oeb.p... | 19,865 | Python | .py | 378 | 40.71164 | 146 | 0.591207 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,398 | images.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/check/images.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
from io import BytesIO
from PIL import Image
from calibre import as_unicode
from calibre.ebooks.oeb.polish.check.base import WARN, BaseError
from calibre.ebooks.oeb.polish.check.parsing import EmptyFile
from ... | 2,091 | Python | .py | 51 | 33.176471 | 90 | 0.629263 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,399 | parsing.py | kovidgoyal_calibre/src/calibre/ebooks/oeb/polish/check/parsing.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import re
from lxml.etree import XMLSyntaxError
from calibre import human_readable, prepare_string_for_xml
from calibre.ebooks.chardet import find_declared_encoding, replace_encoding_declarations
from calibre... | 16,405 | Python | .py | 341 | 38.665689 | 126 | 0.607557 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |