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,800 | cli.py | kovidgoyal_calibre/src/calibre/devices/usbms/cli.py | __license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import os
import shutil
import time
from calibre import fsync
from calibre.devices.errors import PathError
from calibre.utils.filenames import case_preserving_open_file
class File:
def __... | 3,609 | Python | .py | 90 | 30.788889 | 85 | 0.592349 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,801 | books.py | kovidgoyal_calibre/src/calibre/devices/usbms/books.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import os
import re
import sys
import time
from functools import cmp_to_key
from calibre import force_unicode, isbytestring
from calibre.constants import preferred_encoding
from calibre.devices.int... | 12,760 | Python | .py | 285 | 31.470175 | 88 | 0.540534 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,802 | driver.py | kovidgoyal_calibre/src/calibre/devices/usbms/driver.py | __license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john at nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Generic USB Mass storage device driver. This is not a complete stand alone
driver. It is intended to be subclassed with the relevant parts implemented
for a particular device.
'''
import ... | 24,387 | Python | .py | 485 | 37.552577 | 114 | 0.581847 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,803 | deviceconfig.py | kovidgoyal_calibre/src/calibre/devices/usbms/deviceconfig.py | __license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
from calibre.utils.config_base import Config, ConfigProxy
class DeviceConfig:
HELP_MESSAGE = _('Configure device')
#: Can be None, a string or a list of strings. When it is a string
... | 6,191 | Python | .py | 126 | 39.238095 | 118 | 0.639312 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,804 | __init__.py | kovidgoyal_calibre/src/calibre/web/__init__.py | __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
class Recipe:
pass
def get_download_filename_from_response(response):
from polyglot.urllib import unquote, urlparse
filename = last_part_name = ''
try:
purl = urlparse(response.geturl())
last_part_... | 1,856 | Python | .py | 51 | 27.019608 | 71 | 0.578595 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,805 | nytimes.py | kovidgoyal_calibre/src/calibre/web/site_parsers/nytimes.py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2022, Kovid Goyal <kovid at kovidgoyal.net>
import json
import re
import sys
from pprint import pprint
from xml.sax.saxutils import escape, quoteattr
from calibre.utils.iso8601 import parse_iso8601
module_version = 11 # needed for live updates
pprint
def parse_im... | 10,118 | Python | .py | 263 | 30.745247 | 98 | 0.54999 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,806 | natgeo.py | kovidgoyal_calibre/src/calibre/web/site_parsers/natgeo.py | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
import json
from pprint import pprint
from calibre import prepare_string_for_xml as escape
from calibre.utils.iso8601 import parse_iso8601
module_version = 1 # needed for live updates
pprint
def extract_json(... | 6,472 | Python | .py | 159 | 29.805031 | 89 | 0.492926 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,807 | utils.py | kovidgoyal_calibre/src/calibre/web/fetch/utils.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from calibre.utils.img import blend_on_canvas, image_from_data, image_to_data, scale_image
def rescale_image(data, scale_news_images, compress_news_images_max_size, compress_news_images_auto_size):
orig_data = data # ... | 1,885 | Python | .py | 39 | 41.974359 | 106 | 0.66503 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,808 | simple.py | kovidgoyal_calibre/src/calibre/web/fetch/simple.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
Fetch a webpage and its links recursively. The webpages are saved to disk in
UTF-8 encoding with any charset declarations removed.
'''
import os
import re
import socket
import sys
import threading
impor... | 28,019 | Python | .py | 593 | 33.418212 | 146 | 0.543048 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,809 | __init__.py | kovidgoyal_calibre/src/calibre/web/fetch/__init__.py | __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
| 87 | Python | .py | 2 | 42.5 | 61 | 0.647059 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,810 | templates.py | kovidgoyal_calibre/src/calibre/web/feeds/templates.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
import copy
from lxml import etree, html
from lxml.html.builder import BODY, BR, DIV, H2, H3, HEAD, HR, HTML, IMG, LI, SPAN, STRONG, STYLE, TABLE, TD, TITLE, TR, UL, A
from lxml.html.builder import P as PT
... | 15,799 | Python | .py | 363 | 31.584022 | 126 | 0.534903 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,811 | __init__.py | kovidgoyal_calibre/src/calibre/web/feeds/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
Contains the logic for parsing feeds.
'''
import copy
import re
import time
import traceback
from builtins import _
from calibre import force_unicode, replace_entities, strftime
from calibre.utils.cleante... | 12,640 | Python | .py | 319 | 29.178683 | 105 | 0.555266 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,812 | news.py | kovidgoyal_calibre/src/calibre/web/feeds/news.py | __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
Defines various abstract base classes that can be subclassed to create powerful news fetching recipes.
'''
__docformat__ = "restructuredtext en"
import io
import os
import re
import sys
import time
import traceback
from collect... | 83,763 | Python | .py | 1,729 | 37.218623 | 160 | 0.593016 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,813 | collection.py | kovidgoyal_calibre/src/calibre/web/feeds/recipes/collection.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import calendar
import json
import os
import zipfile
from datetime import timedelta
from threading import RLock
from typing import Dict, NamedTuple, Optional, Sequence
from... | 22,209 | Python | .py | 529 | 30.15879 | 126 | 0.547884 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,814 | __init__.py | kovidgoyal_calibre/src/calibre/web/feeds/recipes/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
Builtin recipes.
'''
import io
import re
import time
from calibre.ebooks.BeautifulSoup import BeautifulSoup
from calibre.utils.config import JSONConfig
from calibre.web.feeds.news import AutomaticNewsRecip... | 2,081 | Python | .py | 51 | 34.45098 | 109 | 0.667328 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,815 | model.py | kovidgoyal_calibre/src/calibre/web/feeds/recipes/model.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2009, Kovid Goyal <kovid at kovidgoyal.net>
import copy
import zipfile
from functools import total_ordering
from qt.core import QAbstractItemModel, QApplication, QFont, QIcon, QModelIndex, QPalette, QPixmap, Qt, pyqtSignal
from calibre import force_unicode
from calib... | 15,099 | Python | .py | 363 | 31.548209 | 114 | 0.605227 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,816 | break_iterator.py | kovidgoyal_calibre/src/calibre/spell/break_iterator.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from threading import Lock
from calibre.utils.icu import _icu
from calibre.utils.localization import lang_as_iso639_1
_iterators = {}
_sentence_iterators = {}
_lock = Lock()
def get_iterator(lang):
it =... | 4,087 | Python | .py | 106 | 31 | 145 | 0.605063 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,817 | __init__.py | kovidgoyal_calibre/src/calibre/spell/__init__.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from collections import namedtuple
from calibre.utils.localization import canonicalize_lang, load_iso3166
DictionaryLocale = namedtuple('DictionaryLocale', 'langcode countrycode')
def get_codes():
data ... | 916 | Python | .py | 27 | 28 | 73 | 0.622727 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,818 | import_from.py | kovidgoyal_calibre/src/calibre/spell/import_from.py | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import codecs
import glob
import os
import re
import sys
import tempfile
from lxml import etree
from calibre import browser
from calibre.constants import config_dir
from calibre.utils.resources import get_pat... | 7,432 | Python | .py | 150 | 41.006667 | 143 | 0.617497 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,819 | dictionary.py | kovidgoyal_calibre/src/calibre/spell/dictionary.py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2014, Kovid Goyal <kovid at kovidgoyal.net>
import glob
import json
import os
import re
import shutil
import sys
from collections import defaultdict, namedtuple
from functools import partial
from itertools import chain
from calibre import prints
from calibre.constant... | 18,220 | Python | .py | 402 | 34.803483 | 146 | 0.604318 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,820 | errors.py | kovidgoyal_calibre/src/css_selectors/errors.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
class SelectorError(ValueError):
"""Common parent for SelectorSyntaxError and ExpressionError"""
class SelectorSyntaxError(SelectorError):
"""Parsing a selector that does not... | 445 | Python | .py | 10 | 41.5 | 67 | 0.754098 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,821 | select.py | kovidgoyal_calibre/src/css_selectors/select.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import itertools
import re
from collections import OrderedDict, defaultdict
from functools import wraps
from itertools import chain
from lxml import etree
from css_selectors.errors im... | 22,345 | Python | .py | 553 | 32.381555 | 144 | 0.632488 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,822 | ordered_set.py | kovidgoyal_calibre/src/css_selectors/ordered_set.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import collections.abc
from polyglot.builtins import string_or_bytes
SLICE_ALL = slice(None)
def is_iterable(obj):
"""
Are we being asked to look up a list of things, instea... | 4,014 | Python | .py | 107 | 28.560748 | 79 | 0.584794 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,823 | __init__.py | kovidgoyal_calibre/src/css_selectors/__init__.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
from css_selectors.errors import ExpressionError, SelectorError, SelectorSyntaxError
from css_selectors.parser import parse
from css_selectors.select import INAPPROPRIATE_PSEUDO_CLASSES... | 451 | Python | .py | 8 | 54.875 | 120 | 0.783599 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,824 | tests.py | kovidgoyal_calibre/src/css_selectors/tests.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import argparse
import sys
import unittest
from lxml import etree, html
from css_selectors.errors import ExpressionError, SelectorSyntaxError
from css_selectors.parser import parse, t... | 37,012 | Python | .py | 800 | 40.1175 | 129 | 0.599027 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,825 | parser.py | kovidgoyal_calibre/src/css_selectors/parser.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
"""
Tokenizer, parser and parsed objects for CSS selectors.
:copyright: (c) 2007-2012 Ian Bicking and contributors.
See AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import operator
import re
import string
import ... | 23,816 | Python | .py | 644 | 28.076087 | 94 | 0.528272 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,826 | core_name_map.py | kovidgoyal_calibre/src/qt/core_name_map.py | # autogenerated by __main__.py do not edit
name_map = {'PYQT_VERSION': 'PyQt6.QtCore',
'PYQT_VERSION_STR': 'PyQt6.QtCore',
'QAbstractAnimation': 'PyQt6.QtCore',
'QAbstractButton': 'PyQt6.QtWidgets',
'QAbstractEventDispatcher': 'PyQt6.QtCore',
'QAbstractFileIconProvider': 'PyQt6.QtGui',
'QAbstractGraphicsShapeItem... | 28,190 | Python | .py | 784 | 33.961735 | 53 | 0.743852 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,827 | __main__.py | kovidgoyal_calibre/src/qt/__main__.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import importlib
import os
from pprint import pprint
QT_WRAPPER = 'PyQt6'
base = os.path.dirname(os.path.abspath(__file__))
module_lists = {
'core': (
'QtCore',
'QtGui',
... | 2,720 | Python | .py | 80 | 27.725 | 83 | 0.592395 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,828 | dbus.pyi | kovidgoyal_calibre/src/qt/dbus.pyi | # autogenerated by __main__.py do not edit
import PyQt6.QtDBus
QDBus = PyQt6.QtDBus.QDBus
QDBusAbstractAdaptor = PyQt6.QtDBus.QDBusAbstractAdaptor
QDBusAbstractInterface = PyQt6.QtDBus.QDBusAbstractInterface
QDBusArgument = PyQt6.QtDBus.QDBusArgument
QDBusConnection = PyQt6.QtDBus.QDBusConnection
QDBusConnectionInterfa... | 936 | Python | .py | 20 | 45.85 | 64 | 0.886587 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,829 | webengine_name_map.py | kovidgoyal_calibre/src/qt/webengine_name_map.py | # autogenerated by __main__.py do not edit
name_map = {'PYQT_WEBENGINE_VERSION': 'PyQt6.QtWebEngineCore',
'PYQT_WEBENGINE_VERSION_STR': 'PyQt6.QtWebEngineCore',
'QWebEngineCertificateError': 'PyQt6.QtWebEngineCore',
'QWebEngineClientCertificateSelection': 'PyQt6.QtWebEngineCore',
'QWebEngineClientCertificateStore':... | 2,456 | Python | .py | 46 | 51.478261 | 69 | 0.824896 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,830 | dbus.py | kovidgoyal_calibre/src/qt/dbus.py | # autogenerated by __main__.py do not edit
from .dbus_name_map import module_names, name_map
from .loader import dynamic_load
already_imported = {}
qt_modules = {}
def __getattr__(name):
return dynamic_load(name, name_map, already_imported, qt_modules, module_names)
| 273 | Python | .py | 7 | 37.142857 | 83 | 0.746212 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,831 | dbus_name_map.py | kovidgoyal_calibre/src/qt/dbus_name_map.py | # autogenerated by __main__.py do not edit
name_map = {'QDBus': 'PyQt6.QtDBus',
'QDBusAbstractAdaptor': 'PyQt6.QtDBus',
'QDBusAbstractInterface': 'PyQt6.QtDBus',
'QDBusArgument': 'PyQt6.QtDBus',
'QDBusConnection': 'PyQt6.QtDBus',
'QDBusConnectionInterface': 'PyQt6.QtDBus',
'QDBusError': 'PyQt6.QtDBus',
'QDBusInt... | 782 | Python | .py | 22 | 33.727273 | 44 | 0.739474 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,832 | loader.py | kovidgoyal_calibre/src/qt/loader.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import sys
from importlib import import_module
def dynamic_load(name, name_map, already_imported, qt_modules, module_names=()):
ans = already_imported.get(name, already_imported)
if ans is ... | 1,218 | Python | .py | 33 | 25.515152 | 80 | 0.545685 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,833 | core.pyi | kovidgoyal_calibre/src/qt/core.pyi | # autogenerated by __main__.py do not edit
import PyQt6.QtCore
PYQT_VERSION = PyQt6.QtCore.PYQT_VERSION
PYQT_VERSION_STR = PyQt6.QtCore.PYQT_VERSION_STR
QAbstractAnimation = PyQt6.QtCore.QAbstractAnimation
QAbstractEventDispatcher = PyQt6.QtCore.QAbstractEventDispatcher
QAbstractItemModel = PyQt6.QtCore.QAbstractItemMo... | 35,459 | Python | .py | 769 | 45.111834 | 79 | 0.888559 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,834 | __init__.py | kovidgoyal_calibre/src/qt/__init__.py | # autogenerated by __main__.py do not edit
top_level_module_names=('QtCore', 'QtGui', 'QtWidgets', 'QtNetwork', 'QtSvg', 'QtPrintSupport', 'QtOpenGL', 'QtOpenGLWidgets', 'QtQuick', 'QtMultimedia', 'QtMultimediaWidgets', 'QtTextToSpeech', 'QtWebEngineCore', 'QtWebEngineWidgets', 'QtDBus')
def __getattr__(name):
if... | 466 | Python | .py | 7 | 61.714286 | 245 | 0.714912 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,835 | webengine.pyi | kovidgoyal_calibre/src/qt/webengine.pyi | # autogenerated by __main__.py do not edit
import PyQt6.QtWebEngineCore
PYQT_WEBENGINE_VERSION = PyQt6.QtWebEngineCore.PYQT_WEBENGINE_VERSION
PYQT_WEBENGINE_VERSION_STR = PyQt6.QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR
QWebEngineCertificateError = PyQt6.QtWebEngineCore.QWebEngineCertificateError
QWebEngineClientCertif... | 3,180 | Python | .py | 44 | 71.295455 | 105 | 0.926363 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,836 | core.py | kovidgoyal_calibre/src/qt/core.py | # autogenerated by __main__.py do not edit
from .core_name_map import module_names, name_map
from .loader import dynamic_load
already_imported = {}
qt_modules = {}
def __getattr__(name):
return dynamic_load(name, name_map, already_imported, qt_modules, module_names)
| 273 | Python | .py | 7 | 37.142857 | 83 | 0.746212 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,837 | webengine.py | kovidgoyal_calibre/src/qt/webengine.py | # autogenerated by __main__.py do not edit
from .webengine_name_map import module_names, name_map
from .loader import dynamic_load
already_imported = {}
qt_modules = {}
def __getattr__(name):
return dynamic_load(name, name_map, already_imported, qt_modules, module_names)
| 278 | Python | .py | 7 | 37.857143 | 83 | 0.750929 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,838 | token_data.py | kovidgoyal_calibre/src/tinycss/token_data.py | # coding: utf8
"""
tinycss.token_data
------------------
Shared data for both implementations (Cython and Python) of the tokenizer.
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
"""
import functools
import operator
import re
import string
import sys
# * Raw s... | 13,353 | Python | .py | 345 | 31.744928 | 79 | 0.593357 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,839 | parsing.py | kovidgoyal_calibre/src/tinycss/parsing.py | # coding: utf8
"""
tinycss.parsing
---------------
Utilities for parsing lists of tokens.
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
"""
# TODO: unit tests
def split_on_comma(tokens):
"""Split a list of tokens on commas, ie ``,`` DELIM tokens.
Onl... | 4,461 | Python | .py | 126 | 28.126984 | 77 | 0.609819 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,840 | color3.py | kovidgoyal_calibre/src/tinycss/color3.py | # coding: utf8
"""
tinycss.colors3
---------------
Parser for CSS 3 color values
http://www.w3.org/TR/css3-color/
This module does not provide anything that integrates in a parser class,
only functions that parse single tokens from (eg.) a property value.
:copyright: (c) 2012 by Simon Sap... | 12,242 | Python | .py | 339 | 30.032448 | 78 | 0.540388 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,841 | media3.py | kovidgoyal_calibre/src/tinycss/media3.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from polyglot.builtins import error_message
from tinycss.css21 import CSS21Parser
from tinycss.parsing import ParseError, remove_whitespace, split_on_comma
class MediaQuery:
__sl... | 4,582 | Python | .py | 86 | 36 | 116 | 0.50983 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,842 | decoding.py | kovidgoyal_calibre/src/tinycss/decoding.py | # coding: utf8
"""
tinycss.decoding
----------------
Decoding stylesheets from bytes to Unicode.
http://www.w3.org/TR/CSS21/syndata.html#charset
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
"""
import operator
import re
from polyglot.binary import from_h... | 9,085 | Python | .py | 205 | 37.097561 | 79 | 0.557858 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,843 | css21.py | kovidgoyal_calibre/src/tinycss/css21.py | # coding: utf8
"""
tinycss.css21
-------------
Parser for CSS 2.1
http://www.w3.org/TR/CSS21/syndata.html
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
"""
from itertools import chain, islice
from tinycss.decoding import decode
from tinycss.parsing import... | 29,393 | Python | .py | 665 | 33.403008 | 121 | 0.57423 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,844 | __init__.py | kovidgoyal_calibre/src/tinycss/__init__.py | # coding: utf8
"""
tinycss
-------
A CSS parser, and nothing else.
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
"""
from .version import VERSION
__version__ = VERSION
from tinycss.css21 import CSS21Parser
from tinycss.fonts3 import CSSFonts3Parser
from tinyc... | 1,407 | Python | .py | 40 | 30.375 | 83 | 0.698155 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,845 | fonts3.py | kovidgoyal_calibre/src/tinycss/fonts3.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import re
from tinycss.css21 import CSS21Parser, ParseError
from .tokenizer import tokenize_grouped
def parse_font_family_tokens(tokens):
families = []
current_family = ''
... | 7,595 | Python | .py | 193 | 28.834197 | 147 | 0.56697 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,846 | page3.py | kovidgoyal_calibre/src/tinycss/page3.py | # coding: utf8
"""
tinycss.page3
------------------
Support for CSS 3 Paged Media syntax:
http://dev.w3.org/csswg/css3-page/
Adds support for named page selectors and margin rules.
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
"""
from .css21 import C... | 5,050 | Python | .py | 130 | 29.869231 | 77 | 0.507673 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,847 | tokenizer.py | kovidgoyal_calibre/src/tinycss/tokenizer.py | # coding: utf8
"""
tinycss.tokenizer
-----------------
Tokenizer for the CSS core syntax:
http://www.w3.org/TR/CSS21/syndata.html#tokenization
This is the pure-python implementation. See also speedups.pyx
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
""... | 7,737 | Python | .py | 191 | 29.109948 | 107 | 0.551316 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,848 | color3.py | kovidgoyal_calibre/src/tinycss/tests/color3.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from tinycss.color3 import hsl_to_rgb, parse_color_string
from tinycss.tests import BaseTest
class TestColor3(BaseTest):
def test_color_parsing(self):
for css_source, exp... | 8,384 | Python | .py | 177 | 34.655367 | 85 | 0.352065 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,849 | media3.py | kovidgoyal_calibre/src/tinycss/tests/media3.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from tinycss.media3 import CSSMedia3Parser
from tinycss.media3 import MediaQuery as MQ
from tinycss.tests import BaseTest, jsonify
def jsonify_expr(e):
if e is None:
retur... | 2,983 | Python | .py | 55 | 41.527273 | 123 | 0.493484 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,850 | decoding.py | kovidgoyal_calibre/src/tinycss/tests/decoding.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from tinycss.decoding import decode
from tinycss.tests import BaseTest
def params(css, encoding, use_bom=False, expect_error=False, **kwargs):
"""Nicer syntax to make a tuple."""
... | 3,474 | Python | .py | 65 | 41.015385 | 85 | 0.555262 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,851 | css21.py | kovidgoyal_calibre/src/tinycss/tests/css21.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import io
import os
import tempfile
from tinycss.css21 import CSS21Parser
from tinycss.tests import BaseTest
from tinycss.tests.tokenizing import jsonify
class CoreParser(CSS21Parser... | 14,361 | Python | .py | 281 | 36.75089 | 92 | 0.442548 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,852 | __init__.py | kovidgoyal_calibre/src/tinycss/tests/__init__.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import unittest
def jsonify(tokens):
"""Turn tokens into "JSON-compatible" data structures."""
for token in tokens:
if token.type == 'FUNCTION':
yield (tok... | 1,100 | Python | .py | 27 | 33.185185 | 67 | 0.65381 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,853 | fonts3.py | kovidgoyal_calibre/src/tinycss/tests/fonts3.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from polyglot.builtins import iteritems
from tinycss.fonts3 import CSSFonts3Parser, parse_font, parse_font_family, serialize_font
from tinycss.tests import BaseTest
class TestFonts3(B... | 3,066 | Python | .py | 55 | 44.945455 | 153 | 0.551218 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,854 | page3.py | kovidgoyal_calibre/src/tinycss/tests/page3.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from tinycss.page3 import CSSPage3Parser
from tinycss.tests import BaseTest
class TestPage3(BaseTest):
def test_selectors(self):
for css, expected_selector, expected_spec... | 3,818 | Python | .py | 73 | 38.671233 | 86 | 0.469579 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,855 | main.py | kovidgoyal_calibre/src/tinycss/tests/main.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import argparse
import unittest
def find_tests():
from calibre.utils.run_tests import find_tests_in_package
return find_tests_in_package('tinycss.tests')
def run_tests(find_... | 1,810 | Python | .py | 48 | 27.9375 | 120 | 0.571021 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,856 | tokenizing.py | kovidgoyal_calibre/src/tinycss/tests/tokenizing.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from tinycss.tests import BaseTest, jsonify
from tinycss.tokenizer import c_tokenize_flat, python_tokenize_flat, regroup
if c_tokenize_flat is None:
tokenizers = (python_tokenize_f... | 8,863 | Python | .py | 234 | 27.474359 | 83 | 0.430318 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,857 | planet_python.recipe | kovidgoyal_calibre/recipes/planet_python.recipe | from calibre.web.feeds.news import AutomaticNewsRecipe
class BasicUserRecipe(AutomaticNewsRecipe):
title = u'Planet Python'
language = 'en'
__author__ = 'Jelle van der Waa'
oldest_article = 10
max_articles_per_feed = 100
feeds = [(u'Planet Python', u'http://planetpython.org/rss20.xml')]
| 314 | Python | .py | 8 | 35 | 70 | 0.713816 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,858 | default_tweaks.py | kovidgoyal_calibre/resources/default_tweaks.py | #!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
# License: GPLv3 Copyright: 2010, Kovid Goyal <kovid at kovidgoyal.net>
# Contains various tweaks that affect calibre behavior. Only edit this file if
# you know what you are doing. If you delete this file, it will be recreated from
# defaults.
... | 31,485 | Python | .py | 538 | 56.505576 | 136 | 0.737375 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,859 | generate.py | kovidgoyal_calibre/imgsrc/generate.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import argparse
import glob
import hashlib
import json
import os
import subprocess
duplicates = {
'character-set': ['languages'],
'calibre': ['library', 'lt'],
'format-text-color': ['look... | 2,496 | Python | .py | 70 | 30.614286 | 89 | 0.607217 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,860 | copy-to-library.svg | kovidgoyal_calibre/imgsrc/copy-to-library.svg | <svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg2" width="128" height="128" version="1.1" viewBox="0 0 128 128"><defs id="defs4"><marker id="marker5884" orient="auto" refX="0" refY="0" style="overflow:visible"><path id="path5886" d="M 0,0 ... | 1,690 | Python | .py | 1 | 1,690 | 1,690 | 0.689349 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,861 | render-logo.py | kovidgoyal_calibre/imgsrc/render-logo.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import os
import shutil
import subprocess
import sys
j = os.path.join
base = os.path.dirname(os.path.abspath(__file__))
resources = j(os.path.dirname(base), 'resources')
icons = j(os.path.dirname(ba... | 1,906 | Python | .py | 36 | 50.805556 | 109 | 0.684041 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,862 | edit-copy.svg | kovidgoyal_calibre/imgsrc/edit-copy.svg | <svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg2" width="128" height="128" version="1.1" viewBox="0 0 128 128"><defs id="defs4"><linearGradient id="linearGradient4139"><stop style="stop-color:#0c7e1b;stop-opacity:1" id="stop4141" offset="... | 2,609 | Python | .py | 1 | 2,609 | 2,609 | 0.701418 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,863 | search_copy_saved.svg | kovidgoyal_calibre/imgsrc/search_copy_saved.svg | <svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg2" width="128" height="128" version="1.1" viewBox="0 0 128 128"><defs id="defs4"><linearGradient id="linearGradient4136"><stop style="stop-color:#0b59bd;stop-opacity:1" id="stop4138" offset="... | 4,063 | Python | .py | 1 | 4,063 | 4,063 | 0.717696 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,864 | copy.svg | kovidgoyal_calibre/imgsrc/srv/copy.svg | <svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1696 384q40 0 68 28t28 68v1216q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-288h-544q-40 0-68-28t-28-68v-672q0-40 20-88t48-76l408-408q28-28 76-48t88-20h416q40 0 68 28t28 68v328q68-40 128-40h416zm-544 213l-299 299h299v-299... | 497 | Python | .py | 1 | 497 | 497 | 0.770624 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,865 | generate.py | kovidgoyal_calibre/imgsrc/srv/generate.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
import sys
from lxml import etree
SVG_NS = 'http://www.w3.org/2000/svg'
XLINK_NS = 'http://www.w3.org/1999/xlink'
def clone_node(node, parent):
ans = parent.makeelement(no... | 1,691 | Python | .py | 48 | 28.4375 | 85 | 0.600122 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,866 | the_daily_news_egypt.recipe | kovidgoyal_calibre/recipes/the_daily_news_egypt.recipe | __license__ = 'GPL v3'
__copyright__ = '2011, Pat Stapleton <pat.stapleton at gmail.com>'
'''
abc.net.au/news
'''
import re
from calibre.web.feeds.recipes import BasicNewsRecipe
class TheDailyNewsEG(BasicNewsRecipe):
title = u'The Daily News Egypt'
__author__ = 'Omm Mishmishah'
description = 'News from E... | 1,813 | Python | .gyp | 38 | 41.236842 | 122 | 0.642898 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,867 | ancient_egypt.recipe | kovidgoyal_calibre/recipes/ancient_egypt.recipe | #!/usr/bin/env python
# vim:fileencoding=utf-8
'''
https://ancientegyptmagazine.com
'''
from calibre import browser
from calibre.web.feeds.news import BasicNewsRecipe
class ancientegypt(BasicNewsRecipe):
title = 'The Past: Ancient Egypt Magazine'
language = 'en'
__author__ = 'unkn0wn'
description = (
... | 4,347 | Python | .gyp | 97 | 36.061856 | 135 | 0.582428 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,868 | run-python.h | kovidgoyal_calibre/bypy/run-python.h | /*
* Copyright (C) 2019 Kovid Goyal <kovid at kovidgoyal.net>
*
* Distributed under terms of the GPL3 license.
*/
#pragma once
#define PY_SSIZE_T_CLEAN
#include <stdio.h>
#include <stdbool.h>
#include <time.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef _WIN32
#include <string.h>
#define PATH_MAX MAX_PATH
#else... | 2,641 | Python | .pyt | 81 | 29.962963 | 116 | 0.717366 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,869 | ipython.py | kovidgoyal_calibre/src/calibre/utils/ipython.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.constants import cache_dir, get_version, iswindows
from polyglot.builtins import exec_path
ipydir = os.path.join(cache_dir(), '... | 8,109 | Python | .pyt | 192 | 37.15625 | 118 | 0.631652 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,870 | planet_python.recipe | kovidgoyal_calibre/recipes/planet_python.recipe | from calibre.web.feeds.news import AutomaticNewsRecipe
class BasicUserRecipe(AutomaticNewsRecipe):
title = u'Planet Python'
language = 'en'
__author__ = 'Jelle van der Waa'
oldest_article = 10
max_articles_per_feed = 100
feeds = [(u'Planet Python', u'http://planetpython.org/rss20.xml')]
| 314 | Python | .pyt | 8 | 35 | 70 | 0.713816 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,871 | substack.recipe | kovidgoyal_calibre/recipes/substack.recipe | #!/usr/bin/env python
# vim:fileencoding=utf-8
#
# Title: Substack
# License: GNU General Public License v3 – https://www.gnu.org/licenses/gpl-3.0.html
# Copyright: Nathan Cook (nathan.cook@gmail.com)
##
# Written: 2020-12-18
##
__license__ = 'GNU General Public License v3 – https://www.gnu.org/lic... | 2,630 | Python | .tac | 63 | 33.968254 | 107 | 0.605016 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,872 | attac_es.recipe | kovidgoyal_calibre/recipes/attac_es.recipe | # vim:fileencoding=utf-8
from __future__ import unicode_literals
from calibre.web.feeds.news import BasicNewsRecipe
class AttacEspanaRecipe (BasicNewsRecipe):
__author__ = 'Marc Busqué <marc@lamarciana.com>'
__url__ = 'http://www.lamarciana.com'
__version__ = '1.0.2'
__license__ = 'GPL v3'
__copy... | 1,406 | Python | .tac | 27 | 45.592593 | 345 | 0.691123 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,873 | stackoverflow.recipe | kovidgoyal_calibre/recipes/stackoverflow.recipe | #!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
'''
blog.stackoverflow.com
'''
from calibre.web.feeds.news import BasicNewsRecipe
class StackOverflowBlog(BasicNewsRecipe):
title = 'Stack Overflow - Blog'
__author__ = 'Darko Miletic'
descrip... | 899 | Python | .tac | 25 | 31.6 | 82 | 0.666282 | kovidgoyal/calibre | 19,243 | 2,250 | 4 | GPL-3.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,874 | tldata.py | andikleen_pmu-tools/tldata.py | import os
import csv
import re
from collections import defaultdict
import gen_level
class TLData:
"""Read a toplev output CSV file.
Exported:
times[n] All time stamps
vals[n] All values, as dicts mapping (name, cpu)->float
levels{name} All levels (includes metrics), name->list of fields
units{... | 2,915 | Python | .py | 83 | 25.373494 | 106 | 0.529204 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,875 | msr.py | andikleen_pmu-tools/msr.py | #!/usr/bin/env python3
# library and tool to access Intel MSRs (model specific registers)
# Author: Andi Kleen
from __future__ import print_function
import glob
import struct
import os
def writemsr(msr, val):
n = glob.glob('/dev/cpu/[0-9]*/msr')
for c in n:
f = os.open(c, os.O_WRONLY)
os.lseek(... | 2,291 | Python | .py | 61 | 31.262295 | 101 | 0.603689 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,876 | counterdiff.py | andikleen_pmu-tools/counterdiff.py | #!/usr/bin/env python3
# counterdiff.py < plog program .. (or general perf arguments)
# verify plog.* output from toplev by running event one by one
# this can be used to estimate multiplexing measurement errors
from __future__ import print_function
import sys, os
def run(x):
print(x)
os.system(x)
for l ... | 803 | Python | .py | 27 | 24.518519 | 67 | 0.546512 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,877 | utilized.py | andikleen_pmu-tools/utilized.py | #!/usr/bin/python
# extract utilized CPUs out of toplev CSV output
# toplev ... -I 1000 --node +CPU_Utilization -x, -o x.csv ...
# utilized.py < x.csv
# note it duplicates the core output
from __future__ import print_function
import argparse
import csv
import sys
import re
import collections
ap = argparse.ArgumentPars... | 1,600 | Python | .py | 53 | 25.981132 | 82 | 0.630759 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,878 | ivb_server_ratios.py | andikleen_pmu-tools/ivb_server_ratios.py | # -*- coding: latin-1 -*-
#
# auto generated TopDown/TMA 4.8-full-perf description for Intel Xeon E5 v2 (code named IvyBridge EP)
# Please see http://ark.intel.com for more details on these CPUs.
#
# References:
# http://bit.ly/tma-ispass14
# http://halobates.de/blog/p/262
# https://sites.google.com/site/analysismethod... | 133,732 | Python | .py | 3,304 | 34.814165 | 306 | 0.656987 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,879 | pci.py | andikleen_pmu-tools/pci.py | #!/usr/bin/env python3
# library and tool to access PCI config space
import os
import struct
# no multiple domains, controllers so far
def probe(bus, dev, func):
fn = "/sys/devices/pci0000:%02x/0000:%02x:%02x.%01x/config" % (bus, bus, dev, func)
return os.path.isfile(fn)
def openpci(bus, dev, func, offset, m... | 1,211 | Python | .py | 33 | 32.575758 | 87 | 0.625107 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,880 | tl_stat.py | andikleen_pmu-tools/tl_stat.py | # Copyright (c) 2012-2020, Intel Corporation
# Author: Andi Kleen
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will... | 2,835 | Python | .py | 66 | 34.924242 | 89 | 0.623823 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,881 | icl_client_ratios.py | andikleen_pmu-tools/icl_client_ratios.py | # -*- coding: latin-1 -*-
#
# auto generated TopDown/TMA 4.8-full-perf description for Intel 10th gen Core (code name Icelake)
# Please see http://ark.intel.com for more details on these CPUs.
#
# References:
# http://bit.ly/tma-ispass14
# http://halobates.de/blog/p/262
# https://sites.google.com/site/analysismethods/y... | 238,593 | Python | .py | 5,504 | 37.395712 | 1,797 | 0.656737 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,882 | bdx_server_ratios.py | andikleen_pmu-tools/bdx_server_ratios.py | # -*- coding: latin-1 -*-
#
# auto generated TopDown/TMA 4.8-full-perf description for Intel Xeon E5 v4 (code named Broadwell EP)
# Please see http://ark.intel.com for more details on these CPUs.
#
# References:
# http://bit.ly/tma-ispass14
# http://halobates.de/blog/p/262
# https://sites.google.com/site/analysismethod... | 148,580 | Python | .py | 3,656 | 34.950492 | 320 | 0.656843 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,883 | tl-xlsx.py | andikleen_pmu-tools/tl-xlsx.py | #!/usr/bin/env python3
# Copyright (c) 2020, Intel Corporation
# Author: Andi Kleen
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed i... | 8,633 | Python | .py | 207 | 34.120773 | 133 | 0.597741 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,884 | cputop.py | andikleen_pmu-tools/cputop.py | #!/usr/bin/env python3
# query cpu topology and print all matching cpu numbers
# cputop "query" ["format"]
# query is a python expression, using variables:
# socket, core, thread, type, cpu
# or "offline" to query all offline cpus
# or "atom" or "core" to select core types
# type can be "atom" or "core"
# cpu is the cp... | 3,577 | Python | .py | 118 | 25.923729 | 90 | 0.634331 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,885 | spr_server_ratios.py | andikleen_pmu-tools/spr_server_ratios.py | # -*- coding: latin-1 -*-
#
# auto generated TopDown/TMA 4.8-full-perf description for Intel Xeon Scalable Processors 4th gen (code name Sapphire Rapids)
# Please see http://ark.intel.com for more details on these CPUs.
#
# References:
# http://bit.ly/tma-ispass14
# http://halobates.de/blog/p/262
# https://sites.google... | 274,697 | Python | .py | 6,251 | 37.977764 | 1,910 | 0.656158 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,886 | tl_cpu.py | andikleen_pmu-tools/tl_cpu.py | # Copyright (c) 2012-2020, Intel Corporation
# Author: Andi Kleen
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will... | 9,244 | Python | .py | 234 | 28.047009 | 109 | 0.506336 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,887 | gen_level.py | andikleen_pmu-tools/gen_level.py | # generate levels for events from the model
# utility module for other tools
l1 = set(("Frontend_Bound", "Backend_Bound", "Retiring", "Bad_Speculation"))
def get_level(name):
is_node = name in l1 or "." in name
level = name.count(".") + 1
if is_node:
return level
return 0
def is_metric(name):
... | 600 | Python | .py | 21 | 23.619048 | 76 | 0.586806 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,888 | dummyarith.py | andikleen_pmu-tools/dummyarith.py |
# dummy arithmetic type without any errors, for collecting
# the events from the model. Otherwise divisions by zero cause
# early exits
class DummyArith(object):
def __add__(self, o):
return self
__sub__ = __add__
__mul__ = __add__
__div__ = __add__
__truediv__ = __add__
__rsub__ = __a... | 633 | Python | .py | 25 | 20.56 | 62 | 0.455446 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,889 | toplev.py | andikleen_pmu-tools/toplev.py | #!/usr/bin/env python3
# Copyright (c) 2012-2022, Intel Corporation
# Author: Andi Kleen
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distribu... | 175,261 | Python | .py | 4,179 | 32.340512 | 193 | 0.574306 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,890 | mtl_rwc_ratios.py | andikleen_pmu-tools/mtl_rwc_ratios.py | # -*- coding: latin-1 -*-
#
# auto generated TopDown/TMA 4.8-full-perf description for Intel 14th gen Core (code name Meteor Lake) with Redwood Cove
# Please see http://ark.intel.com for more details on these CPUs.
#
# References:
# http://bit.ly/tma-ispass14
# http://halobates.de/blog/p/262
# https://sites.google.com/... | 244,538 | Python | .py | 5,655 | 37.270203 | 1,765 | 0.655489 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,891 | event_download.py | andikleen_pmu-tools/event_download.py | #!/usr/bin/env python3
# Copyright (c) 2014-2020, Intel Corporation
# Author: Andi Kleen
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distribu... | 10,437 | Python | .py | 282 | 27.79078 | 128 | 0.558591 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,892 | power_metrics.py | andikleen_pmu-tools/power_metrics.py | #
# perf power metrics for toplev
#
import os
class EnergyPackage:
name = "Package Energy"
desc = """
Package Energy over measurement period in Joules"""
unit = "Joules"
nogroup = True
subplot = "Power"
domain = "Package"
def compute(self, EV):
self.val = EV("power/energy-pkg/", 1)... | 1,661 | Python | .py | 57 | 23.684211 | 68 | 0.62015 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,893 | bdw_client_ratios.py | andikleen_pmu-tools/bdw_client_ratios.py | # -*- coding: latin-1 -*-
#
# auto generated TopDown/TMA 4.8-full-perf description for Intel 5th gen Core / Core M (code named Broadwell)
# Please see http://ark.intel.com for more details on these CPUs.
#
# References:
# http://bit.ly/tma-ispass14
# http://halobates.de/blog/p/262
# https://sites.google.com/site/analys... | 142,042 | Python | .py | 3,523 | 34.632132 | 323 | 0.656478 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,894 | tl-barplot.py | andikleen_pmu-tools/tl-barplot.py | #!/usr/bin/env python3
# plot toplev -I... -x, -o ...csv output as bar plot
#
from __future__ import print_function
import os
import re
import argparse
from math import isnan, trunc
from collections import defaultdict
import matplotlib
if os.getenv('DISPLAY') is None:
matplotlib.use('Agg')
import matplotlib.pyplot ... | 5,231 | Python | .py | 154 | 28.266234 | 124 | 0.604826 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,895 | jkt_server_ratios.py | andikleen_pmu-tools/jkt_server_ratios.py | # -*- coding: latin-1 -*-
#
# auto generated TopDown/TMA 4.8-full-perf description for Intel Xeon E5 (code named SandyBridge EP)
# Please see http://ark.intel.com for more details on these CPUs.
#
# References:
# http://bit.ly/tma-ispass14
# http://halobates.de/blog/p/262
# https://sites.google.com/site/analysismethods... | 67,078 | Python | .py | 1,671 | 34.648713 | 306 | 0.666247 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,896 | interval-normalize.py | andikleen_pmu-tools/interval-normalize.py | #!/usr/bin/env python3
# convert perf stat -Ixxx -x, / toplev -Ixxx -x, output to normalized output
# this version buffers all data in memory, so it can use a lot of memory.
# t1,ev1,num1
# t1,ev2,num1
# t2,ev1,num3
# ->
# timestamp,ev1,ev2
# t1,num1,num2
# t2,num3,,
# when the input has CPU generate separate lines for... | 3,252 | Python | .py | 94 | 29.712766 | 102 | 0.639568 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,897 | tsx_metrics.py | andikleen_pmu-tools/tsx_metrics.py | #
# TSX metrics
#
# XXX force all these into a single group
# XXX: force % in caller
import os
def TXCycles(EV, level):
return EV("cpu/cycles-t/", level) / EV("cycles", level)
class TransactionalCycles:
name = "Transactional cycles"
desc = """
Percent cycles spent in a transaction. When low or zero eith... | 2,765 | Python | .py | 77 | 29.246753 | 100 | 0.622015 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,898 | genretlat.py | andikleen_pmu-tools/genretlat.py | #!/usr/bin/env python3
# -*- coding: utf-8
# generate return latencies to tune toplev model
# Copyright (c) 2023, Intel Corporation
# Author: Andi Kleen
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as publish... | 9,118 | Python | .py | 239 | 29.485356 | 133 | 0.541629 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |
27,899 | simple_ratios.py | andikleen_pmu-tools/simple_ratios.py | #
# Simple 5 event top level model
#
print_error = lambda msg: False
version = "1.0"
check_event = lambda ev: False
# Constants
PipelineWidth = 4
uops_retired_slots = "UOPS_RETIRED.RETIRE_SLOTS"
def CLKS(EV):
return EV("CPU_CLK_UNHALTED.THREAD", 1)
def SLOTS(EV):
return PipelineWidth * CLKS(EV)
# Instruc... | 5,235 | Python | .py | 154 | 27.058442 | 143 | 0.620574 | andikleen/pmu-tools | 1,984 | 331 | 178 | GPL-2.0 | 9/5/2024, 5:13:50 PM (Europe/Amsterdam) |