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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
26,500 | ui.pyj | kovidgoyal_calibre/src/pyj/book_list/ui.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals, bound_methods
from dom import ensure_id, clear
from elementmaker import E
from book_list.constants import book_list_container_id
from book_list.globals import get_current_query
from ... | 2,822 | Python | .py | 75 | 31.746667 | 123 | 0.677431 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,501 | __init__.pyj | kovidgoyal_calibre/src/pyj/book_list/__init__.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
| 98 | Python | .py | 2 | 48 | 72 | 0.770833 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,502 | edit_metadata.pyj | kovidgoyal_calibre/src/pyj/book_list/edit_metadata.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
import traceback
from ajax import ajax_send
from book_list.book_details import (
add_stars_to, basic_table_rules, fetch_metadata, field_s... | 46,048 | Python | .py | 1,048 | 36.444656 | 245 | 0.632478 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,503 | top_bar.pyj | kovidgoyal_calibre/src/pyj/book_list/top_bar.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals
from book_list.theme import get_color, get_font_size
from dom import set_css, clear, create_keyframes, build_rule, svgicon, add_extra_css
from elementmaker import E
from gettext import... | 5,449 | Python | .py | 114 | 39.140351 | 221 | 0.632005 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,504 | show_note.pyj | kovidgoyal_calibre/src/pyj/book_list/show_note.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from ajax import ajax
from book_list.comments_editor import (
create_comments_editor, destroy_editor, focus_comments_editor, get_comments... | 10,017 | Python | .py | 220 | 38.845455 | 177 | 0.669982 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,505 | globals.pyj | kovidgoyal_calibre/src/pyj/book_list/globals.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals
session_data = None
def set_session_data(sd):
nonlocal session_data
session_data = sd
return session_data
def get_session_data():
return session_data
def main_js(new... | 1,007 | Python | .py | 32 | 26.75 | 72 | 0.702282 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,506 | book_details.pyj | kovidgoyal_calibre/src/pyj/book_list/book_details.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals
from elementmaker import E
import traceback
from ajax import ajax, ajax_send, encode_query_component
from book_list.delete_book import refresh_after_delete, start_delete_book
from boo... | 41,857 | Python | .py | 874 | 38.065217 | 229 | 0.607522 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,507 | constants.pyj | kovidgoyal_calibre/src/pyj/viewer/constants.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
FAKE_PROTOCOL = '__FAKE_PROTOCOL__'
FAKE_HOST = '__FAKE_HOST__'
| 216 | Python | .py | 5 | 41.8 | 72 | 0.736842 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,508 | router.pyj | kovidgoyal_calibre/src/pyj/viewer/router.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from modals import close_all_modals
from utils import parse_url_params
def get_current_query(newval):
if newval:
get_current_query.ans = newval
return ... | 623 | Python | .py | 14 | 40.857143 | 151 | 0.735099 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,509 | hints.pyj | kovidgoyal_calibre/src/pyj/read_book/hints.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from dom import clear
from elementmaker import E
from book_list.theme import get_color
from gettext import gettext as _
from read_book.shortcuts import shortcut_for_key_... | 5,345 | Python | .py | 137 | 29.189781 | 123 | 0.592164 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,510 | search.pyj | kovidgoyal_calibre/src/pyj/read_book/search.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.globals import get_session_data
from book_list.theme import get_color
from book_list.top_bar import create_top_bar
from comple... | 16,807 | Python | .py | 384 | 33.473958 | 165 | 0.592737 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,511 | test_cfi.pyj | kovidgoyal_calibre/src/pyj/read_book/test_cfi.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from read_book.cfi import encode, decode, escape_for_cfi, unescape_from_cfi, cfi_for_selection
from testing import assert_equal, test
@test... | 5,805 | Python | .py | 113 | 46.283186 | 120 | 0.651745 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,512 | iframe.pyj | kovidgoyal_calibre/src/pyj/read_book/iframe.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
import traceback
from select import first_visible_word, is_start_closer_to_point, move_end_of_selection, selection_extents, word_at_point
from fs_images import fix_full... | 49,135 | Python | .py | 1,003 | 38.118644 | 204 | 0.629505 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,513 | view.pyj | kovidgoyal_calibre/src/pyj/read_book/view.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
import read_book.iframe # noqa
from ajax import ajax_send
from book_list.globals import get_session_data
from book_list.home import update_b... | 70,596 | Python | .py | 1,384 | 40.184971 | 220 | 0.622785 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,514 | bookmarks.pyj | kovidgoyal_calibre/src/pyj/read_book/bookmarks.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from book_list.item_list import build_list, create_item, create_side_action
from dom import ensure_id, set_c... | 3,092 | Python | .py | 60 | 45.333333 | 143 | 0.70756 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,515 | smil.pyj | kovidgoyal_calibre/src/pyj/read_book/smil.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from read_book.anchor_visibility import is_anchor_on_screen
from read_book.globals import get_boss
def flatten_seq(seq, par_list):
if seq.par:
for par in s... | 3,996 | Python | .py | 110 | 27.390909 | 98 | 0.582406 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,516 | goto.pyj | kovidgoyal_calibre/src/pyj/read_book/goto.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
import traceback
from elementmaker import E
from gettext import gettext as _
from ajax import encode_query_component
from book_list.item_list import build_list, create_... | 7,612 | Python | .py | 158 | 39.822785 | 203 | 0.636474 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,517 | mathjax.pyj | kovidgoyal_calibre/src/pyj/read_book/mathjax.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals
from elementmaker import E
from read_book.globals import runtime
def get_url(mathjax_files, name):
ans = mathjax_files[name]
if not ans:
return name
if jstype(an... | 3,967 | Python | .py | 93 | 32.365591 | 105 | 0.598756 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,518 | cfi.pyj | kovidgoyal_calibre/src/pyj/read_book/cfi.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals
# Based on code originally written by Peter Sorotkin
# http://code.google.com/p/epub-revision/source/browse/trunk/src/samples/cfi/epubcfi.js
#
# Improvements with respect to that co... | 35,311 | Python | .py | 848 | 33.353774 | 135 | 0.614571 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,519 | word_actions.pyj | kovidgoyal_calibre/src/pyj/read_book/word_actions.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from book_list.globals import get_session_data
from book_list.item_list import create_item, create_item_list... | 5,283 | Python | .py | 118 | 39.20339 | 110 | 0.682172 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,520 | read_aloud.pyj | kovidgoyal_calibre/src/pyj/read_book/read_aloud.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.globals import get_session_data
from book_list.theme import get_color
from dom import clear, svgicon, unique_id
from gettext i... | 8,974 | Python | .py | 222 | 30.617117 | 117 | 0.598256 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,521 | profiles.pyj | kovidgoyal_calibre/src/pyj/read_book/profiles.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.globals import get_session_data
from book_list.item_list import create_item, create_item_list, create_side_action
from book_li... | 4,575 | Python | .py | 104 | 36.971154 | 143 | 0.66472 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,522 | flow_mode.pyj | kovidgoyal_calibre/src/pyj/read_book/flow_mode.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
# Notes about flow mode scrolling:
# All the math in flow mode is based on the block and inline directions.
# Inline is "the direction lines of text go."
# In horizon... | 24,094 | Python | .py | 562 | 34.357651 | 144 | 0.641951 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,523 | annotations.pyj | kovidgoyal_calibre/src/pyj/read_book/annotations.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from gettext import gettext as _
from read_book.cfi import create_cfi_cmp, cfi_sort_key
from read_book.globals import ui_operations
no_cfi = '/99999999'
def bookmark... | 9,149 | Python | .py | 247 | 27.546559 | 112 | 0.583107 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,524 | search_worker.pyj | kovidgoyal_calibre/src/pyj/read_book/search_worker.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from read_book.db import DB
from read_book.resources import text_from_serialized_html
from traceback import format_exception
GET_SPINE_FAILED = 1
CONNECT_FAILED = 2
UNH... | 9,143 | Python | .py | 240 | 29.6375 | 134 | 0.588089 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,525 | footnotes.pyj | kovidgoyal_calibre/src/pyj/read_book/footnotes.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from dom import clear
from iframe_comm import IframeClient
from read_book.globals import runtime, current_spine_item, set_current_spine_item
from read_book.resources imp... | 11,442 | Python | .py | 254 | 35.92126 | 147 | 0.631867 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,526 | content_popup.pyj | kovidgoyal_calibre/src/pyj/read_book/content_popup.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from dom import add_extra_css, build_rule, clear, svgicon
from iframe_comm import create_wrapped_iframe
from... | 7,159 | Python | .py | 159 | 36.245283 | 154 | 0.63176 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,527 | settings.pyj | kovidgoyal_calibre/src/pyj/read_book/settings.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals
from elementmaker import E
from read_book.globals import dark_link_color, runtime
from session import session_defaults
opts = {}
def update_settings(settings):
settings = Object... | 8,966 | Python | .py | 188 | 40.090426 | 160 | 0.663619 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,528 | resources.pyj | kovidgoyal_calibre/src/pyj/read_book/resources.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals
from elementmaker import E
from encodings import base64decode, utf8_decode
from dom import clear, remove_all_attributes
from read_book.globals import runtime, ui_operations
from read_... | 16,865 | Python | .py | 405 | 31.975309 | 218 | 0.596527 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,529 | selection_bar.pyj | kovidgoyal_calibre/src/pyj/read_book/selection_bar.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.globals import get_session_data
from book_list.theme import get_color
from dom import change_icon_image, clear, svgicon, uniqu... | 48,834 | Python | .py | 1,068 | 34.147004 | 172 | 0.574532 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,530 | gestures.pyj | kovidgoyal_calibre/src/pyj/read_book/gestures.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from read_book.touch import GESTURE
from read_book.settings import opts
from gettext import gettext as _
def get_action_descriptions():
if not get_action_descripti... | 5,607 | Python | .py | 116 | 38.482759 | 137 | 0.608212 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,531 | referencing.pyj | kovidgoyal_calibre/src/pyj/read_book/referencing.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
# noqa: eol-semicolon
from __python__ import bound_methods, hash_literals
from read_book.globals import current_spine_item
def elem_for_ref(refnum):
refnum = int(refnum)
return document.getElementsByTagName('p')[... | 658 | Python | .py | 15 | 40.333333 | 72 | 0.740973 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,532 | open_book.pyj | kovidgoyal_calibre/src/pyj/read_book/open_book.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.globals import get_session_data
from book_list.item_list import create_item, create_item_list
from dom import clear, unique_id... | 3,265 | Python | .py | 78 | 35.141026 | 129 | 0.671919 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,533 | shortcuts.pyj | kovidgoyal_calibre/src/pyj/read_book/shortcuts.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from gettext import gettext as _
from read_book.globals import runtime
def parse_key_repr(sc):
parts = sc.split('+')
if sc.endsWith('++'):
parts = par... | 12,517 | Python | .py | 429 | 21.594406 | 139 | 0.526935 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,534 | ui.pyj | kovidgoyal_calibre/src/pyj/read_book/ui.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
# globals: __RENDER_VERSION__
from __python__ import hash_literals
from elementmaker import E
import traceback
from ajax import ajax, ajax_send
from book_list.constants import read_book_container_id
from book_list.librar... | 30,667 | Python | .py | 620 | 37.993548 | 171 | 0.60321 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,535 | __init__.pyj | kovidgoyal_calibre/src/pyj/read_book/__init__.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
| 101 | Python | .py | 2 | 48 | 72 | 0.770833 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,536 | highlights.pyj | kovidgoyal_calibre/src/pyj/read_book/highlights.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from ajax import encode_query
from book_list.globals import get_current_query, get_session_data
from book_list.theme import get_color
from co... | 38,499 | Python | .py | 873 | 33.864834 | 154 | 0.584085 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,537 | toc.pyj | kovidgoyal_calibre/src/pyj/read_book/toc.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals
from elementmaker import E
from complete import create_search_bar
from dom import ensure_id, set_css, svgicon
from gettext import gettext as _
from modals import error_dialog
from rea... | 11,881 | Python | .py | 308 | 30.808442 | 178 | 0.62564 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,538 | paged_mode.pyj | kovidgoyal_calibre/src/pyj/read_book/paged_mode.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
# Notes of paged mode scrolling:
# All the math in paged mode is based on the block and inline directions.
# Inline is "the direction lines of text go."
# In horizontal scripts such as English and Hebrew, the inline is... | 38,037 | Python | .py | 823 | 38.144593 | 226 | 0.650749 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,539 | touch.pyj | kovidgoyal_calibre/src/pyj/read_book/touch.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from gettext import gettext as _
from read_book.globals import get_boss, ltr_page_progression, ui_operations
from read_book.settings import opts
from read_book.viewport ... | 15,720 | Python | .py | 344 | 36.363372 | 142 | 0.623556 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,540 | anchor_visibility.pyj | kovidgoyal_calibre/src/pyj/read_book/anchor_visibility.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2023, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from read_book.globals import current_layout_mode, get_boss
from read_book.viewport import scroll_viewport
anchor_position_cache = {}
def invalidate_anchor_position_ca... | 1,904 | Python | .py | 46 | 35.630435 | 136 | 0.69464 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,541 | db.pyj | kovidgoyal_calibre/src/pyj/read_book/db.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from encodings import base64decode, base64encode
from gettext import gettext as _
from book_list.router import is_reading_book
from modals import error_dialog
from read... | 19,306 | Python | .py | 418 | 35.009569 | 164 | 0.588582 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,542 | find.pyj | kovidgoyal_calibre/src/pyj/read_book/find.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
ignored_tags = {
'style': True, 'script': True, 'noscript': True, 'title': True, 'meta': True, 'head': True, 'link': True, 'html': True,
'img': True, 'rt': True,... | 7,181 | Python | .py | 180 | 31.377778 | 184 | 0.595149 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,543 | read_audio_ebook.pyj | kovidgoyal_calibre/src/pyj/read_book/read_audio_ebook.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2023, DO LE DUY <duy.dole.00ece at gmail.com>
# Public domain audio eBooks can be found on https://www.readbeyond.it/ebooks.html.
# ReadBeyond also offers Aeneas (https://github.com/readbeyond/aeneas),
# an open-source tool for force-alignment of audio and text to... | 14,362 | Python | .py | 326 | 32.745399 | 237 | 0.585544 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,544 | tts.pyj | kovidgoyal_calibre/src/pyj/read_book/tts.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from dom import unique_id
from gettext import gettext as _
from book_list.globals import get_session_data
from modals import create_custom_di... | 10,993 | Python | .py | 252 | 31.742063 | 179 | 0.569306 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,545 | timers.pyj | kovidgoyal_calibre/src/pyj/read_book/timers.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from read_book.globals import ui_operations
THRESHOLD = 5
FILTER_THRESHOLD = 25
MAX_SAMPLES = 256
class Timers:
def __init__(self):
self.reset_read_timer(... | 2,211 | Python | .py | 59 | 28.254237 | 101 | 0.575362 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,546 | scrollbar.pyj | kovidgoyal_calibre/src/pyj/read_book/scrollbar.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.globals import get_session_data
from book_list.theme import cached_color_to_rgba
from dom import unique_id
from read_book.glob... | 5,252 | Python | .py | 109 | 38.119266 | 128 | 0.611751 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,547 | extract.pyj | kovidgoyal_calibre/src/pyj/read_book/extract.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from read_book.globals import annot_id_uuid_map
def get_elements(x, y):
nonlocal img_id_counter
ans = {'link': None, 'img': None, 'highlight': None, 'crw': No... | 929 | Python | .py | 19 | 41.157895 | 102 | 0.655629 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,548 | viewport.pyj | kovidgoyal_calibre/src/pyj/read_book/viewport.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
FUNCTIONS = 'x y scroll_to scroll_into_view reset_globals __reset_transforms window_scroll_pos content_size'.split(' ')
from read_book.globals import get_boss, viewport... | 12,831 | Python | .py | 320 | 31.278125 | 119 | 0.629368 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,549 | globals.pyj | kovidgoyal_calibre/src/pyj/read_book/globals.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals
from aes import random_bytes
from encodings import hexlify
from gettext import gettext as _, register_callback, gettext as gt
_boss = None
dark_link_color = '__DARK_LINK_COLOR__'
de... | 3,457 | Python | .py | 97 | 31.56701 | 110 | 0.677177 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,550 | overlay.pyj | kovidgoyal_calibre/src/pyj/read_book/overlay.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.book_details import CLASS_NAME as BD_CLASS_NAME, render_metadata
from book_list.globals import get_session_data
from book_list... | 36,450 | Python | .py | 756 | 36.588624 | 192 | 0.588497 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,551 | selection.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/selection.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.globals import get_session_data
from complete import create_simple_input_with_history
from dom import clear, svgicon, unique_i... | 10,196 | Python | .py | 225 | 38.031111 | 139 | 0.649315 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,552 | misc.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/misc.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.globals import get_session_data
from dom import unique_id
from gettext import gettext as _
from read_book.globals import ui_op... | 3,972 | Python | .py | 73 | 48.753425 | 133 | 0.710018 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,553 | font_size.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/font_size.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from book_list.globals import get_session_data
from book_list.theme import get_color
from dom import add_ext... | 4,806 | Python | .py | 119 | 33.638655 | 130 | 0.639502 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,554 | main.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/main.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.item_list import build_list, create_item
from book_list.top_bar import create_top_bar, set_title
from dom import clear, ensure... | 6,840 | Python | .py | 141 | 40.48227 | 102 | 0.670571 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,555 | user_stylesheet.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/user_stylesheet.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from ajax import absolute_path
from book_list.globals import get_session_data
from dom import ensure_id, unique_id
from encodings import hexl... | 6,906 | Python | .py | 146 | 39.356164 | 136 | 0.647164 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,556 | keyboard.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/keyboard.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from book_list.globals import get_session_data
from complete import create_search_bar
from book_list.item_li... | 8,680 | Python | .py | 185 | 39.227027 | 161 | 0.66446 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,557 | layout.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/layout.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from book_list.globals import get_session_data
from dom import add_extra_css, build_rule, element, unique_id... | 8,191 | Python | .py | 153 | 46.281046 | 160 | 0.643258 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,558 | fonts.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/fonts.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from book_list.globals import get_session_data
from dom import unique_id
from read_book.globals import runti... | 4,660 | Python | .py | 98 | 42.030612 | 136 | 0.682851 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,559 | scrolling.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/scrolling.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from book_list.globals import get_session_data
from dom import unique_id
from read_book.prefs.utils import c... | 5,658 | Python | .py | 123 | 37.691057 | 160 | 0.654028 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,560 | colors.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/colors.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from book_list.globals import get_session_data
from book_list.theme import cached_color_to_rgba
from dom imp... | 12,838 | Python | .py | 273 | 38.992674 | 170 | 0.623683 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,561 | touch.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/touch.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from book_list.globals import get_session_data
from dom import unique_id
from gettext import gettext as _
from read_book.gestures import (
... | 7,469 | Python | .py | 150 | 43.026667 | 129 | 0.694574 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,562 | utils.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/utils.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from widgets import create_button
def create_button_box(restore_defaults_func, apply_func, cancel_func):
... | 948 | Python | .py | 20 | 42.4 | 131 | 0.698052 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,563 | head_foot.pyj | kovidgoyal_calibre/src/pyj/read_book/prefs/head_foot.pyj | # vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from elementmaker import E
from gettext import gettext as _
from gettext import ngettext
from book_list.globals import get_session_data
from dom import clear, unique_id... | 9,264 | Python | .py | 227 | 32.577093 | 158 | 0.59669 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,564 | rpdb.py | kovidgoyal_calibre/src/calibre/rpdb.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import atexit
import inspect
import os
import pdb
import select
import socket
import sys
import time
from contextlib import suppress
from calibre.constants import cache_dir
PROMPT = '(debug) '
QUESTION = '\x0... | 5,121 | Python | .py | 144 | 26.104167 | 116 | 0.573764 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,565 | linux.py | kovidgoyal_calibre/src/calibre/linux.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2008, Kovid Goyal <kovid at kovidgoyal.net>
''' Post installation script for linux '''
import errno
import os
import stat
import sys
import textwrap
from functools import partial
from subprocess import check_call, check_output
from calibre import CurrentDir, __appnam... | 52,404 | Python | .py | 1,191 | 34.085642 | 484 | 0.568267 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,566 | libunzip.py | kovidgoyal_calibre/src/calibre/libunzip.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
import re
from calibre.utils import zipfile
from calibre.utils.icu import numeric_sort_key
def update(pathtozip, patterns, filepaths, names, compression=zipfile.ZIP_DEFLATED... | 2,753 | Python | .py | 62 | 36.016129 | 109 | 0.62963 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,567 | ptempfile.py | kovidgoyal_calibre/src/calibre/ptempfile.py | __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
"""
Provides platform independent temporary files that persist even after
being closed.
"""
import atexit
import os
import tempfile
from calibre.constants import __appname__, __version__, filesystem_encoding, get_windows_temp_path, ... | 8,287 | Python | .py | 232 | 26.767241 | 121 | 0.581436 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,568 | live.py | kovidgoyal_calibre/src/calibre/live.py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import ast
import gzip
import os
import re
import sys
import types
from contextlib import suppress
from datetime import timedelta
from enum import Enum, auto
from http import HTTPStatus
from importlib import import_module
fr... | 11,427 | Python | .py | 275 | 34.043636 | 139 | 0.655275 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,569 | gui_launch.py | kovidgoyal_calibre/src/calibre/gui_launch.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import os
import sys
# For some reason Qt 5 crashes on some linux systems if the fork() is done
# after the Qt modules are loaded in calibre.gui2. We also cannot do a fork()
# while python is importing a modul... | 4,855 | Python | .py | 140 | 28.242857 | 109 | 0.669091 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,570 | test_build.py | kovidgoyal_calibre/src/calibre/test_build.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
'''
Test a binary calibre build to ensure that all needed binary images/libraries have loaded.
'''
import builtins
import ctypes
import os
import shutil
import sys
import t... | 24,084 | Python | .py | 517 | 37.046422 | 153 | 0.637811 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,571 | prints.py | kovidgoyal_calibre/src/calibre/prints.py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
import io
import sys
import time
from polyglot.builtins import as_bytes, as_unicode
def is_binary(stream):
mode = getattr(stream, 'mode', None)
if mode:
return 'b' in mode
return not isinstance(stream,... | 2,618 | Python | .py | 68 | 32.132353 | 116 | 0.652345 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,572 | constants.py | kovidgoyal_calibre/src/calibre/constants.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
import codecs
import collections
import collections.abc
import locale
import os
import sys
from functools import lru_cache
from polyglot.builtins import environ_item, hasenv
__appname__ = 'calibre'
numeric_version = (7, 20... | 15,639 | Python | .py | 433 | 28.919169 | 121 | 0.631997 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,573 | startup.py | kovidgoyal_calibre/src/calibre/startup.py | __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
Perform various initialization tasks.
'''
import locale
import os
import sys
# Default translation is NOOP
from polyglot.builtins import builtins
builtins.__dict__['_'] = lambda s: s
# For st... | 6,371 | Python | .py | 157 | 32.477707 | 106 | 0.633673 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,574 | __init__.py | kovidgoyal_calibre/src/calibre/__init__.py | ''' E-book management software'''
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os
import re
import sys
import time
import warnings
from functools import lru_cache, partial
from math import floor
from polyglot.builtins import codepoint... | 18,887 | Python | .py | 494 | 31.030364 | 125 | 0.629259 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,575 | debug.py | kovidgoyal_calibre/src/calibre/debug.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
Embedded console for debugging.
'''
import functools
import os
import sys
from calibre import prints
from calibre.constants import iswindows
from calibre.startup import get_debug_executable
from calibre.... | 14,209 | Python | .py | 301 | 39.48505 | 141 | 0.642661 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,576 | build_forms.py | kovidgoyal_calibre/src/calibre/build_forms.py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import importlib
import os
def form_to_compiled_form(form):
return form.rpartition('.')[0]+'_ui.py'
def find_forms(srcdir):
base = os.path.join(srcdir, 'calibre', 'gui2')
forms = []
for root, _, files in ... | 3,603 | Python | .py | 78 | 37.897436 | 122 | 0.608039 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,577 | users.py | kovidgoyal_calibre/src/calibre/srv/users.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
import json
import os
import re
from functools import lru_cache
from threading import RLock
import apsw
from calibre import as_unicode
from calibre.constants import config_dir
from calibre.utils.config import from_json, to... | 9,968 | Python | .py | 222 | 33.630631 | 128 | 0.578351 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,578 | http_response.py | kovidgoyal_calibre/src/calibre/srv/http_response.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import errno
import hashlib
import os
import struct
import time
import uuid
from collections import namedtuple
from functools import wraps
from io import DEFAULT_BUFFER_SIZE, BytesIO
from itertools import chain... | 29,658 | Python | .py | 647 | 35.721793 | 153 | 0.604263 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,579 | content.py | kovidgoyal_calibre/src/calibre/srv/content.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import base64
import errno
import os
import re
from contextlib import suppress
from functools import partial
from io import BytesIO
from json import load as load_json_file
from threading import Lock
from calib... | 20,233 | Python | .py | 457 | 36.133479 | 139 | 0.620048 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,580 | errors.py | kovidgoyal_calibre/src/calibre/srv/errors.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import http.client as http_client
class JobQueueFull(Exception):
pass
class RouteError(ValueError):
pass
class HTTPSimpleResponse(Exception):
def __init__(self, http_code, http_message='', cl... | 2,743 | Python | .py | 46 | 53.847826 | 119 | 0.738427 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,581 | opts.py | kovidgoyal_calibre/src/calibre/srv/opts.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import errno
import numbers
import os
from collections import OrderedDict, namedtuple
from functools import partial
from itertools import zip_longest
from operator import attrgetter
from calibre.constants impo... | 12,784 | Python | .py | 268 | 41.496269 | 123 | 0.667256 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,582 | bonjour.py | kovidgoyal_calibre/src/calibre/srv/bonjour.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
from threading import Event
class BonJour: # {{{
def __init__(self, name='Books in calibre', service_type='_calibre._tcp', path='/opds', add_hostname=True, wait_for_stop=True):
self.service_name... | 1,586 | Python | .py | 37 | 34.486486 | 131 | 0.614286 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,583 | pool.py | kovidgoyal_calibre/src/calibre/srv/pool.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import sys
from threading import Thread
from calibre.utils.monotonic import monotonic
from polyglot.queue import Full, Queue
class Worker(Thread):
daemon = True
def __init__(self, log, notify_serve... | 3,705 | Python | .py | 98 | 27.602041 | 118 | 0.573304 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,584 | opds.py | kovidgoyal_calibre/src/calibre/srv/opds.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import hashlib
from collections import OrderedDict, namedtuple
from functools import partial
from html5_parser import parse
from lxml import etree
from lxml.builder import ... | 24,031 | Python | .py | 529 | 37.245747 | 137 | 0.622959 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,585 | http_request.py | kovidgoyal_calibre/src/calibre/srv/http_request.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import re
from io import DEFAULT_BUFFER_SIZE, BytesIO
from calibre import as_unicode, force_unicode
from calibre.ptempfile import SpooledTemporaryFile
from calibre.srv.errors import HTTPSimpleResponse
from cal... | 15,867 | Python | .py | 350 | 35.745714 | 125 | 0.610669 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,586 | cdb.py | kovidgoyal_calibre/src/calibre/srv/cdb.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import os
import shutil
import time
from functools import partial
from io import BytesIO
from calibre import as_unicode, sanitize_file_name
from calibre.db.cli import module_for_cmd
from calibre.ebooks.metadata.meta import ... | 12,155 | Python | .py | 240 | 43.029167 | 126 | 0.66036 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,587 | code.py | kovidgoyal_calibre/src/calibre/srv/code.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
import hashlib
import random
import shutil
import sys
import zipfile
from json import load as load_json_file
from json import loads as json_loads
from threading import Lock
from calibre import as_unicode
from calibre.consta... | 17,651 | Python | .py | 410 | 35.617073 | 122 | 0.625116 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,588 | last_read.py | kovidgoyal_calibre/src/calibre/srv/last_read.py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2022, Kovid Goyal <kovid at kovidgoyal.net>
import os
from contextlib import suppress
from threading import Lock
from time import time_ns
import apsw
from calibre.constants import cache_dir
creation_sql = '''
CREATE TABLE IF NOT EXISTS last_read_positions ( id INTE... | 3,033 | Python | .py | 70 | 34.214286 | 146 | 0.605361 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,589 | library_broker.py | kovidgoyal_calibre/src/calibre/srv/library_broker.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import os
from collections import OrderedDict, defaultdict
from threading import RLock as Lock
from calibre import filesystem_encoding
from calibre.db.cache import Cache
from calibre.db.legacy import LibraryDatabase, create... | 12,345 | Python | .py | 294 | 31.214286 | 94 | 0.591731 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,590 | books.py | kovidgoyal_calibre/src/calibre/srv/books.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import errno
import json as jsonlib
import os
import tempfile
import time
from functools import partial
from hashlib import sha1
from threading import Lock, RLock
from calibre.constants import cache_dir, iswindows
from cali... | 11,358 | Python | .py | 265 | 35.656604 | 126 | 0.629921 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,591 | convert.py | kovidgoyal_calibre/src/calibre/srv/convert.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import os
import shutil
import tempfile
from threading import Lock
from calibre.customize.ui import input_profiles, output_profiles, run_plugins_on_postconvert
from calibre.db.errors import NoSuchBook
from calibre.srv.chang... | 11,530 | Python | .py | 252 | 37.876984 | 134 | 0.645724 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,592 | legacy.py | kovidgoyal_calibre/src/calibre/srv/legacy.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from functools import partial
from lxml.html import tostring
from lxml.html.builder import E as E_
from calibre import strftime
from calibre.constants import __appname__
from calibre.db.view import sanitize_sort_field_name... | 11,384 | Python | .py | 242 | 39.107438 | 154 | 0.613054 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,593 | auth.py | kovidgoyal_calibre/src/calibre/srv/auth.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import os
import random
import struct
from collections import OrderedDict
from hashlib import md5, sha256
from itertools import permutations
from threading import Lock
from calibre.srv.errors import HTTPAuthRe... | 13,282 | Python | .py | 266 | 40.454887 | 154 | 0.629021 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,594 | utils.py | kovidgoyal_calibre/src/calibre/srv/utils.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import errno
import os
import socket
from email.utils import formatdate
from operator import itemgetter
from calibre import prints
from calibre.constants import iswindows
from calibre.srv.errors import HTTPNot... | 13,857 | Python | .py | 373 | 28.941019 | 117 | 0.604766 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,595 | metadata.py | kovidgoyal_calibre/src/calibre/srv/metadata.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
import os
from collections import namedtuple
from copy import copy
from datetime import datetime, time
from functools import partial
from threading import Lock
from calibre.constants import config_dir
from calibre.db.catego... | 26,357 | Python | .py | 544 | 38.455882 | 142 | 0.606388 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,596 | manage_users_cli.py | kovidgoyal_calibre/src/calibre/srv/manage_users_cli.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import sys
from functools import partial
from calibre import prints
from calibre.constants import iswindows, preferred_encoding
from calibre.utils.config import OptionParser
from calibre.utils.localization import _, ngettext... | 15,896 | Python | .py | 373 | 32.533512 | 125 | 0.569297 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,597 | users_api.py | kovidgoyal_calibre/src/calibre/srv/users_api.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import json
from calibre import as_unicode
from calibre.srv.errors import HTTPBadRequest, HTTPForbidden
from calibre.srv.routes import endpoint
from calibre.srv.users import validate_password
from calibre.utils.localization... | 1,154 | Python | .py | 29 | 34.896552 | 82 | 0.721429 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,598 | standalone.py | kovidgoyal_calibre/src/calibre/srv/standalone.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
import json
import os
import signal
import sys
from calibre import as_unicode
from calibre.constants import is_running_from_develop, ismacos, iswindows
from calibre.db.legacy import LibraryDatabase
from calibre.srv.bonjour ... | 9,685 | Python | .py | 218 | 36.275229 | 148 | 0.64947 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
26,599 | pre_activated.py | kovidgoyal_calibre/src/calibre/srv/pre_activated.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
# Support server pre-activation, such as with systemd's socket activation
import errno
import socket
from calibre.constants import islinux
def pre_activated_socket():
return None
has_preactivated_supp... | 2,182 | Python | .py | 52 | 33.211538 | 113 | 0.620804 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |