text stringlengths 185 73.3k | repo stringlengths 7 100 | path stringlengths 4 146 | language stringclasses 7
values | hash stringlengths 16 16 | score float64 7 8.5 | stars int64 0 237k |
|---|---|---|---|---|---|---|
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
"""Unit tests for the log_redactor module."""
import logging
import unittest
from src.log_redactor import RedactingFilter, RedactingFormatter, _redact, setup_log_redaction
_REDACTED = "***REDACTED***"
def _make_record(msg, *args, exc_info=N... | canonical/livepatch-k8s-operator | tests/unit/test_log_redactor.py | .py | 46795c33df9109c9 | 7.8 | 3 |
import os
import shutil
from tkinter import Tk, Label, Frame, Button, StringVar, messagebox, Entry
from tkinter import ttk
from PIL import Image, ImageTk
class BatchImageLabeler:
def __init__(self, root, image_folder, initial_labels):
self.root = root
self.image_folder = image_folder
self.l... | CallterC/Utilities | labeler.py | .py | d4738ba653c28c94 | 7 | 0 |
import os
from PIL import Image, ImageFont, ImageDraw
from pathlib import Path
import pandas as pd
class CertificateGenerator:
def __init__(self, template_path, font_path, font_size= 180, font_color="#86529f", output_dir="certificates"):
# Initialize the certificate generator with configuration
... | Nandan-mnaik/Certificate-generator | generate.py | .py | 2ee48cab8ee346a4 | 7 | 0 |
# scripts/export_aggregated_to_csv.py
import os
import subprocess
import pandas as pd
from pathlib import Path
from io import StringIO
# --- Konfigurace ---
ORG = os.getenv("INFLUX_ORG", "ci-org")
TOKEN = os.getenv("INFLUX_TOKEN", "ci-secret-token")
HOST = os.getenv("INFLUX_URL", "http://localhost:8086") # použije... | Spolecenstvi-vlastniku-Smichov-Two/dwh-sm2 | scripts/export_aggregated_to_csv.py | .py | 3afb4d8b800191b2 | 7 | 0 |
# scripts/export_raw_by_month.py
import subprocess
import pandas as pd
from datetime import timedelta
import io
import os
from pathlib import Path
ORG = os.environ["INFLUX_ORG"]
TOKEN = os.environ["INFLUX_TOKEN"]
HOST = os.environ["INFLUX_URL"]
BUCKET = "sensor_data"
EXPORT_DIR = Path("gdrive/Influx")
EXPORT_DIR.mk... | Spolecenstvi-vlastniku-Smichov-Two/dwh-sm2 | scripts/export_raw_by_month.py | .py | c10e27f60807f249 | 7 | 0 |
import json
import os
import requests
from core.common import get_script_directory
class YoudaoNoteApi(object):
"""
有道云笔记 API 封装
原理:https://depp.wang/2020/06/11/how-to-find-the-api-of-a-website-eg-note-youdao-com/
"""
ROOT_ID_URL = "https://note.youdao.com/yws/api/personal/file?method=getByPath... | find-xposed-magisk/youdaonote-pull | core/api.py | .py | 4676edc84cdbe7dc | 7.39 | 5 |
import json
import logging
import os
import xml.etree.ElementTree as ET
from typing import Tuple
MARKDOWN_SUFFIX = ".md"
class XmlElementConvert(object):
"""
XML Element 转换规则
"""
@staticmethod
def convert_para_func(**kwargs):
"""正常文本(粗体、斜体、删除线、链接)"""
return kwargs.get("text")
... | find-xposed-magisk/youdaonote-pull | core/covert.py | .py | 09d230be9d92d2f7 | 7.39 | 5 |
import logging
import os
import re
from typing import Tuple
from urllib import parse
from urllib.parse import urlparse
import requests
REGEX_IMAGE_URL = re.compile(r"!\[.*?\]\((.*?note\.youdao\.com.*?)\)")
REGEX_ATTACH = re.compile(r"\[(.*?)\]\(((http|https)://note\.youdao\.com.*?)\)")
# 有道云笔记的图片地址
IMAGES = "images"
... | find-xposed-magisk/youdaonote-pull | core/image.py | .py | 2ac00457f74650fa | 7.39 | 5 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import logging
import os
import platform
import re
import sys
import time
import traceback
import xml.etree.ElementTree as ET
from enum import Enum
from typing import Tuple
import requests
from win32_setctime import setctime
from core import log
from core.ap... | find-xposed-magisk/youdaonote-pull | pull.py | .py | 00a6ebafbe82863c | 7.39 | 5 |
"""
Persistent caching engine to safeguard API calls against rate limits and network errors.
"""
from __future__ import annotations
import json
import logging
import time
from pathlib import Path
from typing import Any, Optional
from scripts.core.utils import get_project_root
logger = logging.getLogger("readme_engi... | rogerio-jose-gastao/rogerio-jose-gastao | scripts/core/cache.py | .py | 571d9f85f2fd849a | 7.24 | 2 |
"""
GitHub API wrapper isolated inside core/github.py handling REST & GraphQL queries.
"""
from __future__ import annotations
import json
import logging
import os
import urllib.error
import urllib.request
from dataclasses import dataclass
from typing import Any, Dict, List, Optional
from scripts.core.cache import Ca... | rogerio-jose-gastao/rogerio-jose-gastao | scripts/core/github.py | .py | 4ad10e70ac2e760d | 7.24 | 2 |
"""
Declarative Markdown formatting utilities for building clean Markdown elements.
"""
from __future__ import annotations
from typing import List, Dict, Any
def render_progress_bar(current: int, total: int, width: int = 14) -> str:
"""
Generate clean unicode progress bar.
Example: ██████████░░░░
""... | rogerio-jose-gastao/rogerio-jose-gastao | scripts/core/markdown.py | .py | f89289af343e0356 | 7.24 | 2 |
"""
Markdown rendering isolated inside core/renderer.py.
Scans README.md and updates contents between section markers.
"""
from __future__ import annotations
import logging
import re
from pathlib import Path
from typing import Dict
from scripts.core.utils import get_project_root
logger = logging.getLogger("readme_e... | rogerio-jose-gastao/rogerio-jose-gastao | scripts/core/renderer.py | .py | ef855d5ba6fc9099 | 7.24 | 2 |
"""
Utility functions for configuration loading, logging, and environment helpers.
"""
from __future__ import annotations
import datetime
import logging
import os
from pathlib import Path
import tomllib
from typing import Any, Dict
# Configure logger
logger = logging.getLogger("readme_engine")
def setup_logging(ve... | rogerio-jose-gastao/rogerio-jose-gastao | scripts/core/utils.py | .py | 6056b7d8af02b946 | 7.24 | 2 |
import gettext
_ = gettext.gettext
__all__ = [
'get_exit_inputs',
'get_no_inputs',
'get_yes_inputs'
]
def get_exit_inputs() -> frozenset[str]:
"""Get a cached `frozenset` of inputs for exiting the program."""
_ = gettext.gettext
return frozenset({_('quit'), _('q'), _('exit'), _('e')})
def ... | adamggrim/textwarp | src/textwarp/_cli/constants/inputs.py | .py | bc639aaa093cd73a | 7.15 | 1 |
"""Functions for formatting analysis into readable strings."""
from collections.abc import Sequence
import gettext
from wcwidth import wcswidth
from textwarp._core.models import POSCounts, WordCount
_ = gettext.gettext
ngettext = gettext.ngettext
__all__ = [
'format_count',
'format_entity_counts',
'for... | adamggrim/textwarp | src/textwarp/_cli/formatting.py | .py | 2bebdad4f064ae05 | 7.15 | 1 |
"""Command-line argument parsing using argparse."""
import argparse
import gettext
import sys
from dataclasses import dataclass
from importlib.metadata import PackageNotFoundError, version
from textwarp._cli.args import ARGS_MAP
from textwarp._cli.constants.messages import HELP_DESCRIPTION
from textwarp._cli.pipeline... | adamggrim/textwarp | src/textwarp/_cli/parsing.py | .py | a249f0b8a84ef1f3 | 7.15 | 1 |
"""Pipeline output routing."""
from __future__ import annotations
import gettext
import sys
from collections.abc import Callable
from typing import Final, TYPE_CHECKING
if TYPE_CHECKING:
import argparse
from spacy.tokens import Doc
from textwarp._cli.args import (
ANALYSIS_COMMANDS,
ARGS_MAP,
SP... | adamggrim/textwarp | src/textwarp/_cli/pipeline.py | .py | df1880b8d4032549 | 7.15 | 1 |
"""Execution modes for pipeline processing."""
import gettext
import sys
from collections.abc import Callable
from textwarp._cli.constants.messages import (
BINARY_FILE_ERROR_MSG,
FILE_ACCESS_ERROR_MSG,
PIPED_INPUT_ERROR_MSG
)
from textwarp._cli.parsing import ParsedArgs
from textwarp._cli.pipeline import... | adamggrim/textwarp | src/textwarp/_cli/processing.py | .py | 5570481d21378067 | 7.15 | 1 |
"""Main loop logic for executing commands."""
import gettext
import logging
import sys
from collections.abc import Callable
from typing import TypeAlias
from types import ModuleType
from textwarp._cli.constants.messages import (
CLIPBOARD_ACCESS_ERROR_MSG,
CLIPBOARD_CLEARED_MSG,
LINUX_XCLIP_WARNING_MSG,
... | adamggrim/textwarp | src/textwarp/_cli/runners.py | .py | d94057fdcfa7bbfc | 7.15 | 1 |
"""Command-line spinner for loading heavy dependencies."""
import math
import multiprocessing
import random
import sys
import time
from collections.abc import Callable
from typing import Any
__all__ = ['AcceleratingSpinner', 'run_with_spinner']
_SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
_NU... | adamggrim/textwarp | src/textwarp/_cli/spinner.py | .py | efb464ab372776f0 | 7.15 | 1 |
"""Functions for handling console input and output."""
import gettext
import shutil
import sys
import textwrap
import time
from typing import NoReturn
from wcwidth import wcswidth
from textwarp._cli.constants.inputs import (
get_exit_inputs,
get_no_inputs,
get_yes_inputs
)
from textwarp._cli.constants.me... | adamggrim/textwarp | src/textwarp/_cli/ui.py | .py | c2a690ce079ae8ab | 7.15 | 1 |
"""Validators for text, clipboard and regular expression content."""
import argparse
import gettext
import regex as re
from textwarp._cli.args import (
ANALYSIS_COMMANDS,
MUTUALLY_EXCLUSIVE_COMMANDS,
REPLACEMENT_COMMANDS
)
from textwarp._cli.constants.messages import (
ANALYSIS_ORDER_ERROR_MSG,
CA... | adamggrim/textwarp | src/textwarp/_cli/validation.py | .py | 1f30d865f5fb2415 | 7.15 | 1 |
"""Runners for find-and-replace commands."""
import gettext
from collections.abc import Callable
import regex as re
from textwarp._cli.spinner import run_with_spinner
from textwarp._cli.constants.messages import (
ENTER_CASE_TO_REPLACE_PROMPT,
ENTER_REGEX_PROMPT,
ENTER_REPLACEMENT_CASE_PROMPT,
ENTER_... | adamggrim/textwarp | src/textwarp/_commands/replacement.py | .py | b247b3017211ccf8 | 7.15 | 1 |
"""Universal regular expressions for text warping."""
from collections.abc import Iterable
from functools import cache
import regex as re
from textwarp._core.enums import RegexBoundary
__all__ = [
'create_words_regex',
'get_dash',
'get_em_dash_stand_in',
'get_multiple_spaces',
'get_period_separa... | adamggrim/textwarp | src/textwarp/_core/constants/patterns/warping.py | .py | 212169d23a55f499 | 7.15 | 1 |
"""Thread-safe global context for the active locale and provider."""
import contextvars
import gettext
import logging
import os
import importlib
from pathlib import Path
from typing import TYPE_CHECKING, Final
if TYPE_CHECKING:
from textwarp._core.providers.base import LanguageProvider
__all__ = ['ctx', 'N_']
_... | adamggrim/textwarp | src/textwarp/_core/context.py | .py | 5e905c7726bb08c9 | 7.15 | 1 |
"""Functions for loading universal encoding data."""
from collections.abc import Mapping
from functools import cache
from types import MappingProxyType
from textwarp._core.utils import load_json_data
__all__ = ['get_morse_map', 'get_morse_reversed_map']
@cache
def get_morse_map() -> Mapping[str, str]:
"""Get a... | adamggrim/textwarp | src/textwarp/_core/encoding.py | .py | f9bbd5774b732292 | 7.15 | 1 |
"""
Enumerations for casing, count labels, presence checking and regular
expression boundaries.
"""
from enum import Enum, auto, unique
from textwarp._core.context import N_
__all__ = [
'CaseSeparator',
'Casing',
'CountLabels',
'ModelPriority',
'POSTag',
'PresenceCheckType',
'RegexBoundar... | adamggrim/textwarp | src/textwarp/_core/enums.py | .py | 6dc134615d448aae | 7.15 | 1 |
"""Custom exceptions for clipboard and validation errors."""
__all__ = [
'CaseNotFoundError',
'EmptyClipboardError',
'InvalidCaseNameError',
'InvalidRegexError',
'MissingDependencyError',
'MissingModelError',
'NoCaseNameError',
'NoRegexError',
'NoTextError',
'RegexNotFoundError'... | adamggrim/textwarp | src/textwarp/_core/exceptions.py | .py | 57d9f0ec5449b5b2 | 7.15 | 1 |
"""Classes for parts-of-speech counts and word counts."""
import gettext
from dataclasses import dataclass, field
from typing import final
from textwarp._core.constants.nlp import POS_TAGS
from textwarp._core.enums import POSTag
_ = gettext.gettext
__all__ = ['POSCounts', 'WordCount']
@final
@dataclass(frozen=Tru... | adamggrim/textwarp | src/textwarp/_core/models.py | .py | 936f0ac847859241 | 7.15 | 1 |
"""Functions for loading English entity casing rules."""
from collections.abc import Mapping
from functools import cache
from pathlib import Path
from types import MappingProxyType
from typing import Final
from textwarp._core.utils import load_json_data
from textwarp._core.types import EntityCasingContext
DIR: Final... | adamggrim/textwarp | src/textwarp/_core/providers/en/data/entity_casing.py | .py | 912cf55d21d852dc | 7.15 | 1 |
"""Core logic for expanding English contractions."""
from __future__ import annotations
from collections.abc import Mapping
from typing import TYPE_CHECKING
import regex as re
if TYPE_CHECKING:
from spacy.tokens import Doc, Span
from textwarp._core.providers import en
from textwarp._lib.contractions import app... | adamggrim/textwarp | src/textwarp/_core/providers/en/expansion/core.py | .py | e4c8083b42df7ead | 7.15 | 1 |
"""
English-specific functions for converting between cardinal and ordinal
numbers.
"""
from typing import TYPE_CHECKING
from textwarp._core.providers.en.constants import (
ORDINAL_SUFFIX_MAP,
ORDINAL_SUFFIXES
)
from textwarp._lib.nlp import process_as_doc
if TYPE_CHECKING:
from spacy.tokens import Doc
... | adamggrim/textwarp | src/textwarp/_core/providers/en/numbers.py | .py | b17d48344f31e6cf | 7.15 | 1 |
"""Alembic environment configuration."""
from logging.config import fileConfig
import sys
from pathlib import Path
from alembic import context
from alembic.ddl.impl import DefaultImpl
from sqlalchemy import Column
from sqlalchemy import MetaData
from sqlalchemy import PrimaryKeyConstraint
from sqlalchemy import String... | soit-ai/soit | server/alembic/env.py | .py | 1efb17ef43fbfcbb | 7.15 | 1 |
"""Add execution leases to knowledge ingest tasks.
Revision ID: 20260728120000
Revises: 20260726190000
Create Date: 2026-07-28 12:00:00
"""
from __future__ import annotations
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "20260728120000"
down_revision: Union[str,... | soit-ai/soit | server/alembic/versions/20260728120000_knowledge_ingest_task_lease.py | .py | c1e4adfe29e8e71d | 7.15 | 1 |
"""Add execution leases and input snapshots to workflow runs.
Revision ID: 20260728220000
Revises: 20260728200000
Create Date: 2026-07-28 22:00:00
"""
from __future__ import annotations
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "20260728220000"
down_revision:... | soit-ai/soit | server/alembic/versions/20260728220000_workflow_run_lease.py | .py | f1e75255ead5724e | 7.15 | 1 |
"""Add scopes and expiry to API keys.
Revision ID: 20260728230000
Revises: 20260728220000
Create Date: 2026-07-28 23:00:00
"""
from __future__ import annotations
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "20260728230000"
down_revision: Union[str, Sequence[str... | soit-ai/soit | server/alembic/versions/20260728230000_api_key_scopes_and_expiry.py | .py | 1129fba796546d8a | 7.15 | 1 |
"""Mark rehearsal runs so their cost and evidence stay separable.
Revision ID: 20260728240000
Revises: 20260728230000
Create Date: 2026-07-28 24:00:00
"""
from __future__ import annotations
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "20260728240000"
down_revis... | soit-ai/soit | server/alembic/versions/20260728240000_run_sandbox_flag.py | .py | 4c396b42a1c91a1a | 7.15 | 1 |
"""Give regression cases a versioned dataset and reports a baseline.
Revision ID: 20260731100000
Revises: 20260728240000
Create Date: 2026-07-31 10:00:00
"""
from __future__ import annotations
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "20260731100000"
down_re... | soit-ai/soit | server/alembic/versions/20260731100000_regression_datasets_and_baselines.py | .py | 89cbbc783741adc5 | 7.15 | 1 |
"""Repair schema objects that pre-baseline databases never received.
The 20260718140000 fresh-install baseline squashed history and is the only
revision that creates the product_feedbacks table and the
agent_publishes.sequence column. Databases created before the squash and
stamped onto the baseline chain therefore mi... | soit-ai/soit | server/alembic/versions/20260806160000_repair_pre_baseline_schema.py | .py | 471a788adfca4aa3 | 7.15 | 1 |
"""HTTPX client construction with mandatory per-request egress authorization."""
from __future__ import annotations
from collections.abc import Awaitable, Callable
from typing import Any
import httpx
from app.kernel.contracts.context import RequestContext
from app.kernel.security.egress import GovernedEgressGuard
... | soit-ai/soit | server/app/adapters/http/governed_client.py | .py | 8023634b4f99e502 | 7.15 | 1 |
"""deepseek_llm
DeepSeek LLM port adapter implementation.
"""
from app.adapters.llm.openai import OpenAILLMPort
from app.settings.settings import settings
class DeepSeekLLMPort(OpenAILLMPort):
"""DeepSeek LLM port adapter via OpenAI-compatible API."""
def __init__(
self,
api_key: str | Non... | soit-ai/soit | server/app/adapters/llm/deepseek.py | .py | 18f80e3932653381 | 7.15 | 1 |
""" memory
In-memory LLM adapter for tests and local runs.
"""
from __future__ import annotations
from collections.abc import AsyncIterator
from typing import Any
from app.kernel.ports.llm.interface import (
ChatMessage,
ChatResponse,
ChatStreamChunk,
EmbeddingResponse,
GeneratedImage,
Image... | soit-ai/soit | server/app/adapters/llm/memory.py | .py | 86f878d25a0d4031 | 7.15 | 1 |
"""Content safety adapter backed by an external HTTP service.
SOIT does not classify content itself. This adapter forwards text to a service
the deployment operates and maps its answer onto the kernel verdict. The call
goes through the governed egress client like every other outbound path, so the
safety service cannot... | soit-ai/soit | server/app/adapters/safety/http_content_safety.py | .py | b2f21afcef83904f | 7.15 | 1 |
"""memory
In-memory secrets adapter for tests.
"""
from __future__ import annotations
from typing import Any
from app.kernel.ports.secrets.interface import SecretLocator, SecretValueStore
class InMemorySecretValueStore(SecretValueStore):
"""In-memory secrets storage."""
def __init__(self) -> None:
... | soit-ai/soit | server/app/adapters/secrets/memory.py | .py | 3195a17cd228b072 | 7.15 | 1 |
""" memory_storage
In-memory storage port for tests and lightweight workflows.
"""
from typing import Any
from app.kernel.ports.storage.interface import StoragePort
class InMemoryStoragePort(StoragePort):
"""In-memory object storage implementation."""
def __init__(self, bucket: str | None = "in-memory"):
... | soit-ai/soit | server/app/adapters/storage/memory.py | .py | 5ae35fcf7f0bbb05 | 7.15 | 1 |
""" function_tools
Local function tool adapter implementation.
"""
import importlib
import inspect
from typing import Any
from app.kernel.ports.tools.interface import ToolPort, ToolResponse
class FunctionToolsPort(ToolPort):
"""Execute local python functions as tools."""
async def invoke(
self,
... | soit-ai/soit | server/app/adapters/tools/function.py | .py | 3b76fbf91fea58d3 | 7.15 | 1 |
""" http_tools
HTTP tools port adapter implementation.
"""
from typing import Any
import httpx
from app.adapters.http.governed_client import governed_httpx_client
from app.kernel.contracts.context import RequestContext
from app.kernel.ports.tools.interface import ToolPort, ToolResponse
from app.kernel.security.egre... | soit-ai/soit | server/app/adapters/tools/http.py | .py | 75debfe07e871960 | 7.15 | 1 |
"""OAuth 2.1 authorization for protected MCP servers.
Implements the discovery and token-request half of the MCP authorization
specification: Protected Resource Metadata (RFC 9728) to find the authorization
server, authorization server metadata (RFC 8414 / OpenID Connect Discovery) to
find its token endpoint, and Reso... | soit-ai/soit | server/app/adapters/tools/mcp_oauth.py | .py | 58a605054a12fe18 | 7.15 | 1 |
class Emulator:
"""Abstract emulator process lifecycle - open/close/status. Mirrors
core/device/screencap/screencap.py's ScreenCap abstraction: a base
class with concrete per-emulator implementations selected by Device."""
def isRunning(self) -> bool:
raise NotImplementedError()
def launc... | NightSparrows/NSGameScriptor | core/device/emulator/emulator.py | .py | af9302c853b99ae9 | 7.24 | 2 |
import json
import subprocess
import time
from core.logger import Logger
from .emulator import Emulator
class MumuEmulator(Emulator):
"""Wraps the MumuManager CLI shipped with MuMu Player's multi-instance
("多開") manager. Canonical home for the MuMu install path and the
"which vmindex does this adb port... | NightSparrows/NSGameScriptor | core/device/emulator/mumuEmulator.py | .py | 8d0d197ef8d018ff | 7.24 | 2 |
import numpy as np
import cv2
import requests
import time
import os
import socket
from core.base import Base
from .screencap import ScreenCap
from ...logger import Logger
EXCLUDED_RANGES = [
(50000, 50059),
(53477, 53576),
(54578, 54677),
(54678, 54777),
(54778, 54877),
(54878, 54977),
... | NightSparrows/NSGameScriptor | core/device/screencap/droidCast.py | .py | ebf12d1278a6ee58 | 7.24 | 2 |
from PySide6.QtCore import QObject, Signal
from core.logger import Logger
class LogBridge(QObject):
"""
Bridges core.logger.Logger to a Qt signal so GUI widgets can subscribe to
log output without touching the existing print()-based CLI behavior.
Logger callbacks may fire from a worker thread; Qt a... | NightSparrows/NSGameScriptor | gui/common/logbridge.py | .py | 5cd420f7d0e10af6 | 7.24 | 2 |
from PySide6.QtCore import QObject, QRunnable, QThreadPool, Signal
class WorkerSignals(QObject):
started = Signal()
result = Signal(object)
error = Signal(str)
finished = Signal()
class Worker(QRunnable):
"""Wraps a blocking callable so it can run on a background thread."""
def __init__(se... | NightSparrows/NSGameScriptor | gui/common/worker.py | .py | e1bdfb7ea30a88ad | 7.24 | 2 |
import typing as t
from viur.core import Module, current, translate
from viur.core.prototypes import List, Tree
from viur.core.prototypes.tree import SkelType
from viur.core.render.abstract import AbstractRenderer
from viur.core.skeleton import SkeletonInstance
from ..globals import SHOP_LOGGER
if t.TYPE_CHECKING:
... | viur-framework/viur-shop | src/viur/shop/modules/abstract.py | .py | 81f5514b3aab5213 | 7.3 | 3 |
import collections
import itertools
import typing as t
from viur.core import db, errors
from viur.core.prototypes import List
from viur.core.skeleton import RefSkel
from viur.shop.skeletons import ArticleAbstractSkel, CartNodeSkel, ShippingSkel
from viur.shop.types import SkeletonInstance_T
from .abstract import ShopM... | viur-framework/viur-shop | src/viur/shop/modules/shipping.py | .py | fc77c27696848515 | 7.3 | 3 |
import functools
from viur.core.prototypes import List
from .abstract import ShopModuleAbstract
from ..globals import MAX_FETCH_LIMIT, SHOP_LOGGER
from ..services import HOOK_SERVICE, Hook
from ..types import VatRateCategory
from ..types.exceptions import ConfigurationError
logger = SHOP_LOGGER.getChild(__name__)
c... | viur-framework/viur-shop | src/viur/shop/modules/vat_rate.py | .py | 5cc81b475d7e904c | 7.3 | 3 |
import typing as t # noqa
from viur.core import errors, exposed
from viur.core.skeleton import SkeletonInstance
from viur.shop.types import *
from . import PaymentProviderAbstract
from ..globals import SHOP_LOGGER
from ..skeletons import OrderSkel
logger = SHOP_LOGGER.getChild(__name__)
class AmazonPay(PaymentProv... | viur-framework/viur-shop | src/viur/shop/payment_providers/amazon_pay.py | .py | eeeddf201c0fd58e | 7.3 | 3 |
import typing as t
from viur.core import errors, exposed
from viur.core.skeleton import SkeletonInstance
from . import PaymentProviderAbstract
from ..globals import SHOP_LOGGER
from ..skeletons import OrderSkel
from ..types import IllegalOperationError, SkeletonInstance_T
logger = SHOP_LOGGER.getChild(__name__)
cl... | viur-framework/viur-shop | src/viur/shop/payment_providers/invoice.py | .py | f4b07b424d5cf25e | 7.3 | 3 |
import typing as t
from deprecated.sphinx import deprecated
from viur.core import errors, exposed
from viur.core.skeleton import SkeletonInstance
from . import PaymentProviderAbstract
from ..globals import SHOP_LOGGER
from ..skeletons import OrderSkel
from ..types import SkeletonInstance_T
from ..types.exceptions imp... | viur-framework/viur-shop | src/viur/shop/payment_providers/prepayment.py | .py | dd941327b4bfc66a | 7.3 | 3 |
import typing as t
import unzer
from unzer.model import PaymentType
from viur.core.skeleton import SkeletonInstance
from .unzer_abstract import UnzerAbstract
from ..globals import SHOP_LOGGER
logger = SHOP_LOGGER.getChild(__name__)
class UnzerApplepay(UnzerAbstract):
"""
Unzer Apple Pay payment method inte... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_applepay.py | .py | fa91e32e5a6bbf34 | 7.3 | 3 |
import typing as t
import unzer
from unzer.model import PaymentType
from viur.core.skeleton import SkeletonInstance
from .unzer_abstract import UnzerAbstract
from ..globals import SHOP_LOGGER
logger = SHOP_LOGGER.getChild(__name__)
class UnzerBancontact(UnzerAbstract):
"""
Unzer Bancontact payment method i... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_bancontact.py | .py | 8bdc5d7644d7d87e | 7.3 | 3 |
import typing as t
import unzer
from unzer.model import PaymentType
from viur.core.skeleton import SkeletonInstance
from .unzer_abstract import UnzerAbstract
from ..globals import SHOP_LOGGER
logger = SHOP_LOGGER.getChild(__name__)
class UnzerCard(UnzerAbstract):
"""
Unzer credit card payment method integr... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_card.py | .py | 91324aa446b841f4 | 7.3 | 3 |
import typing as t
import unzer
from unzer.model import PaymentType
from viur.core.skeleton import SkeletonInstance
from .unzer_abstract import UnzerAbstract
from ..globals import SHOP_LOGGER
logger = SHOP_LOGGER.getChild(__name__)
class UnzerGooglepay(UnzerAbstract):
"""
Unzer Google Pay payment method in... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_googlepay.py | .py | c3bf5e58e3feff00 | 7.3 | 3 |
import typing as t
import unzer
from unzer.model import PaymentType
from viur.core.skeleton import SkeletonInstance
from .unzer_abstract import UnzerAbstract
from ..globals import SHOP_LOGGER
logger = SHOP_LOGGER.getChild(__name__)
class UnzerIdeal(UnzerAbstract):
"""
Unzer iDEAL payment method integration... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_ideal.py | .py | c0fde147e878f928 | 7.3 | 3 |
import typing as t
import unzer
from unzer.model import PaymentType
from viur.core import db, errors, exposed
from viur.core.skeleton import SkeletonInstance
from viur import toolkit
from .unzer_abstract import UnzerAbstract, log_unzer_error
from ..globals import SHOP_LOGGER
from ..services import HOOK_SERVICE, Hook
... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_openbanking_pis.py | .py | 4d73d064113fe0b2 | 7.3 | 3 |
import typing as t # noqa
import unzer
from unzer import PaymentResponse
from viur import toolkit
from viur.core import current, errors
from viur.core.skeleton import SkeletonInstance
from viur.shop.skeletons import OrderSkel
from viur.shop.types import *
from .unzer_abstract import UnzerAbstract, log_unzer_error
fr... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_paylater_installment.py | .py | 63e91bd9d6f03c9d | 7.3 | 3 |
import typing as t # noqa
import unzer
from unzer import PaymentResponse
from viur import toolkit
from viur.core import current, db, errors, exposed
from viur.core.skeleton import SkeletonInstance
from viur.shop.skeletons import OrderSkel
from viur.shop.types import *
from .unzer_abstract import UnzerAbstract, log_u... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_paylater_invoice.py | .py | 3e426d94424951f6 | 7.3 | 3 |
import typing as t
import unzer
from unzer.model import PaymentType
from viur.core.skeleton import SkeletonInstance
from .unzer_abstract import UnzerAbstract
from ..globals import SHOP_LOGGER
logger = SHOP_LOGGER.getChild(__name__)
class UnzerPayPal(UnzerAbstract):
"""
Unzer PayPal payment method integrati... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_paypal.py | .py | 78048f8cbc3fac65 | 7.3 | 3 |
import typing as t
import unzer
from unzer.model import PaymentType
from viur.core.skeleton import SkeletonInstance
from .unzer_abstract import UnzerAbstract
from ..globals import SHOP_LOGGER
logger = SHOP_LOGGER.getChild(__name__)
class UnzerSofort(UnzerAbstract):
"""
Unzer Sofort payment method integrati... | viur-framework/viur-shop | src/viur/shop/payment_providers/unzer_sofort.py | .py | 8887947d25b7f9c8 | 7.3 | 3 |
"""
Event Handling Module
=====================
This module provides a flexible and extensible event-handling system that
allows methods to be attached to specific events.
These methods are triggered when the corresponding events occur,
enabling custom behavior and seamless integration of additional functionality
into... | viur-framework/viur-shop | src/viur/shop/services/events.py | .py | 19a141d028d6697a | 7.3 | 3 |
"""Customization / hook service
Register own implementations (:class:`Customization`) to influence
a specific behavior (:class:`Hook`) of the viur-shop.
Unlike events, which are just a trigger, hooks can (and usually should)
modify objects and return something.
"""
import abc
import enum
import typing as t
from viu... | viur-framework/viur-shop | src/viur/shop/services/hooks.py | .py | cc936ea226ed5c2f | 7.3 | 3 |
import copy
import typing as t
from viur.core import conf, logging
from viur.core.bones import RelationalBone
from viur.core.module import Module
from viur.core.modules.translation import Creator, TranslationSkel
from viur.core.modules.user import UserSkel
from viur.core.prototypes.instanced_module import InstancedMod... | viur-framework/viur-shop | src/viur/shop/shop.py | .py | 9a77a8a24f9c8870 | 7.3 | 3 |
import typing as t
from viur.core.bones import RelationalBone, RelationalUpdateLevel
from viur.core.skeleton import SkeletonInstance
from ..globals import SHOP_LOGGER
logger = SHOP_LOGGER.getChild(__name__)
class SnapshotRelationalBone(RelationalBone):
"""A :class:`RelationalBone` that keeps its cached ``refKe... | viur-framework/viur-shop | src/viur/shop/skeletons/_bones.py | .py | f5f8e54fc60285c9 | 7.3 | 3 |
import typing as t # noqa
from viur.core import translate
from viur.core.bones import *
from viur.core.skeleton import Skeleton, SkeletonInstance
from viur.shop.types import *
from ._bones import SnapshotRelationalBone
from ..globals import SHOP_INSTANCE, SHOP_LOGGER
logger = SHOP_LOGGER.getChild(__name__)
def get... | viur-framework/viur-shop | src/viur/shop/skeletons/order.py | .py | 95b57e9acfe2935d | 7.3 | 3 |
"""Enrich a parsed reading with supplementary, clearly-labeled content.
The readings themselves are the authentic liturgical text and are NEVER
rewritten. Enrichment only *adds* optional fields — a one-line message, a short
reflection, a kids' version, discussion questions and an image prompt — produced
by a pluggable... | carlosrenatohr/dreading-scrape | services/enrich.py | .py | 5ac5a116e918baeb | 7 | 0 |
"""Write readings to the dreading-api-worker (Cloudflare Worker + D1) via its
token-guarded POST /api/ingest endpoint.
`IngestClient` is a drop-in for the `db_client` that lectura.send_data_to_db
expects: `get_doc` is a no-op (the Worker upserts by date_raw, so no dedup
pre-check is needed) and `post_doc` POSTs the re... | carlosrenatohr/dreading-scrape | services/ingest.py | .py | f3e89cfe96da01fe | 7 | 0 |
"""Discover ciudadredonda.org reading-event URLs and their dates.
The 2026 site exposes dated reading pages at
`/events/lecturas-<liturgical-slug>_YYYY-MM-DD/`. The liturgical slug is not
derivable from a date, so event URLs must be *discovered* from the page links
rather than constructed:
- `/evangelio-de-manana/`... | carlosrenatohr/dreading-scrape | services/source.py | .py | f6fb132353b4c605 | 7 | 0 |
#!/usr/bin/env python3
""" Pulling into a run an event the search missed.
The one thing a reviewer can add to a revision, and it is not a
free hand: what may be pulled in is a row the collection already
stored, under the one reason that means nobody looked for the
event. The other three reasons descri... | rcrderby/star-pass | app/star_pass/_adding.py | .py | 672f35a93e8dd620 | 7 | 0 |
#!/usr/bin/env python3
""" What a run stores about an event, and about the opportunity it names.
Below both callers. A collection builds these for every event a
calendar window held, and pulling an event in by hand builds one
for the event nobody searched for -- and the two have to produce
the same th... | rcrderby/star-pass | app/star_pass/_building.py | .py | a93920c15953de2a | 7 | 0 |
#!/usr/bin/env python3
""" What a calendar description becomes before it is stored.
A description is written by whoever made the calendar entry, in
whatever the calendar's editor produced, so it arrives as plain
text about as often as it arrives as a fragment of HTML holding a
one-cell table. Both say... | rcrderby/star-pass | app/star_pass/_calendar_note.py | .py | 196855d0ed47ea33 | 7 | 0 |
#!/usr/bin/env python3
""" Asking Amplify whether the credential this process holds still works.
The one thing the tool publishes about its own credential, and
deliberately the only one: no endpoint replaces it, because an
endpoint that could rewrite the service's own production
credential is the highe... | rcrderby/star-pass | app/star_pass/_credentials.py | .py | 5b904f0129cc739f | 7 | 0 |
#!/usr/bin/env python3
""" What a stored event does not say, worked out from what it does.
The 'Event' record holds facts and nothing else, and its own
docstring names the four things it deliberately leaves out: how
long the shift is, whether an opportunity's maximum shortened it,
whether another event... | rcrderby/star-pass | app/star_pass/_derived.py | .py | 5591e943210ceab7 | 7 | 0 |
#!/usr/bin/env python3
""" star_pass exception types.
The core raises these instead of exiting, so that the process that
exits is the one that owns a process: the CLI turns them into a
status code, and the API service will turn them into a response.
The three subclasses are the distinctions a caller a... | rcrderby/star-pass | app/star_pass/_exceptions.py | .py | b9446cef0b619206 | 7 | 0 |
#!/usr/bin/env python3
""" Google Calendar search window.
Reads and validates the bounds of a calendar search. A run carries
its own window, so the bounds arrive as arguments rather than from
the environment: a window that moves with every run has no default
that would not go stale and silently collec... | rcrderby/star-pass | app/star_pass/_gcal_time.py | .py | 531c6758c53e7dbb | 7 | 0 |
#!/usr/bin/env python3
""" Logging configuration for the star_pass package.
Provides a single, idempotently-configured package logger so that
diagnostic and status output flows through the standard 'logging'
framework instead of bare 'print' calls. The log level is read from
the 'LOG_LEVEL' environmen... | rcrderby/star-pass | app/star_pass/_logging.py | .py | fb76300845335fb7 | 7 | 0 |
#!/usr/bin/env python3
""" Read the YAML data models.
Separate from '_defaults' so that reading a model can log: '_logging'
reads its level from '_defaults', so a reader living there could not
import a logger without a cycle. '_defaults' keeps the paths; this
module reads what is at them.
The mod... | rcrderby/star-pass | app/star_pass/_models.py | .py | 162006141b3e8405 | 7 | 0 |
#!/usr/bin/env python3
""" Reading an Amplify opportunity, where it is published, and what it holds.
Below every caller. Collection resolves an opportunity's title
once and stores it on the run, because every review row is
labelled with one and a lookup deferred to preview time would
leave the screen ... | rcrderby/star-pass | app/star_pass/_opportunities.py | .py | 49781833186450b4 | 7 | 0 |
#!/usr/bin/env python3
""" Progress and result reporting for the core.
The core describes what it is doing; something else decides how that
looks. The CLI renders these calls as terminal text, and the API
service will record them as job steps and stream them to a browser.
Neither rendering belongs in ... | rcrderby/star-pass | app/star_pass/_reporting.py | .py | 236d7c3b0f0d94ff | 7 | 0 |
#!/usr/bin/env python3
""" A run's change log, appended to and never edited. """
# Imports - Python Standard Library
import sqlite3
from dataclasses import replace
from typing import List
# Imports - Local
from .._database import execute, query
from .._logging import get_logger
from .._records import LogEntry
from ._... | rcrderby/star-pass | app/star_pass/_repository/_change_log.py | .py | e19fc01179799d4e | 7 | 0 |
#!/usr/bin/env python3
""" Statement building and shared values for the repositories.
What every repository in the package needs and none of them owns:
the time format their records are stamped with, the two statements
that are built from a column list rather than written out, and the
check that a writ... | rcrderby/star-pass | app/star_pass/_repository/_common.py | .py | f1b52804db848a5b | 7 | 0 |
#!/usr/bin/env python3
""" Writes that have been asked for, and what each one answered. """
# Imports - Python Standard Library
import json
import sqlite3
from typing import Any, Dict, Optional
# Imports - Local
from .._database import execute, query_one
from .._logging import get_logger
from .._records import Idempo... | rcrderby/star-pass | app/star_pass/_repository/_idempotency.py | .py | abd3298b100db49b | 7 | 0 |
#!/usr/bin/env python3
""" The numbered versions of a run's events. """
# Imports - Python Standard Library
import sqlite3
from typing import List, Optional
# Imports - Local
from .._database import execute, query, query_one, transaction
from .._exceptions import ValidationError
from .._logging import get_logger
from... | rcrderby/star-pass | app/star_pass/_repository/_revisions.py | .py | 960e6dc0eb30cbeb | 7 | 0 |
#!/usr/bin/env python3
""" Runs, and the opportunities each one resolved. """
# Imports - Python Standard Library
import sqlite3
from typing import Any, Iterable, List, Optional, Tuple
from uuid import uuid4
# Imports - Local
from .._database import execute, execute_many, query, query_one, transaction
from .._logging... | rcrderby/star-pass | app/star_pass/_repository/_runs.py | .py | bff1b066e66310bd | 7 | 0 |
#!/usr/bin/env python3
""" What a send put into Amplify, and who put it there. """
# Imports - Python Standard Library
import sqlite3
from typing import List, Sequence, Set
# Imports - Local
from .._database import execute_many, query
from .._logging import get_logger
from .._records import SentShift, ShiftIdentity
f... | rcrderby/star-pass | app/star_pass/_repository/_sent.py | .py | 621bce85ba6770b6 | 7 | 0 |
#!/usr/bin/env python3
""" What a run's window held that the run does not.
Written once, by the collection that read the window, and read
back whenever somebody asks why an event is not in the run. It is
stored rather than worked out on demand because the figure appears
beside every reading of the run... | rcrderby/star-pass | app/star_pass/_repository/_uncollected.py | .py | 54219a57496bc6f8 | 7 | 0 |
#!/usr/bin/env python3
""" Titles the data model did not match, kept for the next model edit.
An event whose title matches no category is collected under the
fallback, which has no need IDs, so it blocks the send and is
named. That is enough to get one run out of the door. What it is
not enough for i... | rcrderby/star-pass | app/star_pass/_repository/_unmatched.py | .py | ab8902b39324fcd5 | 7 | 0 |
#!/usr/bin/env python3
""" Running an interrupted job again (D10).
A job left queued or running when a process stopped is marked
interrupted, never resumed on its own: a send that resumed itself
would write to a live volunteer system from state rebuilt after a
crash. Somebody asks, and this is what th... | rcrderby/star-pass | app/star_pass/_resume.py | .py | ee0c543ec5b92f36 | 7 | 0 |
#!/usr/bin/env python3
""" Forgetting what a run leaves behind, on a policy (D12, D20).
The driver is what this data *is*, not how much of it there is: a
job's event log names volunteers and the times they were asked to
be somewhere, and a revision holds the events that were in it.
None of it is small ... | rcrderby/star-pass | app/star_pass/_retention.py | .py | c1bd729c1a6f54c9 | 7 | 0 |
#!/usr/bin/env python3
""" Marking where a run has got to, and going back to a mark.
An edit changes the revision a run is working in, in place. That
is what makes a revision worth sealing: it fixes what the run
holds now as something numbered and readable, and moves the work
to a new revision, so a r... | rcrderby/star-pass | app/star_pass/_revising.py | .py | 07c62bbee481e2ff | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.