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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18,700 | utils.py | openstenoproject_plover/plover/gui_qt/utils.py | from PyQt5.QtCore import QSettings
from PyQt5.QtGui import QGuiApplication, QKeySequence
from PyQt5.QtWidgets import (
QAction,
QMainWindow,
QToolBar,
QToolButton,
QWidget,
)
from plover import _
def ActionCopyViewSelectionToClipboard(view):
def copy_selection_to_clipboard():
indexes ... | 2,452 | Python | .py | 74 | 25.594595 | 60 | 0.6558 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,701 | tool.py | openstenoproject_plover/plover/gui_qt/tool.py |
from PyQt5.QtWidgets import QDialog
from plover.gui_qt.utils import WindowState
class Tool(QDialog, WindowState):
# Used for dialog window title, menu entry text.
TITLE = None
# Optional path to icon image.
ICON = None
# Optional shortcut (as a string).
SHORTCUT = None
# Note: the class... | 664 | Python | .py | 19 | 28.894737 | 69 | 0.66405 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,702 | machine_options.py | openstenoproject_plover/plover/gui_qt/machine_options.py | from copy import copy
from pathlib import Path
from PyQt5.QtCore import Qt, QVariant, pyqtSignal
from PyQt5.QtGui import (
QTextCharFormat,
QTextFrameFormat,
QTextListFormat,
QTextCursor,
QTextDocument,
)
from PyQt5.QtWidgets import (
QGroupBox,
QStyledItemDelegate,
QStyle,
QToolTip... | 8,031 | Python | .py | 191 | 32.408377 | 89 | 0.62785 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,703 | trayicon.py | openstenoproject_plover/plover/gui_qt/trayicon.py | from PyQt5.QtCore import QObject, pyqtSignal
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QMessageBox, QSystemTrayIcon
from plover import _, __name__ as __software_name__
from plover import log
from plover.oslayer.config import PLATFORM
from plover.machine.base import (
STATE_STOPPED,
STATE_INITIA... | 4,359 | Python | .py | 122 | 25.540984 | 75 | 0.571902 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,704 | engine.py | openstenoproject_plover/plover/gui_qt/engine.py | from PyQt5.QtCore import (
QThread,
QVariant,
pyqtSignal,
)
from plover.engine import StenoEngine
from plover.oslayer.config import PLATFORM
class Engine(StenoEngine, QThread):
# Signals.
signal_stroked = pyqtSignal(QVariant)
signal_translated = pyqtSignal(QVariant, QVariant)
signal_mach... | 1,682 | Python | .py | 47 | 29.12766 | 74 | 0.672 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,705 | suggestions_widget.py | openstenoproject_plover/plover/gui_qt/suggestions_widget.py | from PyQt5.QtCore import (
QAbstractListModel,
QMimeData,
QModelIndex,
Qt,
)
from PyQt5.QtGui import (
QFont,
QFontMetrics,
QTextCharFormat,
QTextCursor,
QTextDocument,
)
from PyQt5.QtWidgets import (
QListView,
QStyle,
QStyledItemDelegate,
)
from plover import _
from pl... | 6,238 | Python | .py | 165 | 29.69697 | 80 | 0.646669 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,706 | dictionary_editor.py | openstenoproject_plover/plover/gui_qt/dictionary_editor.py |
from operator import attrgetter, itemgetter
from collections import namedtuple
from itertools import chain
from PyQt5.QtCore import (
QAbstractTableModel,
QModelIndex,
Qt,
)
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import (
QComboBox,
QDialog,
QStyledItemDelegate,
)
from plover impo... | 14,690 | Python | .py | 368 | 28.845109 | 95 | 0.587295 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,707 | steno_validator.py | openstenoproject_plover/plover/gui_qt/steno_validator.py | from PyQt5.QtGui import QValidator
from plover.steno import normalize_steno
class StenoValidator(QValidator):
def validate(self, text, pos):
if not text.strip('-/'):
state = QValidator.Intermediate
else:
prefix = text.rstrip('-/')
if text == prefix:
... | 644 | Python | .py | 19 | 22.368421 | 47 | 0.552335 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,708 | main_window.py | openstenoproject_plover/plover/gui_qt/main_window.py |
from functools import partial
import json
import os
import subprocess
from PyQt5.QtCore import QCoreApplication, Qt
from PyQt5.QtGui import QCursor, QIcon, QKeySequence
from PyQt5.QtWidgets import (
QMainWindow,
QMenu,
)
from plover import _, log
from plover.oslayer import wmctrl
from plover.oslayer.config i... | 10,694 | Python | .py | 243 | 33.831276 | 101 | 0.628023 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,709 | dictionaries_widget.py | openstenoproject_plover/plover/gui_qt/dictionaries_widget.py | from contextlib import contextmanager
import os
from PyQt5.QtCore import (
QAbstractListModel,
QModelIndex,
Qt,
pyqtSignal,
)
from PyQt5.QtGui import QCursor, QIcon
from PyQt5.QtWidgets import (
QFileDialog,
QGroupBox,
QMenu,
)
from plover import _
from plover.config import DictionaryConfi... | 26,436 | Python | .py | 629 | 31.166932 | 98 | 0.598206 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,710 | main.py | openstenoproject_plover/plover/gui_qt/main.py | from pathlib import Path
import signal
import sys
from PyQt5.QtCore import (
QCoreApplication,
QLibraryInfo,
QTimer,
QTranslator,
Qt,
QtDebugMsg,
QtInfoMsg,
QtWarningMsg,
pyqtRemoveInputHook,
qInstallMessageHandler,
)
from PyQt5.QtWidgets import QApplication, QMessageBox
from p... | 4,230 | Python | .py | 104 | 34.096154 | 89 | 0.685944 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,711 | config_window.py | openstenoproject_plover/plover/gui_qt/config_window.py |
from collections import ChainMap
from copy import copy
from functools import partial
from PyQt5.QtCore import (
Qt,
QVariant,
pyqtSignal,
)
from PyQt5.QtWidgets import (
QCheckBox,
QComboBox,
QDialog,
QDialogButtonBox,
QFileDialog,
QFormLayout,
QFrame,
QGroupBox,
QLabel... | 20,409 | Python | .py | 454 | 31.477974 | 100 | 0.557062 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,712 | lookup_dialog.py | openstenoproject_plover/plover/gui_qt/lookup_dialog.py |
from PyQt5.QtCore import QEvent, Qt
from plover import _
from plover.translation import unescape_translation
from plover.gui_qt.lookup_dialog_ui import Ui_LookupDialog
from plover.gui_qt.tool import Tool
class LookupDialog(Tool, Ui_LookupDialog):
# i18n: Widget: “LookupDialog”, tooltip.
__doc__ = _('Searc... | 1,517 | Python | .py | 37 | 33.648649 | 77 | 0.675546 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,713 | english_stenotype.py | openstenoproject_plover/plover/system/english_stenotype.py |
KEYS = (
'#',
'S-', 'T-', 'K-', 'P-', 'W-', 'H-', 'R-',
'A-', 'O-',
'*',
'-E', '-U',
'-F', '-R', '-P', '-B', '-L', '-G', '-T', '-S', '-D', '-Z',
)
IMPLICIT_HYPHEN_KEYS = ('A-', 'O-', '-E', '-U', '*')
SUFFIX_KEYS = ('-Z', '-D', '-S', '-G')
NUMBER_KEY = '#'
NUMBERS = {
'S-': '1-',
'T-... | 9,557 | Python | .py | 291 | 25.907216 | 126 | 0.35104 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,714 | __init__.py | openstenoproject_plover/plover/system/__init__.py | from collections.abc import Sequence
import os
import re
from plover.oslayer.config import CONFIG_DIR
from plover.resource import resource_filename
from plover.registry import registry
from plover.steno import Stroke
def _load_wordlist(filename, assets_dir):
if filename is None:
return {}
path = None... | 2,872 | Python | .py | 66 | 36.80303 | 109 | 0.62223 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,715 | keyboard.py | openstenoproject_plover/plover/output/keyboard.py | from time import sleep
from plover.output import Output
class GenericKeyboardEmulation(Output):
def __init__(self):
super().__init__()
self._key_press_delay_ms = 0
def set_key_press_delay(self, delay_ms):
self._key_press_delay_ms = delay_ms
def delay(self):
if self._key_press_delay_ms > 0:
... | 567 | Python | .py | 18 | 26.888889 | 44 | 0.673432 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,716 | __init__.py | openstenoproject_plover/plover/output/__init__.py | class Output:
"""Output interface."""
def send_backspaces(self, count):
"""Output the given number of backspaces."""
raise NotImplementedError()
def send_string(self, string):
"""Output the given string."""
raise NotImplementedError()
def send_key_combination(self, co... | 646 | Python | .py | 16 | 32.5 | 68 | 0.65 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,717 | config.py | openstenoproject_plover/plover/oslayer/config.py | # Copyright (c) 2012 Hesky Fisher
# See LICENSE.txt for details.
"""Platform dependent configuration."""
import os
import sys
import appdirs
if sys.platform.startswith('darwin'):
PLATFORM = 'mac'
elif sys.platform.startswith('linux'):
PLATFORM = 'linux'
elif sys.platform.startswith('win'):
PLATFORM = '... | 1,616 | Python | .py | 44 | 32.363636 | 79 | 0.690339 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,718 | controller.py | openstenoproject_plover/plover/oslayer/controller.py | from multiprocessing import connection
from threading import Thread
import errno
import os
import tempfile
from plover import log
from plover.oslayer.config import PLATFORM
class Controller:
def __init__(self, instance='plover', authkey=b'plover'):
if PLATFORM == 'win':
self._address = r'\\.... | 2,744 | Python | .py | 83 | 22.891566 | 85 | 0.550434 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,719 | __init__.py | openstenoproject_plover/plover/oslayer/__init__.py | # Copyright (c) 2011 Hesky Fisher.
# See LICENSE.txt for details.
"""This package abstracts os details for plover."""
import os
from plover import log
from .config import PLATFORM
PLATFORM_PACKAGE = {
'bsd' : 'linux',
'linux': 'linux',
'mac' : 'osx',
'win' : 'windows',
}
def _add_platform_pack... | 617 | Python | .py | 19 | 28.736842 | 78 | 0.681356 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,720 | keyboardlayout.py | openstenoproject_plover/plover/oslayer/osx/keyboardlayout.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: @abarnert, @willwade, and @morinted
# Code taken and modified from
# <https://github.com/willwade/PyUserInput/blob/master/pykeyboard/mac_keycode.py>
# <https://stackoverflow.com/questions/1918841/how-to-convert-ascii-character-to-cgkeycode>
from threading import... | 20,759 | Python | .py | 438 | 34.420091 | 103 | 0.563561 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,721 | wmctrl.py | openstenoproject_plover/plover/oslayer/osx/wmctrl.py | from Cocoa import NSWorkspace, NSRunningApplication, NSApplicationActivateIgnoringOtherApps
def GetForegroundWindow():
return NSWorkspace.sharedWorkspace().frontmostApplication().processIdentifier()
def SetForegroundWindow(pid):
target_window = NSRunningApplication.runningApplicationWithProcessIdentifier_(pi... | 402 | Python | .py | 6 | 63.5 | 91 | 0.872774 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,722 | i18n.py | openstenoproject_plover/plover/oslayer/osx/i18n.py | from AppKit import NSLocale
def get_system_language():
lang_list = NSLocale.preferredLanguages()
return lang_list[0] if lang_list else None
| 150 | Python | .py | 4 | 34 | 46 | 0.770833 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,723 | log.py | openstenoproject_plover/plover/oslayer/osx/log.py | import objc
NSUserNotification = objc.lookUpClass('NSUserNotification')
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')
NSObject = objc.lookUpClass('NSObject')
from plover import log, __name__ as __software_name__
import logging
class NotificationHandler(logging.Handler):
""" Handler usin... | 1,434 | Python | .py | 31 | 40.258065 | 77 | 0.740661 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,724 | keyboardcontrol.py | openstenoproject_plover/plover/oslayer/osx/keyboardcontrol.py | # coding: utf-8
import threading
from time import sleep
from queue import Queue
from Quartz import (
CFMachPortCreateRunLoopSource,
CFMachPortInvalidate,
CFRunLoopAddSource,
CFRunLoopSourceInvalidate,
CFRunLoopGetCurrent,
CFRunLoopRun,
CFRunLoopStop,
CFRelease,
CGEventCreateKeyboar... | 17,069 | Python | .py | 406 | 32.110837 | 161 | 0.595913 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,725 | keyboardlayout.py | openstenoproject_plover/plover/oslayer/windows/keyboardlayout.py | # -*- coding: utf-8 -*-
from collections import defaultdict, namedtuple
from ctypes import windll, wintypes
import codecs
import ctypes
import sys
from plover.key_combo import CHAR_TO_KEYNAME, add_modifiers_aliases
from plover.misc import popcount_8
from .wmctrl import GetForegroundWindow
GetKeyboardLayout = windl... | 16,270 | Python | .py | 457 | 28.612691 | 92 | 0.435463 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,726 | serial.py | openstenoproject_plover/plover/oslayer/windows/serial.py | # “Microsoft Corp”.
MICROSOFT_VID = 0x045e
def patch_ports_info(port_list):
'''Patch serial ports info to remove erroneous manufacturer.
Because on Windows 10 most USB serial devices will use the generic
CDC/ACM driver, their manufacturer is reported as Microsoft. Strip
that information if the vendor... | 545 | Python | .py | 13 | 35.846154 | 70 | 0.706667 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,727 | wmctrl.py | openstenoproject_plover/plover/oslayer/windows/wmctrl.py | from ctypes import windll, wintypes
GetForegroundWindow = windll.user32.GetForegroundWindow
GetForegroundWindow.argtypes = []
GetForegroundWindow.restype = wintypes.HWND
SetForegroundWindow = windll.user32.SetForegroundWindow
SetForegroundWindow.argtypes = [
wintypes.HWND, # hWnd
]
SetForegroundWindow.restype = ... | 334 | Python | .py | 9 | 35.333333 | 55 | 0.857143 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,728 | i18n.py | openstenoproject_plover/plover/oslayer/windows/i18n.py | import locale
from ctypes import windll
def get_system_language():
return locale.windows_locale[windll.kernel32.GetUserDefaultUILanguage()]
| 147 | Python | .py | 4 | 34 | 76 | 0.835714 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,729 | keyboardcontrol.py | openstenoproject_plover/plover/oslayer/windows/keyboardcontrol.py | # Copyright (c) 2011 Hesky Fisher.
# See LICENSE.txt for details.
#
# winkeyboardcontrol.py - capturing and injecting keyboard events in windows.
"""Keyboard capture and control in windows.
This module provides an interface for basic keyboard event capture and
emulation. Set the key_up and key_down functions of the
K... | 17,406 | Python | .py | 433 | 32.233256 | 120 | 0.628368 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,730 | wmctrl_x11.py | openstenoproject_plover/plover/oslayer/linux/wmctrl_x11.py | from Xlib import X, display
from Xlib.error import BadWindow
from Xlib.protocol.event import ClientMessage
class WmCtrl:
def __init__(self):
self._display = display.Display()
self._root = self._display.screen().root
self._atoms = {
name: self._display.intern_atom(name)
... | 1,962 | Python | .py | 48 | 28.375 | 71 | 0.542497 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,731 | log_dbus.py | openstenoproject_plover/plover/oslayer/linux/log_dbus.py | from contextlib import contextmanager
import ctypes.util
import os
import logging
from plover import log, __name__ as __software_name__
from plover.oslayer.config import ASSETS_DIR
APPNAME = ctypes.c_char_p(__software_name__.capitalize().encode())
APPICON = ctypes.c_char_p(os.path.join(ASSETS_DIR, 'plover.png').enco... | 7,803 | Python | .py | 176 | 35.079545 | 132 | 0.606814 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,732 | serial.py | openstenoproject_plover/plover/oslayer/linux/serial.py | from pathlib import Path
def patch_ports_info(port_list):
'''Patch serial ports info to use device-by-id links.'''
try:
device_by_id = {
str(device.resolve()): str(device)
for device in Path('/dev/serial/by-id').iterdir()
}
except FileNotFoundError:
device_b... | 463 | Python | .py | 13 | 28.615385 | 79 | 0.629464 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,733 | keyboardcontrol_x11.py | openstenoproject_plover/plover/oslayer/linux/keyboardcontrol_x11.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2010 Joshua Harlan Lifton.
# See LICENSE.txt for details.
#
# keyboardcontrol.py - capturing and injecting X keyboard events
#
# This code requires the X Window System with the 'XInput2' and 'XTest'
# extensions and python-xlib with support for said extensions.
"""Keyboard cap... | 78,256 | Python | .py | 1,281 | 54.383294 | 101 | 0.589335 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,734 | wmctrl.py | openstenoproject_plover/plover/oslayer/linux/wmctrl.py | from .wmctrl_x11 import WmCtrl
_wmctrl = WmCtrl()
GetForegroundWindow = _wmctrl.get_foreground_window
SetForegroundWindow = _wmctrl.set_foreground_window
| 157 | Python | .py | 4 | 37.5 | 51 | 0.833333 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,735 | i18n.py | openstenoproject_plover/plover/oslayer/linux/i18n.py | import locale
import os
# Note: highest priority first.
LANG_ENV_VARS = ('LC_ALL', 'LC_MESSAGES', 'LANG')
def get_system_language():
try:
return next(filter(None, map(os.environ.get, LANG_ENV_VARS)))
except StopIteration:
return locale.getdefaultlocale()[0]
| 285 | Python | .py | 9 | 27.666667 | 69 | 0.699634 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,736 | geminipr.py | openstenoproject_plover/plover/machine/geminipr.py | # Copyright (c) 2010-2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"""Thread-based monitoring of a Gemini PR stenotype machine."""
import binascii
from plover import log
from plover.machine.base import SerialStenotypeBase
# In the Gemini PR protocol, each packet consists of exactly six bytes
# and the ... | 2,118 | Python | .py | 46 | 36.695652 | 75 | 0.528128 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,737 | keyboard.py | openstenoproject_plover/plover/machine/keyboard.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"For use with a computer keyboard (preferably NKRO) as a steno machine."
from plover import _
from plover.machine.base import StenotypeBase
from plover.misc import boolean
from plover.oslayer.keyboardcontrol import Keybo... | 5,783 | Python | .py | 139 | 31.690647 | 92 | 0.577279 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,738 | txbolt.py | openstenoproject_plover/plover/machine/txbolt.py | # Copyright (c) 2011 Hesky Fisher
# See LICENSE.txt for details.
"Thread-based monitoring of a stenotype machine using the TX Bolt protocol."
import plover.machine.base
# In the TX Bolt protocol, there are four sets of keys grouped in
# order from left to right. Each byte represents all the keys that
# were pressed ... | 3,418 | Python | .py | 73 | 37.657534 | 84 | 0.581731 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,739 | stentura.py | openstenoproject_plover/plover/machine/stentura.py | # Copyright (c) 2011 Hesky Fisher
# See LICENSE.txt for details.
# Many thanks to a steno geek for help with the protocol.
# TODO: Come up with a mechanism to communicate back to the engine when there
# is a connection error.
# TODO: Address any generic exceptions still left.
"""Thread-based monitoring of a stenotype... | 23,132 | Python | .py | 537 | 38.01676 | 102 | 0.683569 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,740 | __init__.py | openstenoproject_plover/plover/machine/__init__.py | # Copyright (c) 2010 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"""Stenotype machines."""
| 101 | Python | .py | 3 | 32.333333 | 42 | 0.742268 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,741 | base.py | openstenoproject_plover/plover/machine/base.py | # Copyright (c) 2010-2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
# TODO: add tests for all machines
# TODO: add tests for new status callbacks
"""Base classes for machine types. Do not use directly."""
import binascii
import threading
import serial
from plover import _, log
from plover.machine.keymap... | 8,814 | Python | .py | 234 | 29.128205 | 86 | 0.625765 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,742 | passport.py | openstenoproject_plover/plover/machine/passport.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"Thread-based monitoring of a stenotype machine using the passport protocol."
from itertools import zip_longest
from plover.machine.base import SerialStenotypeBase
# Passport protocol is documented here:
# http://www.eclipsecat.com/?q=system/files/Pas... | 1,800 | Python | .py | 48 | 29.770833 | 77 | 0.598158 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,743 | keymap.py | openstenoproject_plover/plover/machine/keymap.py | import json
from collections import defaultdict, OrderedDict
from plover import log
class Keymap:
def __init__(self, keys, actions):
# List of supported actions.
self._actions = OrderedDict((action, n)
for n, action
in enume... | 5,290 | Python | .py | 125 | 30.768 | 97 | 0.542185 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,744 | procat.py | openstenoproject_plover/plover/machine/procat.py | # Copyright (c) 2016 Ted Morin
# See LICENSE.txt for details.
"""Thread-based monitoring of a ProCAT stenotype machine."""
import binascii
from plover import log
from plover.machine.base import SerialStenotypeBase
# ProCAT machines send 4 bytes per stroke, with the last byte only consisting of
# FF. So we need onl... | 1,753 | Python | .py | 45 | 29.622222 | 80 | 0.515044 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,745 | __init__.py | openstenoproject_plover/plover/machine/keyboard_capture/__init__.py | class Capture:
"""Keyboard capture interface."""
# Callbacks for keyboard press/release events.
key_down = lambda key: None
key_up = lambda key: None
def start(self):
"""Start capturing key events."""
raise NotImplementedError()
def cancel(self):
"""Stop capturing key... | 482 | Python | .py | 14 | 27.642857 | 50 | 0.645788 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,746 | add_translation.py | openstenoproject_plover/plover/gui_none/add_translation.py | from plover.engine import StartingStrokeState
class AddTranslation:
def __init__(self, engine):
self._status = None
self._engine = engine
self._translator_states = []
self._strokes, self._translation = (None, None)
engine.hook_connect('add_translation', self.trigger)
... | 2,768 | Python | .py | 62 | 33.225806 | 82 | 0.592056 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,747 | engine.py | openstenoproject_plover/plover/gui_none/engine.py |
from threading import Thread, current_thread
from plover.engine import StenoEngine
from plover.gui_none.add_translation import AddTranslation
class Engine(StenoEngine, Thread):
def __init__(self, config, controller, keyboard_emulation):
StenoEngine.__init__(self, config, controller, keyboard_emulation... | 710 | Python | .py | 18 | 32.611111 | 74 | 0.683748 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,748 | main.py | openstenoproject_plover/plover/gui_none/main.py | from threading import Event
from plover.oslayer.keyboardcontrol import KeyboardEmulation
from plover.gui_none.engine import Engine
def show_error(title, message):
print('%s: %s' % (title, message))
def main(config, controller):
engine = Engine(config, controller, KeyboardEmulation())
if not engine.loa... | 547 | Python | .py | 17 | 27.294118 | 60 | 0.711832 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,749 | send_command.py | openstenoproject_plover/plover/scripts/send_command.py | import argparse
import sys
from plover import log
from plover.oslayer.controller import Controller
def main():
description = 'Send a command to a running Plover instance.'
parser = argparse.ArgumentParser(description=description)
parser.add_argument('-l', '--log-level', choices=['debug', 'info', 'warning... | 932 | Python | .py | 22 | 35.136364 | 91 | 0.654144 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,750 | dist_main.py | openstenoproject_plover/plover/scripts/dist_main.py | import os
import sys
import subprocess
from plover.oslayer.config import CONFIG_DIR, PLATFORM, PLUGINS_PLATFORM
def main():
args = sys.argv[:]
args[0:1] = [sys.executable, '-m', 'plover.scripts.main', '--gui', 'qt']
if '--no-user-plugins' in args[3:]:
args.remove('--no-user-plugins')
args... | 644 | Python | .py | 18 | 30.722222 | 88 | 0.634461 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,751 | main.py | openstenoproject_plover/plover/scripts/main.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"Launch the plover application."
import argparse
import atexit
import os
import sys
import subprocess
import traceback
import pkg_resources
from plover.config import Config
from plover.oslayer.controller import Controller
from... | 6,444 | Python | .py | 152 | 29.671053 | 91 | 0.53395 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,752 | key_combo.py | openstenoproject_plover/plover/meta/key_combo.py | def meta_key_combo(ctx, combo):
action = ctx.copy_last_action()
action.combo = combo
return action
| 111 | Python | .py | 4 | 23.75 | 35 | 0.691589 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,753 | currency.py | openstenoproject_plover/plover/meta/currency.py | def meta_retro_currency(ctx, dict_format):
action = ctx.copy_last_action()
last_words = ctx.last_words(count=1)
if not last_words:
return action
currency = last_words[0].replace(',', '')
for cast, fmt in (
(int, '{:,}' ),
(float, '{:,.2f}'),
):
try:
... | 648 | Python | .py | 21 | 23.190476 | 56 | 0.567783 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,754 | conditional.py | openstenoproject_plover/plover/meta/conditional.py | import re
from plover.formatting import _LookAheadAction
IF_NEXT_META_RX = re.compile(r'((?:[^\\/]|\\\\|\\/)*)/?')
IF_NEXT_ESCAPE_RX = re.compile(r'\\([\\/])')
def meta_if_next_matches(ctx, meta):
pattern, result1, result2 = [
IF_NEXT_ESCAPE_RX.sub(r'\1', s)
for s in filter(None, IF_NEXT_META_R... | 560 | Python | .py | 15 | 32 | 61 | 0.62963 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,755 | command.py | openstenoproject_plover/plover/meta/command.py | def meta_command(ctx, command):
action = ctx.copy_last_action()
action.command = command
return action
| 115 | Python | .py | 4 | 24.75 | 35 | 0.711712 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,756 | word_end.py | openstenoproject_plover/plover/meta/word_end.py | def meta_word_end(ctx, meta):
action = ctx.copy_last_action()
action.word_is_finished = True
return action
| 119 | Python | .py | 4 | 25.75 | 35 | 0.695652 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,757 | case.py | openstenoproject_plover/plover/meta/case.py | from plover.formatting import Case, apply_case
def meta_case(ctx, case):
case = Case(case.lower())
action = ctx.copy_last_action()
action.next_case = case
return action
def meta_retro_case(ctx, case):
case = Case(case.lower())
action = ctx.copy_last_action()
action.prev_attach = True
... | 527 | Python | .py | 17 | 25.823529 | 53 | 0.658777 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,758 | attach.py | openstenoproject_plover/plover/meta/attach.py | from os.path import commonprefix
from plover.formatting import (
Case,
META_ATTACH_FLAG,
META_CARRY_CAPITALIZATION,
has_word_boundary,
rightmost_word,
)
from plover.orthography import add_suffix
def meta_attach(ctx, meta):
action = ctx.new_action()
begin = meta.startswith(META_ATTACH_FLAG... | 2,343 | Python | .py | 65 | 29.446154 | 65 | 0.650396 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,759 | glue.py | openstenoproject_plover/plover/meta/glue.py | def meta_glue(ctx, text):
action = ctx.new_action()
action.glue = True
action.text = text
if ctx.last_action.glue:
action.prev_attach = True
return action
| 183 | Python | .py | 7 | 21.142857 | 33 | 0.653409 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,760 | mode.py | openstenoproject_plover/plover/meta/mode.py | from plover.formatting import Case, SPACE
def meta_mode(ctx, cmdline):
"""
cmdline should be:
caps: UPPERCASE
lower: lowercase
title: Title Case
camel: titlecase, no space, initial lowercase
snake: underscore_space
reset_space: Space resets to ' '
reset... | 1,451 | Python | .py | 45 | 25.222222 | 60 | 0.59943 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,761 | punctuation.py | openstenoproject_plover/plover/meta/punctuation.py | from plover.formatting import Case
def meta_comma(ctx, text):
action = ctx.new_action()
action.text = text
action.prev_attach = True
return action
def meta_stop(ctx, text):
action = ctx.new_action()
action.prev_attach = True
action.text = text
action.next_case = Case.CAP_FIRST_WORD
... | 336 | Python | .py | 12 | 23.75 | 42 | 0.700935 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,762 | workflow_generate.py | openstenoproject_plover/.github/workflows/ci/workflow_generate.py | #!/usr/bin/env python
import shlex
import textwrap
import jinja2
import yaml
class GithubActionsYamlLoader(yaml.SafeLoader):
@staticmethod
def _unsupported(kind, token):
return SyntaxError('Github Actions does not support %s:\n%s' % (kind, token.start_mark))
def fetch_alias(self):
supe... | 2,473 | Python | .py | 64 | 33.15625 | 113 | 0.619883 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,763 | download.py | openstenoproject_plover/plover_build_utils/download.py | #!/usr/bin/env python3
from urllib.request import urlopen
from urllib.parse import urlsplit
import hashlib
import os
import sys
DOWNLOADS_DIR = os.path.join('.cache', 'downloads')
def download(url, sha1=None, filename=None, downloads_dir=DOWNLOADS_DIR):
if filename is None:
filename = os.path.basename(... | 1,612 | Python | .py | 50 | 23.7 | 74 | 0.563344 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,764 | tree.py | openstenoproject_plover/plover_build_utils/tree.py | #!/usr/bin/env python3
from pathlib import Path
import functools
import operator
import os.path
import stat
import sys
BLOCK_SIZES = (
(1024*1024*1024*1024, 'T'),
(1024*1024*1024, 'G'),
(1024*1024, 'M'),
(1024, 'K'),
)
def format_size(size):
for bs, unit in BLOCK_SI... | 1,723 | Python | .py | 63 | 20.396825 | 57 | 0.525455 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,765 | setup.py | openstenoproject_plover/plover_build_utils/setup.py | import contextlib
import importlib
import os
import subprocess
import sys
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
import pkg_resources
import setuptools
class Command(setuptools.Command):
def build_in_place(self):
self.run_command('build_py')
... | 4,977 | Python | .py | 148 | 24.945946 | 83 | 0.570625 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,766 | trim.py | openstenoproject_plover/plover_build_utils/trim.py | #!/usr/bin/env python3
import glob
import shutil
import sys
import os
def trim(directory, patterns_file, verbose=True, dry_run=False):
if dry_run:
verbose = True
# Build list of patterns.
pattern_list = []
exclude_list = []
subdir = directory
with open(patterns_file) as fp:
fo... | 1,644 | Python | .py | 50 | 22.98 | 67 | 0.551919 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,767 | get_pip.py | openstenoproject_plover/plover_build_utils/get_pip.py | #!/usr/bin/env python3
import os
import shutil
import sys
import zipfile
from .download import download
from .install_wheels import WHEELS_CACHE, install_wheels
PIP_VERSION = '21.3.1'
PIP_WHEEL_URL = 'https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3... | 1,376 | Python | .py | 30 | 41.133333 | 152 | 0.695067 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,768 | zipdir.py | openstenoproject_plover/plover_build_utils/zipdir.py | #!/usr/bin/env python3
import os
import sys
import zipfile
def zipdir(directory, compression=zipfile.ZIP_DEFLATED):
zipname = '%s.zip' % directory
prefix = os.path.dirname(directory)
with zipfile.ZipFile(zipname, 'w', compression) as zf:
for dirpath, dirnames, filenames in os.walk(directory):
... | 567 | Python | .py | 16 | 28.625 | 63 | 0.637363 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,769 | pyqt.py | openstenoproject_plover/plover_build_utils/pyqt.py | import re
def fix_icons(contents):
# replace ``addPixmap(QtGui.QPixmap(":/settings.svg"),``
# by ``addFile(":/settings.svg", QtCore.QSize(),``
contents = re.sub(
r'\baddPixmap\(QtGui\.QPixmap\(("[^"]*")\),',
r'addFile(\1, QtCore.QSize(),',
contents
)
return contents
def ge... | 1,635 | Python | .py | 47 | 26.744681 | 81 | 0.51962 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,770 | source_less.py | openstenoproject_plover/plover_build_utils/source_less.py | #!/usr/bin/env python3
import fnmatch
import os
import py_compile
import shutil
import sys
def source_less(directory, excludes=()):
for dirpath, dirnames, filenames in os.walk(directory):
if '__pycache__' in dirnames:
dirnames.remove('__pycache__')
cache = os.path.join(dirpath, '_... | 871 | Python | .py | 27 | 23.074074 | 59 | 0.556615 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,771 | install_wheels.py | openstenoproject_plover/plover_build_utils/install_wheels.py | #!/usr/bin/env python3
import os
import subprocess
import sys
# Default directory for caching wheels.
WHEELS_CACHE = os.path.join('.cache', 'wheels')
def _split_opts(text):
args = text.split()
assert (len(args) % 2) == 0
return {name: int(nb_args)
for name, nb_args
in zip(*([ite... | 3,653 | Python | .py | 131 | 21.083969 | 93 | 0.553561 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,772 | check_requirements.py | openstenoproject_plover/plover_build_utils/check_requirements.py | #!/usr/bin/env python3
from collections import OrderedDict
import pkg_resources
from plover.registry import Registry
def sorted_requirements(requirements):
return sorted(requirements, key=lambda r: str(r).lower())
# Find all available distributions.
all_requirements = [
dist.as_requirement()
for dist... | 1,540 | Python | .py | 43 | 32.348837 | 61 | 0.744953 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,773 | blackbox.py | openstenoproject_plover/plover_build_utils/testing/blackbox.py | import ast
import functools
import inspect
import operator
import re
import shlex
import textwrap
from plover import system
from plover.formatting import Formatter
from plover.steno import normalize_steno
from plover.steno_dictionary import StenoDictionary
from plover.translation import Translator
from .output import... | 4,589 | Python | .py | 112 | 32.348214 | 131 | 0.616005 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,774 | dict.py | openstenoproject_plover/plover_build_utils/testing/dict.py | from contextlib import contextmanager
from pathlib import Path
import os
import tempfile
@contextmanager
def make_dict(tmp_path, contents, extension=None, name=None):
kwargs = {'dir': str(tmp_path)}
if name is not None:
kwargs['prefix'] = name + '_'
if extension is not None:
kwargs['suffix... | 506 | Python | .py | 18 | 23 | 61 | 0.652263 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,775 | output.py | openstenoproject_plover/plover_build_utils/testing/output.py | class CaptureOutput:
def __init__(self):
self.instructions = []
self.text = ''
def send_backspaces(self, n):
assert n <= len(self.text)
self.text = self.text[:-n]
self.instructions.append(('b', n))
def send_string(self, s):
self.text += s
self.instr... | 510 | Python | .py | 15 | 26.533333 | 42 | 0.579592 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,776 | __init__.py | openstenoproject_plover/plover_build_utils/testing/__init__.py | from .blackbox import blackbox_test
from .dict import make_dict
from .output import CaptureOutput
from .parametrize import parametrize
from .steno import steno_to_stroke
from .steno_dictionary import dictionary_test
| 216 | Python | .py | 6 | 35 | 45 | 0.857143 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,777 | parametrize.py | openstenoproject_plover/plover_build_utils/testing/parametrize.py | import inspect
import pytest
def parametrize(tests, arity=None):
'''Helper for parametrizing pytest tests.
Expects a list of lambdas, one per test. Each lambda must return
the parameters for its respective test.
Test identifiers will be automatically generated, from the test
number and its lamb... | 1,189 | Python | .py | 31 | 31.451613 | 76 | 0.662902 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,778 | steno_dictionary.py | openstenoproject_plover/plover_build_utils/testing/steno_dictionary.py | from collections import defaultdict
from contextlib import contextmanager
import ast
import functools
import inspect
import os
import pytest
from plover.registry import registry
from plover.resource import ASSET_SCHEME
from plover.steno import normalize_steno
from plover.steno_dictionary import StenoDictionary
from ... | 17,403 | Python | .py | 414 | 31.707729 | 114 | 0.575849 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,779 | conf.py | openstenoproject_plover/doc/conf.py | # Configuration file for the Sphinx documentation builder.
# -- Project information -----------------------------------------------------
project = "Plover"
copyright = "Open Steno Project"
author = copyright
release = "4.0.0-rc2"
version = release
# -- General configuration ----------------------------------------... | 2,675 | Python | .py | 76 | 31.513158 | 156 | 0.605825 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,780 | settings.py | openstenoproject_plover/osx/dmg_resources/settings.py | # -*- coding: utf-8 -*-
import plistlib
import os.path
application = defines.get('app', './dist/Plover.app')
appname = os.path.basename(application)
def icon_from_app(app_path):
plist_path = os.path.join(app_path, 'Contents', 'Info.plist')
with open(plist_path, 'rb') as plist_file:
plist = plistlib.... | 1,406 | Python | .py | 46 | 28.130435 | 69 | 0.699108 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,781 | pyinfo.py | openstenoproject_plover/linux/appimage/pyinfo.py | from distutils import sysconfig
import sys
print("; ".join("py%s=%r" % (k, v) for k, v in sorted({
'exe' : sys.executable,
'prefix' : getattr(sys, "base_prefix", sys.prefix),
'version': sysconfig.get_python_version(),
'include': sysconfig.get_python_inc(prefix=''),
'ldlib' : sysconfig.get_confi... | 614 | Python | .py | 13 | 43.384615 | 68 | 0.663333 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,782 | attach.py | openstenoproject_plover/plover/meta/attach.py | from os.path import commonprefix
from plover.formatting import (
Case,
META_ATTACH_FLAG,
META_CARRY_CAPITALIZATION,
has_word_boundary,
rightmost_word,
)
from plover.orthography import add_suffix
def meta_attach(ctx, meta):
action = ctx.new_action()
begin = meta.startswith(META_ATTACH_FLAG... | 2,343 | Python | .tac | 65 | 29.446154 | 65 | 0.650396 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,783 | meson_shebang_normalisation.py | GNOME_meld/meson_shebang_normalisation.py | #!/usr/bin/env python3
import pathlib
import sys
def main():
in_path = pathlib.Path(sys.argv[1])
out_path = pathlib.Path(sys.argv[2])
if not in_path.exists():
print(f"Couldn't find {in_path}")
sys.exit(1)
lines = in_path.read_text().splitlines(keepends=True)
lines[0] = "".join(li... | 482 | Python | .py | 16 | 25.4375 | 57 | 0.618736 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,784 | setup.py | GNOME_meld/setup.py | #!/usr/bin/env python3
import glob
import pathlib
from distutils.core import setup
# Copy conf.py in place if necessary
base_path = pathlib.Path(__file__).parent
conf_path = base_path / 'meld' / 'conf.py'
if not conf_path.exists():
import shutil
shutil.copyfile(conf_path.with_suffix('.py.in'), conf_path)
im... | 2,417 | Python | .py | 73 | 26.410959 | 85 | 0.596409 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,785 | setup_win32.py | GNOME_meld/setup_win32.py | #!/usr/bin/env python3
import glob
import os.path
import pathlib
import platform
import sys
import sysconfig
from cx_Freeze import Executable, setup
def get_non_python_libs():
"""Returns list of tuples containing extra dependencies required to run
meld on current platform.
Every pair corresponds to a si... | 6,916 | Python | .py | 189 | 30.798942 | 94 | 0.636866 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,786 | conftest.py | GNOME_meld/test/conftest.py |
import importlib.machinery
import importlib.util
import sys
from unittest import mock
import pytest
@pytest.fixture(autouse=True)
def default_icon_theme():
# Our tests need to run on a system with no default display, so all
# our display-specific get_default() stuff will break.
from gi.repository impor... | 1,042 | Python | .py | 31 | 28.225806 | 71 | 0.700701 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,787 | test_iohelpers.py | GNOME_meld/test/test_iohelpers.py | from unittest import mock
import pytest
from gi.repository import Gio
from meld.iohelpers import (
find_shared_parent_path,
format_home_relative_path,
format_parent_relative_path,
)
@pytest.mark.parametrize(
'paths, expected_parent',
[
# No paths, None return
([], None),
... | 3,688 | Python | .py | 114 | 24.552632 | 73 | 0.561883 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,788 | test_filters.py | GNOME_meld/test/test_filters.py |
import pytest
@pytest.mark.parametrize("patterns,filename,expected_match", [
([r'*.csv'], 'foo.csv', True),
([r'*.cvs'], 'foo.csv', False),
([r'*.csv *.xml'], 'foo.csv', True),
([r'*.csv *.xml'], 'foo.xml', True),
([r'*.csv', r'*.xml'], 'foo.csv', True),
([r'*.csv', r'*.xml'], 'foo.xml', True... | 1,264 | Python | .py | 32 | 34.75 | 75 | 0.625 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,789 | test_accelerators.py | GNOME_meld/test/test_accelerators.py | from gi.repository import Gtk
from meld.accelerators import VIEW_ACCELERATORS
def test_accelerator_parse():
for accel_strings in VIEW_ACCELERATORS.values():
if isinstance(accel_strings, str):
accel_strings = [accel_strings]
for accel_string in accel_strings:
key, mods = G... | 1,291 | Python | .py | 30 | 33.566667 | 72 | 0.649081 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,790 | test_misc.py | GNOME_meld/test/test_misc.py |
from unittest import mock
import pytest
from meld.misc import all_same, calc_syncpoint, merge_intervals
@pytest.mark.parametrize("intervals, expected", [
# Dominated by a single range
([(1, 5), (5, 9), (10, 11), (0, 20)], [(0, 20)]),
# No overlap
([(1, 5), (6, 9), (10, 11)], [(1, 5), (6, 9), (10, 1... | 3,590 | Python | .py | 90 | 35.377778 | 111 | 0.553612 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,791 | test_filediff.py | GNOME_meld/test/test_filediff.py |
from unittest import mock
import pytest
from gi.repository import Gtk
@pytest.mark.parametrize("text, ignored_ranges, expected_text", [
# 0123456789012345678901234567890123456789012345678901234567890123456789
# Matching without groups
(
"# asdasdasdasdsad",
[(0, 17)],
"",
... | 2,604 | Python | .py | 103 | 18.84466 | 79 | 0.554038 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,792 | test_chunk_actions.py | GNOME_meld/test/test_chunk_actions.py |
from unittest import mock
import pytest
from gi.repository import GtkSource
@pytest.mark.parametrize("text, newline, expected_text", [
# For the following tests, newlines and text match
# Basic CRLF tests
("ree\r\neee", GtkSource.NewlineType.CR_LF, 'ree'),
("ree\r\neee\r\n", GtkSource.NewlineType.CR... | 2,026 | Python | .py | 46 | 38.26087 | 76 | 0.680894 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,793 | test_gutterrendererchunk.py | GNOME_meld/test/test_gutterrendererchunk.py |
from unittest import mock
import pytest
from meld.const import ActionMode
from meld.matchers.myers import DiffChunk
def make_chunk(chunk_type):
return DiffChunk(chunk_type, 0, 1, 0, 1)
@pytest.mark.parametrize("mode, editable, chunk, expected_action", [
# Replace mode with replace chunks
(ActionMode.... | 3,600 | Python | .py | 62 | 52.854839 | 83 | 0.705248 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,794 | __init__.py | GNOME_meld/test/__init__.py |
TEST_REQUIRES = {
"GLib": "2.0",
"Gtk": "3.0",
"GtkSource": "4",
}
def enforce_requires():
import gi
for namespace, version in TEST_REQUIRES.items():
gi.require_version(namespace, version)
enforce_requires()
| 242 | Python | .py | 10 | 19.8 | 52 | 0.637168 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,795 | test_buffer_lines.py | GNOME_meld/test/test_buffer_lines.py |
from unittest import mock
import pytest
from meld.meldbuffer import BufferLines, MeldBuffer
text = ("""0
1
2
3
4
5
6
7
8
9
10""")
@pytest.fixture(scope='module', autouse=True)
def mock_bind_settings():
with mock.patch('meld.meldbuffer.bind_settings', mock.DEFAULT):
yield
@pytest.fixture
def buffer_s... | 3,720 | Python | .py | 106 | 30.283019 | 78 | 0.655008 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,796 | test_matchers.py | GNOME_meld/test/test_matchers.py |
import unittest
from meld.matchers import myers
class MatchersTests(unittest.TestCase):
def test_basic_matcher(self):
a = list('abcbdefgabcdefg')
b = list('gfabcdefcd')
r = [(0, 2, 3), (4, 5, 3), (10, 8, 2), (15, 10, 0)]
matcher = myers.MyersSequenceMatcher(None, a, b)
b... | 2,016 | Python | .py | 46 | 35.565217 | 75 | 0.570408 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,797 | conftest.py | GNOME_meld/test/dirdiff/conftest.py | import pytest
CHUNK_SIZE = 4096 * 10
diff_definition = {
"a": {
"a.txt": lambda: b"",
"c": {"c.txt": lambda: b""},
"d": {"d.txt": lambda: (b"d" * CHUNK_SIZE) + b"d"},
"e": {
"f": {},
"g": {"g.txt": lambda: b"g"},
"h": {"h.txt": lambda: b"h"},
... | 1,398 | Python | .py | 46 | 21.869565 | 59 | 0.437593 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,798 | test_remove_blank_lines.py | GNOME_meld/test/dirdiff/test_remove_blank_lines.py | import pytest
@pytest.mark.parametrize('txt, expected', [
# blank to be equal blank
(b'', b''),
# one line with spaces
(b' ', b' '),
# two lines empty
(b'\n', b''),
(b'\n ', b' '),
(b' \n', b' '),
(b' \n ', b' \n '),
# tree lines empty
(b'\n\n', b''),
(b'\n\n ', b' '),
... | 823 | Python | .py | 28 | 24.857143 | 63 | 0.549242 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,799 | test_files_same.py | GNOME_meld/test/dirdiff/test_files_same.py | from enum import Enum
from os import path
import pytest
DiffResult = Enum(
"DiffResult", "Same SameFiltered DodgySame DodgyDifferent Different FileError"
)
def abspath(*args):
d = path.dirname(__file__)
return list(path.join(d, arg) for arg in args)
cmp_args = {
"shallow-comparison": False,
"t... | 3,399 | Python | .py | 80 | 35.1 | 86 | 0.603083 | GNOME/meld | 1,057 | 264 | 0 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |