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,600 | start.py | rafalp_Misago/misago/posting/forms/start.py | from typing import TYPE_CHECKING
from django import forms
from django.contrib.auth import get_user_model
from django.http import HttpRequest
from django.utils.translation import npgettext, pgettext
from ...core.utils import slugify
from ..state.start import StartThreadState
from .base import PostingForm
from .formset... | 3,483 | Python | .py | 81 | 32.246914 | 84 | 0.601007 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,601 | base.py | rafalp_Misago/misago/posting/forms/base.py | from django import forms
from ..state.base import PostingState
class PostingForm(forms.Form):
def update_state(self, state: PostingState):
pass
| 159 | Python | .py | 5 | 27.8 | 48 | 0.768212 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,602 | formset.py | rafalp_Misago/misago/posting/forms/formset.py | from ...forms.formset import Formset
from ..state.base import PostingState
class PostingFormset(Formset):
def update_state(self, state: PostingState):
for form in self.forms.values():
if form.is_valid():
form.update_state(state)
| 271 | Python | .py | 7 | 31.714286 | 48 | 0.679389 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,603 | test_start_private_thread_view.py | rafalp_Misago/misago/posting/tests/test_start_private_thread_view.py | from django.urls import reverse
from ...test import assert_contains
from ...threads.models import Thread
def test_start_private_thread_view_displays_login_page_to_guests(db, client):
response = client.get(reverse("misago:start-private-thread"))
assert_contains(response, "Sign in to start new thread")
def t... | 2,252 | Python | .py | 56 | 33.928571 | 99 | 0.68211 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,604 | test_start_category_thread_view.py | rafalp_Misago/misago/posting/tests/test_start_category_thread_view.py | from django.urls import reverse
from ...permissions.enums import CategoryPermission
from ...permissions.models import CategoryGroupPermission
from ...test import assert_contains
from ...threads.models import Thread
def test_start_thread_view_displays_login_page_to_guests(client, default_category):
response = cli... | 4,606 | Python | .py | 131 | 27.977099 | 99 | 0.648011 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,605 | test_select_category_view.py | rafalp_Misago/misago/posting/tests/test_select_category_view.py | import pytest
from django.urls import reverse
from ...categories.models import Category
from ...permissions.enums import CategoryPermission
from ...permissions.models import CategoryGroupPermission
from ...test import assert_contains, assert_not_contains
from ...testutils import grant_category_group_permissions
@pyt... | 15,513 | Python | .py | 450 | 27.471111 | 104 | 0.656771 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,606 | apps.py | rafalp_Misago/misago/components/apps.py | from django.apps import AppConfig
class MisagoComponentsConfig(AppConfig):
name = "misago.components"
label = "misago_components"
verbose_name = "Misago Components"
| 179 | Python | .py | 5 | 32 | 40 | 0.773256 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,607 | misago_component.py | rafalp_Misago/misago/components/templatetags/misago_component.py | from django import template
from django.template.loader import get_template
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag(takes_context=True)
def includecomponent(context, data):
component_context = context.flatten()
component_context.update(data)
templa... | 418 | Python | .py | 10 | 38.9 | 56 | 0.802469 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,608 | celery.py | rafalp_Misago/devproject/celery.py | import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "devproject.settings")
app = Celery("devproject")
# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# -... | 573 | Python | .py | 12 | 46.333333 | 70 | 0.796763 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,609 | settings.py | rafalp_Misago/devproject/settings.py | # pylint: disable=line-too-long
"""
Django settings for dev project.
Generated by 'django-admin startproject' using Django 1.11.15.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11... | 10,909 | Python | .py | 238 | 41.983193 | 117 | 0.746686 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,610 | urls.py | rafalp_Misago/devproject/urls.py | """devproject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | 2,893 | Python | .py | 64 | 41.640625 | 79 | 0.744401 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,611 | test_settings.py | rafalp_Misago/devproject/test_settings.py | from .settings import * # pylint: disable-all
# Use in-memory cache
CACHES = {"default": {"BACKEND": "django.core.cache.backends.dummy.DummyCache"}}
# Disable Celery backend
CELERY_BROKER_URL = None
# Disable Debug Toolbar
DEBUG_TOOLBAR_CONFIG = {}
INTERNAL_IPS = []
# Store mails in memory
EMAIL_BACKEND = "django.... | 1,563 | Python | .py | 38 | 38.421053 | 91 | 0.761243 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,612 | wsgi.py | rafalp_Misago/devproject/wsgi.py | """
WSGI config for devproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_... | 399 | Python | .py | 10 | 38.2 | 78 | 0.806283 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,613 | misago_plugin.py | rafalp_Misago/plugins/full-manifest-plugin/full_manifest_plugin/misago_plugin.py | from misago import MisagoPlugin
manifest = MisagoPlugin(
name="Example plugin with complete manifest",
description="This plugin has all fields in its manifest filled in.",
license="GNU GPL v2",
icon="fa fa-wrench",
color="#9b59b6",
version="0.1DEV",
author="Rafał Pitoń",
homepage="http... | 554 | Python | .py | 15 | 32.466667 | 72 | 0.699065 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,614 | misago_plugin.py | rafalp_Misago/plugins/misago-dev-site-fixture/misago_dev_site_fixture/misago_plugin.py | from misago import MisagoPlugin
manifest = MisagoPlugin(
name="Dev Site Fixture",
description="Populates development sites with some initial data.",
license="GNU GPL v2",
icon="fas fa-rocket",
color="#3b82f6",
version="1.0",
author="Rafał Pitoń",
homepage="https://misago-project.org",
... | 529 | Python | .py | 15 | 30.8 | 70 | 0.694118 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,615 | loaddevfixture.py | rafalp_Misago/plugins/misago-dev-site-fixture/misago_dev_site_fixture/management/commands/loaddevfixture.py | from datetime import timedelta
from random import randint
from textwrap import dedent
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.utils import timezone
from misago.cache.enums import CacheName
from misago.cache.versions import get_cache_versions, inval... | 27,408 | Python | .py | 685 | 28.363504 | 115 | 0.574734 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,616 | attachment.js | rafalp_Misago/frontend/src/components/posts-list/post/attachments/attachment.js | import React from "react"
import misago from "misago"
import escapeHtml from "misago/utils/escape-html"
import formatFilesize from "misago/utils/file-size"
const DATE_ABBR = '<abbr title="%(absolute)s">%(relative)s</abbr>'
const USER_SPAN = '<span class="item-title">%(user)s</span>'
const USER_URL = '<a href="%(url)s"... | 2,715 | Python | .tac | 107 | 20.102804 | 75 | 0.626395 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,617 | MarkupEditorAttachment.jsx | rafalp_Misago/frontend/src/components/MarkupEditor/MarkupEditorAttachment.jsx | import React from "react"
import modal from "../../services/modal"
import snackbar from "../../services/snackbar"
import formatFilesize from "../../utils/file-size"
import MarkupAttachmentModal from "./MarkupAttachmentModal"
import { getSelection, replaceSelection } from "./operations"
const MarkupEditorAttachment = (... | 4,534 | Python | .tac | 132 | 23.257576 | 79 | 0.514104 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,618 | MarkupEditorAttachments.jsx | rafalp_Misago/frontend/src/components/MarkupEditor/MarkupEditorAttachments.jsx | import React from "react"
import MarkupEditorAttachment from "./MarkupEditorAttachment"
const MarkupEditorAttachments = ({
attachments,
disabled,
element,
setState,
update,
}) => (
<div className="markup-editor-attachments">
<div className="markup-editor-attachments-container">
{attachments.map((... | 648 | Python | .tac | 25 | 20.44 | 61 | 0.668277 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,619 | MarkupAttachmentModal.jsx | rafalp_Misago/frontend/src/components/MarkupEditor/MarkupAttachmentModal.jsx | import React from "react"
import formatFilesize from "../../utils/file-size"
export default function MarkupAttachmentModal({ attachment }) {
return (
<div className="modal-dialog modal-lg" role="document">
<div className="modal-content">
<div className="modal-header">
<button
... | 2,821 | Python | .tac | 80 | 22.8 | 78 | 0.483942 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,620 | attachments.js | rafalp_Misago/frontend/src/components/posting/utils/attachments.js | import moment from "moment"
export function clean(attachments) {
return attachments
.filter((attachment) => {
return attachment.id && !attachment.isRemoved
})
.map((a) => {
return a.id
})
}
export function hydrate(attachments) {
return attachments.map((attachment) => {
return Objec... | 412 | Python | .tac | 17 | 20.294118 | 51 | 0.664122 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,621 | attachments.html | rafalp_Misago/misago/templates/misago/thread_old/posts/post/attachments.html | {% load i18n misago_batch misago_capture %}
<div class="post-attachments">
{% for row in post.attachments|batch:2 %}
<div class="row">
{% for attachment in row %}
<div class="col-xs-12 col-md-6">
<div class="post-attachment-preview">
{% if attachment.is_image %}
{... | 2,115 | Python | .tac | 42 | 38.190476 | 186 | 0.53134 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,622 | attachment.py | rafalp_Misago/misago/threads/models/attachment.py | import os
from hashlib import md5
from io import BytesIO
from django.core.files import File
from django.core.files.base import ContentFile
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_random_string
from PIL import Image
from ...conf... | 4,090 | Python | .tac | 100 | 33.35 | 87 | 0.666667 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,623 | attachmenttype.py | rafalp_Misago/misago/threads/models/attachmenttype.py | from django.db import models
from django.utils.translation import pgettext_lazy
from ...plugins.models import PluginDataModel
class AttachmentType(PluginDataModel):
ENABLED = 0
LOCKED = 1
DISABLED = 2
name = models.CharField(max_length=255)
extensions = models.CharField(max_length=255)
mimet... | 1,905 | Python | .tac | 61 | 21.147541 | 71 | 0.56325 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,624 | 0003_attachment_types.py | rafalp_Misago/misago/threads/migrations/0003_attachment_types.py | # Generated by Django 1.9.7 on 2016-10-04 21:41
from django.db import migrations
ATTACHMENTS = [
{
"name": "GIF",
"extensions": ("gif",),
"mimetypes": ("image/gif",),
"size_limit": 5 * 1024,
},
{
"name": "JPG",
"extensions": ("jpg", "jpeg"),
"mimetype... | 2,628 | Python | .tac | 97 | 19.597938 | 71 | 0.487921 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,625 | attachment.py | rafalp_Misago/misago/threads/views/attachment.py | from django.templatetags.static import static
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect
from ...conf import settings
from ..models import Attachment, AttachmentType
def attachment_server(request, pk, secret, thumbnail=... | 2,319 | Python | .tac | 50 | 39.26 | 85 | 0.713525 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,626 | attachments.py | rafalp_Misago/misago/threads/api/attachments.py | from django.core.exceptions import PermissionDenied, ValidationError
from django.template.defaultfilters import filesizeformat
from django.utils.translation import pgettext
from rest_framework import viewsets
from rest_framework.response import Response
from ...acl.objectacl import add_acl_to_obj
from ...users.audittr... | 3,919 | Python | .tac | 98 | 29.765306 | 87 | 0.616803 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,627 | attachments.py | rafalp_Misago/misago/threads/api/postingendpoint/attachments.py | from django.utils.translation import npgettext, pgettext
from rest_framework import serializers
from rest_framework.fields import empty
from . import PostingEndpoint, PostingMiddleware
from ....acl.objectacl import add_acl_to_obj
from ...serializers import AttachmentSerializer
class AttachmentsMiddleware(PostingMidd... | 4,967 | Python | .tac | 116 | 31.422414 | 102 | 0.601865 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,628 | test_attachments_middleware.py | rafalp_Misago/misago/threads/tests/test_attachments_middleware.py | from unittest.mock import Mock
import pytest
from rest_framework import serializers
from .. import test
from ...conf.test import override_dynamic_settings
from ..api.postingendpoint import PostingEndpoint
from ..api.postingendpoint.attachments import (
AttachmentsMiddleware,
validate_attachments_count,
)
from... | 9,916 | Python | .tac | 235 | 36.638298 | 87 | 0.722592 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,629 | test_attachments_proxy.py | rafalp_Misago/misago/threads/tests/test_attachments_proxy.py | import pytest
from django.urls import reverse
from ...acl.models import Role
from ...acl.test import patch_user_acl
from ...conf import settings
from ...conf.test import override_dynamic_settings
from ..models import Attachment, AttachmentType
@pytest.fixture
def attachment_type(db):
return AttachmentType.object... | 8,186 | Python | .tac | 208 | 34.163462 | 87 | 0.722264 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,630 | test_clearattachments.py | rafalp_Misago/misago/threads/tests/test_clearattachments.py | from datetime import timedelta
from io import StringIO
import pytest
from django.core import management
from django.utils import timezone
from ...conf.test import override_dynamic_settings
from ..management.commands import clearattachments
from ..models import Attachment, AttachmentType
@pytest.fixture
def attachme... | 2,197 | Python | .tac | 49 | 40.285714 | 70 | 0.752582 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,631 | test_attachments_api.py | rafalp_Misago/misago/threads/tests/test_attachments_api.py | import os
from django.urls import reverse
from PIL import Image
from ...acl.models import Role
from ...acl.test import patch_user_acl
from ...conf import settings
from ...users.test import AuthenticatedUserTestCase
from ..models import Attachment, AttachmentType
TESTFILES_DIR = os.path.join(os.path.dirname(os.path.a... | 12,624 | Python | .tac | 244 | 41.885246 | 88 | 0.653378 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,632 | clearattachments.py | rafalp_Misago/misago/threads/management/commands/clearattachments.py | import time
from datetime import timedelta
from django.core.management.base import BaseCommand
from django.utils import timezone
from ....conf.shortcuts import get_dynamic_settings
from ....core.management.progressbar import show_progress
from ...models import Attachment
class Command(BaseCommand):
help = "Dele... | 1,409 | Python | .tac | 28 | 42.857143 | 87 | 0.706871 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,633 | attachmenttypes.py | rafalp_Misago/misago/threads/admin/views/attachmenttypes.py | from django.contrib import messages
from django.db.models import Count
from django.utils.translation import pgettext, pgettext_lazy
from ....admin.views import generic
from ...models import AttachmentType
from ..forms import AttachmentTypeForm
class AttachmentTypeAdmin(generic.AdminBaseMixin):
root_link = "misag... | 2,122 | Python | .tac | 48 | 37.3125 | 95 | 0.69694 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,634 | attachments.py | rafalp_Misago/misago/threads/admin/views/attachments.py | from django.contrib import messages
from django.db import transaction
from django.utils.translation import pgettext, pgettext_lazy
from ....admin.views import generic
from ...models import Attachment, Post
from ..forms import FilterAttachmentsForm
class AttachmentAdmin(generic.AdminBaseMixin):
root_link = "misag... | 3,895 | Python | .tac | 86 | 36.209302 | 87 | 0.64591 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,635 | test_attachments_views.py | rafalp_Misago/misago/threads/admin/tests/test_attachments_views.py | from django.urls import reverse
from ... import test
from ....admin.test import AdminTestCase
from ....categories.models import Category
from ...models import Attachment, AttachmentType
class AttachmentAdminViewsTests(AdminTestCase):
def setUp(self):
super().setUp()
self.category = Category.obje... | 4,680 | Python | .tac | 103 | 35.184466 | 85 | 0.629833 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,636 | test_attachment_types_views.py | rafalp_Misago/misago/threads/admin/tests/test_attachment_types_views.py | from django.urls import reverse
from ....acl.models import Role
from ....admin.test import AdminTestCase
from ...models import AttachmentType
class AttachmentTypeAdminViewsTests(AdminTestCase):
def setUp(self):
super().setUp()
self.admin_link = reverse("misago:admin:settings:attachment-types:inde... | 7,950 | Python | .tac | 181 | 32.342541 | 88 | 0.582406 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,637 | attachments.py | rafalp_Misago/misago/threads/permissions/attachments.py | from django import forms
from django.utils.translation import pgettext_lazy
from ...acl import algebra
from ...acl.models import Role
from ...admin.forms import YesNoSwitch
from ..models import Attachment
# Admin Permissions Forms
class PermissionsForm(forms.Form):
legend = pgettext_lazy("attachments permission"... | 2,427 | Python | .tac | 62 | 32.451613 | 88 | 0.690375 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,638 | attachment.py | rafalp_Misago/misago/threads/serializers/attachment.py | from django.urls import reverse
from rest_framework import serializers
from ..models import Attachment
__all__ = ["AttachmentSerializer"]
class AttachmentSerializer(serializers.ModelSerializer):
post = serializers.PrimaryKeyRelatedField(read_only=True)
acl = serializers.SerializerMethodField()
is_image... | 1,403 | Python | .tac | 44 | 22.795455 | 88 | 0.584261 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,639 | objectacl.py | rafalp_Misago/misago/acl/objectacl.py | from .providers import providers
def add_acl_to_obj(user_acl, obj):
"""add valid ACL to obj (iterable of objects or single object)"""
if hasattr(obj, "__iter__"):
for item in obj:
_add_acl_to_obj(user_acl, item)
else:
_add_acl_to_obj(user_acl, obj)
def _add_acl_to_obj(user_ac... | 508 | Python | .tac | 13 | 33.076923 | 69 | 0.640816 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,640 | setup.py | openstenoproject_plover/setup.py | #!/usr/bin/env python3
# Copyright (c) 2010 Joshua Harlan Lifton.
# See LICENSE.txt for details.
import os
import re
import subprocess
import sys
from setuptools import setup
try:
from setuptools.extern.packaging.version import Version
except ImportError:
# Handle broken unvendored version of setuptools...
... | 7,731 | Python | .py | 226 | 27.442478 | 101 | 0.606048 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,641 | conftest.py | openstenoproject_plover/test/conftest.py | import os
import pytest
# Ensure i18n support does not mess us up.
os.environ['LANGUAGE'] = 'C'
from plover import system
from plover.config import DEFAULT_SYSTEM_NAME
from plover.registry import registry
@pytest.fixture(scope='session', autouse=True)
def setup_plover():
registry.update()
system.setup(DEFA... | 604 | Python | .py | 17 | 31.764706 | 60 | 0.744828 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,642 | test_machine.py | openstenoproject_plover/test/test_machine.py | from unittest.mock import Mock
from plover.machine.base import ThreadedStenotypeBase
class MyMachine(ThreadedStenotypeBase):
def run(self):
raise "some unexpected error"
def test_update_machine_staten_on_unhandled_exception():
machine = MyMachine()
callback = Mock()
machine.add_state_callback(... | 425 | Python | .py | 12 | 31.25 | 56 | 0.76399 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,643 | test_blackbox.py | openstenoproject_plover/test/test_blackbox.py | # -*- coding: utf-8 -*-
import pytest
from plover import system
from plover.registry import Registry
from plover.system import english_stenotype
from plover_build_utils.testing import blackbox_test
@pytest.fixture
def with_melani_system(monkeypatch, request):
class Melani:
KEYS = (
'#',
... | 39,421 | Python | .py | 1,483 | 17.732299 | 91 | 0.403574 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,644 | test_resource.py | openstenoproject_plover/test/test_resource.py | from pathlib import Path
import inspect
import pytest
from plover.misc import normalize_path
from plover.resource import (
resource_exists,
resource_filename,
resource_timestamp,
resource_update,
)
@pytest.mark.parametrize('resource, exists, filename', (
# Relative filename.
(Path(__file__).... | 3,481 | Python | .py | 94 | 30.712766 | 82 | 0.663117 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,645 | test_steno.py | openstenoproject_plover/test/test_steno.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Unit tests for steno.py."""
import inspect
import pytest
from plover.steno import normalize_steno, Stroke
from plover_build_utils.testing import parametrize
NORMALIZE_TESTS = (
lambda: ('S', ('S',)),
lambda: ('S-', ('S',)),
lambda: (... | 3,180 | Python | .py | 92 | 29.445652 | 78 | 0.478063 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,646 | test_formatting.py | openstenoproject_plover/test/test_formatting.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Unit tests for formatting.py."""
import inspect
import pytest
from plover import formatting
from plover.formatting import Case
from plover_build_utils.testing import CaptureOutput, parametrize
def action(**kwargs):
# Support using something ... | 38,867 | Python | .py | 993 | 32.930514 | 112 | 0.590915 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,647 | test_rtfcre_dict.py | openstenoproject_plover/test/test_rtfcre_dict.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
import textwrap
import pytest
from plover import __version__ as plover_version
from plover.dictionary.rtfcre_dict import RtfDictionary, TranslationFormatter
from plover.dictionary.rtfcre_parse import BadRtfError
from plover_build_utils.testing import ... | 16,537 | Python | .py | 447 | 30.145414 | 114 | 0.52549 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,648 | test_log.py | openstenoproject_plover/test/test_log.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
import os
from logging import Handler
from collections import defaultdict
import pytest
from plover.steno import Stroke
from plover import log
class FakeHandler(Handler):
outputs = defaultdict(list)
def __init__(self, filename, format=log.S... | 2,611 | Python | .py | 74 | 30.5 | 74 | 0.639396 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,649 | test_misc.py | openstenoproject_plover/test/test_misc.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Open Steno Project
# See LICENSE.txt for details.
"""Tests for misc.py."""
import inspect
import os
import pytest
import plover.misc as misc
import plover.oslayer.config as conf
from plover.resource import ASSET_SCHEME
from plover_build_utils.testing import parametrize
... | 2,942 | Python | .py | 92 | 26.641304 | 80 | 0.631078 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,650 | test_default_dict.py | openstenoproject_plover/test/test_default_dict.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
import json
from collections import defaultdict
import pytest
from plover_build_utils.testing import steno_to_stroke
DICT_NAMES = ['main.json',
'commands.json',
'user.json']
DICT_PATH = 'plover/assets/'
def test_no_dupli... | 1,280 | Python | .py | 35 | 29.714286 | 66 | 0.624595 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,651 | test_loading_manager.py | openstenoproject_plover/test/test_loading_manager.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Tests for loading_manager.py."""
from collections import defaultdict
import os
import tempfile
import pytest
from plover.exception import DictionaryLoaderException
import plover.dictionary.loading_manager as loading_manager
class FakeDictionaryCo... | 3,951 | Python | .py | 99 | 33.989899 | 84 | 0.668145 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,652 | test_orthography.py | openstenoproject_plover/test/test_orthography.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
from plover.orthography import add_suffix
from plover_build_utils.testing import parametrize
ADD_SUFFIX_TESTS = (
lambda: ('artistic', 'ly', 'artistically'),
lambda: ('cosmetic', 'ly', 'cosmetically'),
lambda: ('establish', 's', 'establish... | 6,225 | Python | .py | 141 | 39.340426 | 61 | 0.577233 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,653 | test_passport.py | openstenoproject_plover/test/test_passport.py | # Copyright (c) 2011 Hesky Fisher
# See LICENSE.txt for details.
"""Unit tests for passport.py."""
import threading
from plover.machine.passport import Passport
from plover_build_utils.testing import parametrize
class MockSerial:
def __init__(self, **params):
pass
def isOpen(self):
retur... | 1,640 | Python | .py | 48 | 28.270833 | 76 | 0.629911 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,654 | test_steno_dictionary.py | openstenoproject_plover/test/test_steno_dictionary.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Unit tests for steno_dictionary.py."""
import pytest
from plover.steno_dictionary import StenoDictionary, StenoDictionaryCollection
from plover_build_utils.testing import dictionary_test
def test_dictionary_collection():
d1 = StenoDictionary(... | 6,352 | Python | .py | 184 | 29.402174 | 88 | 0.571639 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,655 | test_engine.py | openstenoproject_plover/test/test_engine.py | from functools import partial
import os
import tempfile
import pytest
from plover import system
from plover.config import Config, DictionaryConfig
from plover.engine import ErroredDictionary, StenoEngine
from plover.machine.base import (
STATE_INITIALIZING,
STATE_RUNNING,
STATE_STOPPED,
StenotypeBase,... | 9,074 | Python | .py | 245 | 28.689796 | 79 | 0.609318 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,656 | test_json_dict.py | openstenoproject_plover/test/test_json_dict.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Unit tests for json.py."""
from plover.dictionary.json_dict import JsonDictionary
from plover_build_utils.testing import dictionary_test
def json_load_test(contents, expected):
if isinstance(contents, str):
cont... | 2,213 | Python | .py | 75 | 23.813333 | 77 | 0.55655 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,657 | test_stentura.py | openstenoproject_plover/test/test_stentura.py | # Copyright (c) 2011 Hesky Fisher
# See LICENSE.txt for details.
"""Unit tests for stentura.py."""
import struct
import threading
import pytest
from plover.machine import stentura
def make_response(seq, action, error=0, p1=0, p2=0, data=None, length=None):
if not length:
length = 14
if data:
... | 17,617 | Python | .py | 459 | 30.228758 | 90 | 0.580658 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,658 | test_key_combo.py | openstenoproject_plover/test/test_key_combo.py |
import inspect
import itertools
import pytest
from plover.key_combo import parse_key_combo
def generate_combo_tests(test_id, *params, key_name_to_key_code=None):
yield ('id', test_id)
if key_name_to_key_code is not None:
yield ('key_name_to_key_code', key_name_to_key_code)
for iterables in para... | 4,424 | Python | .py | 136 | 23.683824 | 141 | 0.494966 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,659 | test_config.py | openstenoproject_plover/test/test_config.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Unit tests for config.py."""
from ast import literal_eval
from contextlib import ExitStack
from pathlib import Path
from site import USER_BASE
from string import Template
import inspect
import json
import os
import subprocess
import sys
import textwr... | 18,429 | Python | .py | 593 | 23.82968 | 144 | 0.593754 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,660 | py37compat.py | openstenoproject_plover/test/py37compat.py | import sys
if sys.version_info[:2] <= (3, 7):
import mock
else:
from unittest import mock
| 99 | Python | .py | 5 | 17 | 34 | 0.688172 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,661 | test_keyboard.py | openstenoproject_plover/test/test_keyboard.py | import pytest
from plover import system
from plover.machine.keyboard import Keyboard
from plover.machine.keymap import Keymap
from plover.oslayer.keyboardcontrol import KeyboardCapture
from .py37compat import mock
def send_input(capture, key_events):
for evt in key_events.strip().split():
if evt.startsw... | 3,486 | Python | .py | 97 | 30.979381 | 125 | 0.655203 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,662 | test_translation.py | openstenoproject_plover/test/test_translation.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Unit tests for translation.py."""
from collections import namedtuple
import ast
import copy
import operator
from plover.oslayer.config import PLATFORM
from plover.steno import Stroke, normalize_steno
import pytest
from plover.steno_dictionary impo... | 28,803 | Python | .py | 808 | 27.32302 | 88 | 0.551814 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,663 | test_command.py | openstenoproject_plover/test/test_command.py | """ Unit tests for built-in engine command plugins. """
import ast
import pytest
from plover.command.set_config import set_config
from plover.config import Config, DictionaryConfig
from plover_build_utils.testing import parametrize
from .test_config import DEFAULTS, DEFAULT_KEYMAP
class FakeEngine:
""" The p... | 3,119 | Python | .py | 66 | 42.712121 | 120 | 0.663047 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,664 | test_keymap.py | openstenoproject_plover/test/test_keymap.py |
import pytest
from plover.machine.keymap import Keymap
def new_keymap():
return Keymap(('k%u' % n for n in range(8)),
('a%u' % n for n in range(4)))
BINDINGS_LIST = (
('k0', 'a0'),
('k1', 'a3'),
('k4', 'a1'),
('k5', 'a2'),
('k7', 'a1'),
)
BINDINGS_DICT = dict(BINDINGS_LIST... | 2,392 | Python | .py | 78 | 26.076923 | 57 | 0.601128 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,665 | test_steno_validator.py | openstenoproject_plover/test/gui_qt/test_steno_validator.py | from PyQt5.QtGui import QValidator
import pytest
from plover.gui_qt.steno_validator import StenoValidator
@pytest.mark.parametrize(('text', 'state'), (
# Acceptable.
('ST', QValidator.Acceptable),
('TEFT', QValidator.Acceptable),
('TEFT/-G', QValidator.Acceptable),
('/ST', QValidator.Acceptable)... | 844 | Python | .py | 24 | 31 | 74 | 0.680147 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,666 | test_dictionaries_widget.py | openstenoproject_plover/test/gui_qt/test_dictionaries_widget.py | from collections import namedtuple
from pathlib import Path
from textwrap import dedent
from types import SimpleNamespace
import operator
from PyQt5.QtCore import QModelIndex, QPersistentModelIndex, Qt
import pytest
from plover.config import DictionaryConfig
from plover.engine import ErroredDictionary
from plover.gu... | 30,814 | Python | .py | 908 | 26.55837 | 114 | 0.604169 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,667 | key_combo.py | openstenoproject_plover/plover/key_combo.py | # -*- coding: utf-8 -*-
import re
# Mapping of "standard" keynames (derived from X11 keysym names) to Unicode.
KEYNAME_TO_CHAR = {
# Generated using:
#
# from Xlib import XK
# from plover.oslayer.linux.keyboardcontrol_x11 import keysym_to_string
# for kn, ks in sorted({
# name[3:].lower()... | 7,359 | Python | .py | 197 | 30.406091 | 81 | 0.38368 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,668 | steno.py | openstenoproject_plover/plover/steno.py | # Copyright (c) 2010-2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"""Generic stenography data models.
This module contains the following class:
Stroke -- A data model class that encapsulates a sequence of steno keys.
"""
from plover_stroke import BaseStroke
class Stroke(BaseStroke):
"""A standa... | 3,491 | Python | .py | 84 | 34.214286 | 88 | 0.659763 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,669 | suggestions.py | openstenoproject_plover/plover/suggestions.py | import collections
from plover.steno import sort_steno_strokes
Suggestion = collections.namedtuple('Suggestion', 'text steno_list')
class Suggestions:
def __init__(self, dictionary):
self.dictionary = dictionary
def find(self, translation):
suggestions = []
mods = [
'%... | 1,675 | Python | .py | 39 | 31.974359 | 81 | 0.592113 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,670 | config.py | openstenoproject_plover/plover/config.py | # Copyright (c) 2010-2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"""Configuration management."""
from collections import ChainMap, namedtuple, OrderedDict
import configparser
import json
import re
from plover.exception import InvalidConfigurationError
from plover.machine.keymap import Keymap
from plove... | 15,574 | Python | .py | 357 | 34.848739 | 144 | 0.634068 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,671 | exception.py | openstenoproject_plover/plover/exception.py | # Copyright (c) 2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"""Custom exceptions used by Plover.
The exceptions in this module are typically caught in the main GUI
loop and displayed to the user as an alert dialog.
"""
class InvalidConfigurationError(Exception):
"Raised when there is something wro... | 697 | Python | .py | 17 | 36.529412 | 81 | 0.71471 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,672 | formatting.py | openstenoproject_plover/plover/formatting.py | # Copyright (c) 2010-2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"""This module converts translations to printable text.
This module defines and implements plover's custom dictionary language.
"""
from enum import Enum
from os.path import commonprefix
from collections import namedtuple
import re
impor... | 32,725 | Python | .py | 789 | 31.693283 | 110 | 0.584283 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,673 | i18n.py | openstenoproject_plover/plover/i18n.py | import os
import gettext
from plover.oslayer.config import CONFIG_DIR, PLATFORM
from plover.oslayer.i18n import get_system_language
from plover.resource import ASSET_SCHEME, resource_filename
def get_language():
# Give priority to LANGUAGE environment variable.
lang = os.environ.get('LANGUAGE')
if lang i... | 1,575 | Python | .py | 43 | 29.511628 | 82 | 0.662722 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,674 | __init__.py | openstenoproject_plover/plover/__init__.py | # Copyright (c) 2010-2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"""Plover: Open Source Stenography Software"""
if __name__ == 'plover':
from plover.i18n import Translator
_ = Translator(__package__)
else:
# exec from `setup.py`, package data
# may not be available, and we don't
# wa... | 1,164 | Python | .py | 31 | 35.580645 | 74 | 0.727595 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,675 | engine.py | openstenoproject_plover/plover/engine.py |
from collections import namedtuple, OrderedDict
from functools import wraps
from queue import Queue
import os
import shutil
import threading
from plover import log, system
from plover.dictionary.loading_manager import DictionaryLoadingManager
from plover.exception import DictionaryLoaderException
from plover.formatti... | 20,368 | Python | .py | 496 | 31.441532 | 94 | 0.624779 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,676 | log.py | openstenoproject_plover/plover/log.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""A module to handle logging."""
import os
import sys
import logging
import traceback
from logging.handlers import RotatingFileHandler
from logging import DEBUG, INFO, WARNING, ERROR
from plover.oslayer.config import CONFIG_DIR, PLATFORM
LOG_FORMAT... | 6,574 | Python | .py | 162 | 32.290123 | 105 | 0.646856 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,677 | resource.py | openstenoproject_plover/plover/resource.py | from contextlib import contextmanager
from importlib.util import find_spec
from tempfile import NamedTemporaryFile
import os
import shutil
ASSET_SCHEME = 'asset:'
def _asset_filename(resource_name):
components = resource_name[len(ASSET_SCHEME):].split(':', 1)
if len(components) != 2:
raise ValueErro... | 1,682 | Python | .py | 41 | 35.195122 | 78 | 0.721372 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,678 | steno_dictionary.py | openstenoproject_plover/plover/steno_dictionary.py | # Copyright (c) 2013 Hesky Fisher.
# See LICENSE.txt for details.
"""StenoDictionary class and related functions.
A steno dictionary maps sequences of steno strokes to translations.
"""
import collections
import os
from plover.resource import ASSET_SCHEME, resource_filename, resource_timestamp, resource_update
c... | 8,634 | Python | .py | 243 | 25.950617 | 96 | 0.575114 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,679 | orthography.py | openstenoproject_plover/plover/orthography.py | # Copyright (c) 2010-2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
"""Functions that implement some English orthographic rules."""
from plover import system
def make_candidates_from_rules(word, suffix, check=lambda x: True):
candidates = []
for r in system.ORTHOGRAPHY_RULES:
m = r[0].mat... | 1,814 | Python | .py | 45 | 33.466667 | 77 | 0.677927 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,680 | registry.py | openstenoproject_plover/plover/registry.py | from collections import namedtuple
import pkg_resources
from plover.oslayer.config import PLUGINS_PLATFORM
from plover import log
class Plugin:
def __init__(self, plugin_type, name, obj):
self.plugin_type = plugin_type
self.name = name
self.obj = obj
self.__doc__ = obj.__doc__ o... | 3,544 | Python | .py | 85 | 31.505882 | 79 | 0.602792 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,681 | misc.py | openstenoproject_plover/plover/misc.py | # Copyright (c) 2016 Open Steno Project
# See LICENSE.txt for details.
import os
from plover.oslayer.config import CONFIG_DIR
from plover.resource import ASSET_SCHEME
def popcount_8(v):
"""Population count for an 8 bit integer"""
assert 0 <= v <= 255
v -= ((v >> 1) & 0x55555555)
v = (v & 0x33333333)... | 2,455 | Python | .py | 67 | 30.268657 | 83 | 0.628788 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,682 | translation.py | openstenoproject_plover/plover/translation.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Stenography translation.
This module handles translating streams of strokes in translations. Two classes
compose this module:
Translation -- A data model class that encapsulates a sequence of Stroke objects
in the context of a particular dictionary.... | 17,317 | Python | .py | 399 | 34.694236 | 93 | 0.636266 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,683 | loading_manager.py | openstenoproject_plover/plover/dictionary/loading_manager.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Centralized place for dictionary loading operation."""
import threading
import time
from plover.dictionary.base import load_dictionary
from plover.exception import DictionaryLoaderException
from plover.resource import resource_timestamp
from plover ... | 3,149 | Python | .py | 79 | 31.278481 | 89 | 0.645478 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,684 | json_dict.py | openstenoproject_plover/plover/dictionary/json_dict.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Parsing a json formatted dictionary.
"""
try:
import simplejson as json
except ImportError:
import json
from plover.dictionary.helpers import StenoNormalizer
from plover.steno_dictionary import StenoDictionary
from plover.steno import steno... | 1,359 | Python | .py | 34 | 31.5 | 85 | 0.614275 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,685 | rtfcre_parse.py | openstenoproject_plover/plover/dictionary/rtfcre_parse.py | from collections import deque
import sys
import re
from rtf_tokenize import RtfTokenizer
from plover import log
class RtfParseError(Exception):
def __init__(self, lnum, cnum, fmt, *fmt_args):
msg = 'line %u, column %u: %s' % (lnum + 1, cnum + 1, fmt % fmt_args)
super().__init__(msg)
class BadR... | 10,771 | Python | .py | 293 | 21.836177 | 127 | 0.416515 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,686 | __init__.py | openstenoproject_plover/plover/dictionary/__init__.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Various dictionary formats."""
| 100 | Python | .py | 3 | 32 | 33 | 0.75 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,687 | base.py | openstenoproject_plover/plover/dictionary/base.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
# TODO: maybe move this code into the StenoDictionary itself. The current saver
# structure is odd and awkward.
# TODO: write tests for this file
"""Common elements to all dictionary formats."""
from os.path import splitext
import functools
import thr... | 1,865 | Python | .py | 51 | 30.862745 | 80 | 0.683509 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,688 | helpers.py | openstenoproject_plover/plover/dictionary/helpers.py | from plover import _, log
from plover.misc import shorten_path
from plover.steno import normalize_steno
class StenoNormalizer:
def __init__(self, dictionary_path):
self._dictionary_path = dictionary_path
self._errors_count = 0
def normalize(self, steno):
try:
return norma... | 772 | Python | .py | 19 | 32.157895 | 81 | 0.633199 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,689 | rtfcre_dict.py | openstenoproject_plover/plover/dictionary/rtfcre_dict.py | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
#
# TODO: Convert non-ascii characters to UTF8
# TODO: What does ^ mean in Eclipse?
# TODO: What does #N mean in Eclipse?
# TODO: convert supported commands from Eclipse
"""Parsing an RTF/CRE dictionary.
RTF/CRE spec:
https://web.archive.org/web/2020101... | 5,899 | Python | .py | 128 | 36.664063 | 114 | 0.455036 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,690 | undo.py | openstenoproject_plover/plover/macro/undo.py | from plover.translation import Translation
from plover.oslayer.config import PLATFORM
if PLATFORM == 'mac':
BACK_STRING = '{#Alt_L(BackSpace)}{^}'
else:
BACK_STRING = '{#Control_L(BackSpace)}{^}'
def undo(translator, stroke, cmdline):
assert not cmdline
for t in reversed(translator.get_state().transl... | 647 | Python | .py | 16 | 35.5 | 70 | 0.69586 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,691 | repeat.py | openstenoproject_plover/plover/macro/repeat.py |
from plover.steno import Stroke
def last_stroke(translator, stroke, cmdline):
assert not cmdline
# Repeat last stroke
translations = translator.get_state().translations
if not translations:
return
stroke = Stroke(translations[-1].strokes[-1].steno_keys)
translator.translate_stroke(str... | 325 | Python | .py | 9 | 31.222222 | 60 | 0.744409 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,692 | retro.py | openstenoproject_plover/plover/macro/retro.py |
from plover.translation import Translation
from plover.steno import Stroke
from plover import system
def toggle_asterisk(translator, stroke, cmdline):
assert not cmdline
# Toggle asterisk of previous stroke
translations = translator.get_state().translations
if not translations:
return
t =... | 2,004 | Python | .py | 58 | 27.827586 | 66 | 0.658939 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,693 | set_config.py | openstenoproject_plover/plover/command/set_config.py | import ast
def set_config(engine, cmdline):
"""
Set one or more Plover config options upon executing a stroke pattern.
Syntax:
{PLOVER:SET_CONFIG:option:value}
{PLOVER:SET_CONFIG:option1:value1,option2:value2,...}
Example usage:
"O*EP": "{PLOVER:SET_CONFIG:'translation_frame_opacity':1... | 1,243 | Python | .py | 25 | 43.44 | 85 | 0.685384 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,694 | about_dialog.py | openstenoproject_plover/plover/gui_qt/about_dialog.py |
import re
from PyQt5.QtWidgets import QDialog
import plover
from plover.gui_qt.about_dialog_ui import Ui_AboutDialog
class AboutDialog(QDialog, Ui_AboutDialog):
ROLE = 'about'
def __init__(self, engine):
super().__init__()
self.setupUi(self)
credits = plover.__credits__
c... | 1,555 | Python | .py | 38 | 29.394737 | 86 | 0.473824 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,695 | suggestions_dialog.py | openstenoproject_plover/plover/gui_qt/suggestions_dialog.py |
import re
from PyQt5.QtCore import Qt
from PyQt5.QtGui import (
QCursor,
QFont,
)
from PyQt5.QtWidgets import (
QAction,
QFontDialog,
QMenu,
)
from plover import _
from plover.suggestions import Suggestion
from plover.formatting import RetroFormatter
from plover.gui_qt.suggestions_dialog_ui impo... | 5,294 | Python | .py | 142 | 28.239437 | 83 | 0.599765 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,696 | add_translation_dialog.py | openstenoproject_plover/plover/gui_qt/add_translation_dialog.py | from PyQt5.QtWidgets import QDialogButtonBox
from plover import _
from plover.gui_qt.add_translation_dialog_ui import Ui_AddTranslationDialog
from plover.gui_qt.tool import Tool
class AddTranslationDialog(Tool, Ui_AddTranslationDialog):
# i18n: Widget: “AddTranslationDialog”, tooltip.
__doc__ = _('Add a ne... | 1,639 | Python | .py | 37 | 36.513514 | 75 | 0.68242 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,697 | paper_tape.py | openstenoproject_plover/plover/gui_qt/paper_tape.py | import time
from PyQt5.QtCore import (
QAbstractListModel,
QMimeData,
QModelIndex,
Qt,
)
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import (
QFileDialog,
QFontDialog,
QMessageBox,
)
from wcwidth import wcwidth
from plover import _, system
from .paper_tape_ui import Ui_PaperTape
f... | 7,633 | Python | .py | 209 | 27.779904 | 91 | 0.607854 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,698 | log_qt.py | openstenoproject_plover/plover/gui_qt/log_qt.py |
import logging
from PyQt5.QtCore import QObject, pyqtSignal
from plover import log
class NotificationHandler(QObject, logging.Handler):
emitSignal = pyqtSignal(int, str)
def __init__(self):
super().__init__()
self.setLevel(log.WARNING)
self.setFormatter(log.NoExceptionTracebackFor... | 501 | Python | .py | 13 | 32.307692 | 90 | 0.702083 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,699 | add_translation_widget.py | openstenoproject_plover/plover/gui_qt/add_translation_widget.py | from collections import namedtuple
from html import escape as html_escape
from os.path import split as os_path_split
from PyQt5.QtCore import QEvent, pyqtSignal
from PyQt5.QtWidgets import QApplication, QWidget
from plover import _
from plover.misc import shorten_path
from plover.steno import normalize_steno, sort_st... | 12,331 | Python | .py | 273 | 32.684982 | 97 | 0.584237 | openstenoproject/plover | 2,318 | 281 | 179 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |