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 |
|---|---|---|---|---|---|---|
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from qq.interface import GeographicRegion, Languoid, Script
@dataclass(frozen=True)
class ParsedLanguageTag:
"""Simple parsed result of a BCP 47 code.
This intentionally does not mode... | WPoelman/qwanqwa | src/qq/bcp47.py | .py | c73c1e742823e3d6 | 7.56 | 12 |
import logging
from pathlib import Path
import click
from qq.access import Database
from qq.constants import LOG_SEP, SOURCES_DIR, SOURCES_DOCS_PATH
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
@click.group()
@click.pass_context
def cli(ctx):
"""qwanqwa - Language... | WPoelman/qwanqwa | src/qq/cli.py | .py | 85259cd679f57dd1 | 7.56 | 12 |
import inspect
from collections import defaultdict
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Protocol, TypeVar, overload
T = TypeVar("T", bound="TraversableEntity")
E = TypeVar("E", bound=Enum)
# TODO: this does not belong here
class DataSource(Enum):
"""Known data so... | WPoelman/qwanqwa | src/qq/data_model.py | .py | 8856a4428183883f | 7.56 | 12 |
import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
from pathlib import Path
from typing import Any, TypeVar, cast
from qq.data_model import ID_TYPE_TO_ATTR, DataSource, IdType, RelationType, TraversableEntity
from qq.interface import GeographicRegion, Languoid, Script
from qq.internal... | WPoelman/qwanqwa | src/qq/importers/base_importer.py | .py | e92c54e79cc74970 | 7.56 | 12 |
import logging
import math
from pathlib import Path
import pandas as pd # TODO: also get rid of pandas dependency?
from qq.data_model import DataSource, IdType, RelationType
from qq.importers.base_importer import BaseImporter
logger = logging.getLogger(__name__)
def _clean_nan_records(records: list[dict]) -> list... | WPoelman/qwanqwa | src/qq/importers/glotscript_importer.py | .py | 3ad459149d71ee01 | 7.56 | 12 |
import csv
import logging
import re
from pathlib import Path
from qq.data_model import CanonicalId, DataSource, IdType, LanguoidLevel, NameEntry, RelationType
from qq.importers.base_importer import BaseImporter
from qq.interface import Languoid
logger = logging.getLogger(__name__)
class GlottologImporter(BaseImport... | WPoelman/qwanqwa | src/qq/importers/glottolog_importer.py | .py | 0c8c74fa1c7637c0 | 7.56 | 12 |
import csv
import json
import logging
from pathlib import Path
from typing import Any
from qq.data_model import (
CanonicalId,
DataSource,
DeprecatedCode,
EndangermentStatus,
IdType,
LanguageScope,
NameEntry,
RelationType,
)
from qq.importers.base_importer import BaseImporter
from qq.in... | WPoelman/qwanqwa | src/qq/importers/linguameta_importer.py | .py | b9064e173113a905 | 7.56 | 12 |
import csv
import logging
from pathlib import Path
from qq.data_model import CanonicalId, DataSource, IdType, NameEntry
from qq.importers.base_importer import BaseImporter
from qq.interface import Languoid, WikipediaInfo
logger = logging.getLogger(__name__)
class WikipediaImporter(BaseImporter):
"""... | WPoelman/qwanqwa | src/qq/importers/wikipedia_importer.py | .py | e75de190589c2777 | 7.56 | 12 |
from qq.data_model import (
ID_TYPE_TO_ATTR,
DeprecatedCode,
EndangermentStatus,
EntityContainer,
ExternalResource,
LanguageScope,
LanguageStatus,
LanguoidLevel,
RelationType,
TraversableEntity,
WikipediaInfo,
)
from qq.internal.data_store import DataStore
# These are the ma... | WPoelman/qwanqwa | src/qq/interface.py | .py | de2cf15250b9627d | 7.56 | 12 |
import logging
from pathlib import Path
from typing import Literal
from qq.constants import LOG_SEP
from qq.data_model import ID_TYPE_TO_ATTR, IdType
from qq.importers.base_importer import DataSource, EntitySet
from qq.interface import Languoid, Script
from qq.internal.entity_resolution import EntityResolver
from qq.i... | WPoelman/qwanqwa | src/qq/internal/build_database.py | .py | 9a677ee00ead2b5c | 7.56 | 12 |
from collections import defaultdict
from pathlib import Path
from typing import TYPE_CHECKING, TypeVar, cast, overload
from qq.data_model import CanonicalId, IdType, NameData, TraversableEntity
from qq.internal.names_export import NamesLoader
if TYPE_CHECKING:
from qq.internal.entity_resolution import EntityResol... | WPoelman/qwanqwa | src/qq/internal/data_store.py | .py | 42c711e609d95c46 | 7.56 | 12 |
import logging
from dataclasses import dataclass, field
from typing import Any
from qq.data_model import CanonicalId, IdType
logger = logging.getLogger(__name__)
__all__ = [
"EntityIdentity",
"EntityResolver",
]
@dataclass
class EntityIdentity:
"""Tracks all known identifiers for a single entity."""
... | WPoelman/qwanqwa | src/qq/internal/entity_resolution.py | .py | 441efa0badcb72c6 | 7.56 | 12 |
"""
Merge step: combines per-source EntitySets into a final DataStore.
Pass 1 -> Merge entity attributes:
For each entity ID across all EntitySets, create one entity in the final
DataStore. For each field in _data_fields, collect values from all sources.
Single-source values pass through. Multi-source conflicts ... | WPoelman/qwanqwa | src/qq/internal/merge.py | .py | f10540e7211d3dfb | 7.56 | 12 |
import dataclasses
import json
import logging
import zipfile
from pathlib import Path
from qq.data_model import CanonicalId, NameEntry
logger = logging.getLogger(__name__)
class NamesExporter:
"""Exports name data to a single zip archive for efficient packaging."""
def export_names(self, name_data_dict: di... | WPoelman/qwanqwa | src/qq/internal/names_export.py | .py | d4f29c7245863656 | 7.56 | 12 |
"""Merge name data collected from multiple importers."""
import dataclasses
from qq.data_model import NameEntry
def merge_name_data(all_name_data: list[dict[str, list[NameEntry]]]) -> dict[str, list[NameEntry]]:
"""Merge name data from multiple importers.
For each languoid, collects all name entr... | WPoelman/qwanqwa | src/qq/internal/names_merge.py | .py | bd11ba37392036c1 | 7.56 | 12 |
import gzip
import json
import logging
import pickle
from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING, Any
import qq
from qq.constants import DEFAULT_DB_PATH
from qq.internal.names_export import NamesExporter
if TYPE_CHECKING:
from qq.data_model import TraversableEntit... | WPoelman/qwanqwa | src/qq/internal/storage.py | .py | 7229b507ad74cfef | 7.56 | 12 |
from __future__ import annotations
import time
from argparse import ArgumentParser
from opentelemetry import trace
from ..client import Client
from ..tracing import set_category, set_error, set_params, set_tag
from .command import AppsignalCLICommand
class DemoCommand(AppsignalCLICommand):
"""Send demonstratio... | appsignal/appsignal-python | src/appsignal/cli/demo.py | .py | 50aab69ddf1862a5 | 7.45 | 7 |
from __future__ import annotations
from typing import Any
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
class CustomBuildHook(BuildHookInterface):
def initialize(self, version: str, build_data: dict[str, Any]) -> None:
"""
This occurs immediately before each build.
... | appsignal/appsignal-python | src/scripts/sdist_hook.py | .py | ffcad9fe51970e9a | 7.45 | 7 |
from __future__ import annotations
import discord
from discord.ext import commands, tasks
from discord import app_commands
import os
from dotenv import load_dotenv
from functions import setup_db
import unittest, test_functions
from pathlib import Path
import time
from aiocache import cached
from datetime import dateti... | kiki0124/Sapphire-helper | SH/main.py | .py | 252b3b69e4e45f4d | 7.63 | 17 |
import requests
# Shared authentication / accept headers for the GitHub REST API.
ACCEPT_HEADER = "application/vnd.github.v3+json"
REQUEST_TIMEOUT = 30
def _headers(token):
return {"Authorization": f"Bearer {token}", "Accept": ACCEPT_HEADER}
def _paginate(url, headers, params=None):
"""Yield each JSON resp... | ministryofjustice/dora-the-explora | github_api.py | .py | 2ec9f4778e3978b7 | 7.5 | 9 |
"""Shared helpers for the DORA metric scripts (cfr / df / ltfc / mttr).
Each metric script repeats the same setup: read the access token, parse the
command-line arguments, load the team's repo list, and configure logging. Those
are collected here so the metric scripts can stay focused on computing and
reporting a sing... | ministryofjustice/dora-the-explora | metrics_common.py | .py | 137633e7e236b898 | 7.5 | 9 |
"""Tests for github_api pagination and error handling, using a mocked requests."""
from unittest.mock import patch
import pytest
import requests
import github_api
class FakeResponse:
def __init__(self, json_data, links=None, status_ok=True):
self._json = json_data
self.links = links or {}
... | ministryofjustice/dora-the-explora | tests/test_github_api.py | .py | 8285bcbbf98d1f37 | 8 | 9 |
import ast
import csv
import pkgutil
import json
import re
from BaseClasses import MultiWorld, Item, ItemClassification
from enum import IntEnum
from typing import Optional, List, Union, get_args, get_origin, Any
from types import GenericAlias
from worlds.AutoWorld import World
from .hooks.Helpers import be... | silasary/APxiv | src/Helpers.py | .py | 967c5e47e213b521 | 7.6 | 15 |
import sys
from Options import PerGameCommonOptions, FreeText, Toggle, DefaultOnToggle, Choice, TextChoice, Range, NamedRange, DeathLink, \
OptionGroup, StartInventoryPool, Visibility, item_and_loc_options, Option
from .hooks.Options import before_options_defined, after_options_defined, before_option_groups_created... | silasary/APxiv | src/Options.py | .py | b269d63351486ce7 | 7.6 | 15 |
from typing import Any, Optional
from BaseClasses import MultiWorld
from .. import Helpers
# Zones on the level cap can be ambiguous.
# This skews regions at the start of an expansion to not be included unless the x1 level is also included in the cap.
REGION_LEVEL_CAP_ADJUSTMENTS: dict[str, int] = {
# Heavenswar... | silasary/APxiv | src/hooks/Helpers.py | .py | 05070ec36d928f01 | 7.6 | 15 |
import dataclasses
import math
from typing import TYPE_CHECKING
from BaseClasses import CollectionState, MultiWorld
from worlds.AutoWorld import World
from Utils import version_tuple
from ..Helpers import get_option_value
from ..Game import game_name
if TYPE_CHECKING:
from .. import ManualWorld
use_rulebuilder ... | silasary/APxiv | src/hooks/Rules.py | .py | 5d540a77bc498e13 | 7.6 | 15 |
"""Base model."""
import typing as ty
from pathlib import Path
from koyo.typing import PathLike
from pydantic import BaseModel as _BaseModel
from pydantic import ConfigDict
class BaseModel(_BaseModel):
"""Base model."""
model_config = ConfigDict(
arbitrary_types_allowed=True,
)
def update(... | vandeplaslab/image2image | src/image2image/models/base.py | .py | 125b5edf8068cc90 | 7.48 | 8 |
"""Transform."""
from pathlib import Path
from image2image_io.models.transform import TransformData as _TransformData
from image2image_io.models.transform import TransformModel
from koyo.typing import PathLike
__all__ = ("TransformData", "TransformModel")
class TransformData(_TransformData):
"""Transformation ... | vandeplaslab/image2image | src/image2image/models/transform.py | .py | 5f8cdbbc8407b227 | 7.48 | 8 |
"""Utilities."""
import typing as ty
from pathlib import Path
from koyo.typing import PathLike
from koyo.utilities import clean_path
from loguru import logger
def _read_config_from_file(path: PathLike) -> dict[str, ty.Any]:
"""Read config data from file."""
path = Path(path)
if path.suffix not in [".jso... | vandeplaslab/image2image | src/image2image/models/utilities.py | .py | 6aeaccc7cb173587 | 7.48 | 8 |
"""
Bescheid classification for the bescheidcheck pipeline (issues #496, #497).
Uses the LLM with a json_schema response_format to get a structured
classification for the document as a whole:
{
"type": "<one of the supported slugs or 'unsupported'>",
"confidence": <float 0..1>,
"reason": "<one s... | digitalfabrik/integreat-chat | integreat_chat/bescheidcheck/services/classification.py | .py | 01119b1f01e4248a | 7.42 | 6 |
"""
OCR pipeline for the bescheidcheck app (issue #492).
Docling is the primary OCR engine. Importing docling is expensive
(loads torch etc.), so we import it lazily inside the functions.
If docling is not installed, callers can catch the resulting
exceptions and return a 503 with a clear error message.
Pages are con... | digitalfabrik/integreat-chat | integreat_chat/bescheidcheck/services/ocr.py | .py | 4bb7bd7d28cbfee8 | 7.42 | 6 |
"""
Page ordering for the bescheidcheck pipeline.
Pages arrive in caller order (PDF pages split into 1-page files, images
in upload order).
When ``settings.BESCHEID_PAGE_ORDERING`` is ``"llm"``, the LLM reads
short per-page summaries and proposes a reading order. This happens
after OCR (the text is the prompt input).... | digitalfabrik/integreat-chat | integreat_chat/bescheidcheck/services/page_order.py | .py | d1aa0e64166cda68 | 7.42 | 6 |
"""
Sanitizer for HTML produced by the bescheidcheck pipeline.
OCR'd page text and LLM translation output are both untrusted: a PDF can
contain markup and a local LLM can be prompt-injected into emitting
``<script>`` or ``on*`` handlers. The output is inserted via
``innerHTML``, so :func:`sanitize_html` enforces a sma... | digitalfabrik/integreat-chat | integreat_chat/bescheidcheck/services/sanitizer.py | .py | 30bba889f61caa4a | 7.42 | 6 |
"""
Translation service for the bescheidcheck pipeline (issue #493).
Takes the per-page HTML produced by the OCR pipeline and translates
each <p data-para-id=...> paragraph to the target language,
preserving the para id and the bounding-box attributes so the browser
can keep the highlight overlay aligned.
Docling's H... | digitalfabrik/integreat-chat | integreat_chat/bescheidcheck/services/translation.py | .py | fa3cb1a0c6ff1cc8 | 7.42 | 6 |
"""
Static prompts for the bescheidcheck app.
"""
# pylint: disable=C0301,disable=R0903
from django.conf import settings
BACKGROUND = (
f"You are a document classifier for the Integreat project "
f"in {settings.INTEGREAT_COUNTRY}. "
"You only ever see de-identified OCR'd text of German administrative "
... | digitalfabrik/integreat-chat | integreat_chat/bescheidcheck/static/prompts.py | .py | 377e3f174d1b51ed | 7.42 | 6 |
"""
Retrieving matching documents for question an create summary text
"""
import asyncio
import logging
from math import ceil
import aiohttp
from asgiref.sync import sync_to_async
from django.conf import settings
from integreat_chat.search.services.search import SearchService
from integreat_chat.search.utils.search_... | digitalfabrik/integreat-chat | integreat_chat/chatanswers/services/answer.py | .py | 673b3b4e52a344b4 | 7.42 | 6 |
"""
Service to transform/optimize input queries
"""
import asyncio
import re
from django.conf import settings
from integreat_chat.chatanswers.services.llmapi import (
LlmApiClient,
LlmMessage,
LlmPrompt,
LlmResponse,
)
from ..static.prompts import Prompts
class QueryTransformer:
"""
Class ... | digitalfabrik/integreat-chat | integreat_chat/chatanswers/services/query_transformer.py | .py | abf2b0517f29a480 | 7.42 | 6 |
"""
Message for processing a user message / RAG request
"""
import logging
from django.conf import settings
from integreat_chat.core.utils.integreat_request import IntegreatRequest
LOGGER = logging.getLogger("django")
class RagRequest(IntegreatRequest):
"""
Class that represents a chat user message
""... | digitalfabrik/integreat-chat | integreat_chat/chatanswers/utils/rag_request.py | .py | c0579fbf44e7b9f7 | 7.42 | 6 |
"""
RAG response
"""
import aiohttp
from integreat_chat.search.utils.search_response import Document
from .rag_request import RagRequest
class RagResponse:
"""
Representation of RAG response
"""
def __init__(
self,
documents: list[Document],
request: RagRequest,
rag... | digitalfabrik/integreat-chat | integreat_chat/chatanswers/utils/rag_response.py | .py | 5fc866869199c7ae | 7.42 | 6 |
"""
base request class
"""
import hashlib
import logging
from typing import TYPE_CHECKING
import aiohttp
if TYPE_CHECKING:
from .integreat_request import IntegreatRequest
LOGGER = logging.getLogger('django')
class ChatMessage:
"""
Class for handling messages
"""
def __init__( # pylint: disabl... | digitalfabrik/integreat-chat | integreat_chat/core/utils/chat_message.py | .py | 2e78a07dd1ff6330 | 7.42 | 6 |
"""
Health check utilities for Integreat Chat
"""
import logging
from datetime import UTC, datetime
import aiohttp
import requests
from django.conf import settings
from integreat_chat.search.services.opensearch import OpenSearch
LOGGER = logging.getLogger(__name__)
async def check_llm_health() -> dict:
"""
... | digitalfabrik/integreat-chat | integreat_chat/core/utils/health.py | .py | 9b2695c7392a086e | 7.42 | 6 |
"""
base request class
"""
import logging
import aiohttp
from django.conf import settings
from integreat_chat.translate.services.language import LanguageService
from ..static.region_language_map import REGION_LANGUAGE_MAP
from .chat_message import ChatMessage
LOGGER = logging.getLogger('django')
class IntegreatRe... | digitalfabrik/integreat-chat | integreat_chat/core/utils/integreat_request.py | .py | 89047be4c53c1c6f | 7.42 | 6 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/amplitude_amplification/amp_ampl.py | .py | d06cbc2ee0bba6aa | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/cli/main.py | .py | b8eefae7a7f53b1f | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/embedding/prep_sel.py | .py | 22d2098ea343aded | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/embedding/toeplitz.py | .py | ac13aef9720aef40 | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/evolution/gqsp.py | .py | dbae1a1334ef18b3 | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/evolution/h_test_suite.py | .py | 72b82bcced6ab350 | 7 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/evolution/trotter.py | .py | 9db94fb0e57d77c0 | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/hhl/hhl.py | .py | fc098002b2295a2b | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/iqft/iqft.py | .py | f0ff011d3ebd48c1 | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/openpulse/gaussian.py | .py | 9c81a63907b981bd | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/qft/qft.py | .py | bc1f206536d4ab2b | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/qpe/phase_est.py | .py | 6964bd2dd47e60e0 | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/qtran/module_loader.py | .py | 7399ca3292b0fb6e | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/qtran/qasm_builder.py | .py | b90bc9977fef11a9 | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/rodeo/rodeo.py | .py | 486449038dada733 | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | qbraid_algorithms/utils.py | .py | 2832e8f14ef802ac | 7.5 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | tests/local_device.py | .py | 631fd10e6ccf46a6 | 8 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | tests/test_bernvaz.py | .py | 384e1c7ed8637a42 | 7 | 9 |
# Copyright 2025 qBraid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | qBraid/qbraid-algorithms | tests/test_builder_statics.py | .py | 3839e5f7e7478c82 | 7 | 9 |
// Run with: node .github/workflows/pr-labeler.test.js
//
// The labelling rules live inside the github-script block of pr-labeler.yml so the
// workflow itself needs no checkout. This test lifts that block out of the YAML and
// runs it against a fake `context` and `core`, so what is tested is what is deployed.
const... | jalantechnologies/flask-react-template | .github/workflows/pr-labeler.test.js | .js | f26b704cbf3f7b86 | 7.09 | 14 |
"""Supply the application with config values, that can
be overridden via env variables.
Usage example:
# using text config file
import yaml
from app_config import AppConfig
config_file = 'my-config.yaml'
with open(config_file, "r") as f:
# Load the YAML content
... | WebTrit/webtrit_bss_adapter_python | app/app_config.py | .py | b69829d790c9ef6a | 7.5 | 9 |
from bss.adapters import BSSAdapterExternalDB, AttrMap
from bss.types import (
OTP,
SessionInfo,
EndUser,
Calls,
ContactInfo,
Capabilities,
Numbers,
SIPInfo,
SIPRegistrationStatus,
UserCreateResponse
)
from abc import ABC, abstractmethod
from bss.sessions import SessionStorage
fr... | WebTrit/webtrit_bss_adapter_python | app/bss/adapters/ext_db_3cx.py | .py | 12208089644d1703 | 7.5 | 9 |
import logging
from typing import Optional
from bss.adapters.portaswitch.config import PortaSwitchSettings
from bss.adapters.portaswitch.exceptions import service_read_only_error
from bss.adapters.portaswitch.failover import READ_ONLY_FAULTS
from bss.adapters.portaswitch.types import PortaSwitchAdminUser
from bss.adap... | WebTrit/webtrit_bss_adapter_python | app/bss/adapters/portaswitch/api/admin.py | .py | 95e90f010567f967 | 7.5 | 9 |
"""Disaster-recovery (geographically dispersed PortaSwitch) failover support.
When the main PortaSwitch site goes down, the installation switches to standalone
(delta) mode: only the secondary site is operational and its API is read-only.
Detection is reactive and fault-code based (there is no mode-reporting endpoint... | WebTrit/webtrit_bss_adapter_python | app/bss/adapters/portaswitch/failover.py | .py | 398b93bf2404bb81 | 7.5 | 9 |
import re
from datetime import datetime, timezone
from typing import Optional
from bss.models import SIPTransport, UserId
from bss.types import (
Balance,
BalanceType,
CDRInfo,
ConnectStatus,
ContactInfo,
EndUser,
Numbers,
SIPInfo,
SIPRegistrationStatus,
SIPServer,
UserServi... | WebTrit/webtrit_bss_adapter_python | app/bss/adapters/portaswitch/serializer.py | .py | 20b7796c550a01d4 | 7.5 | 9 |
"""
Tests for WT-1585 fix: GET /api/v2/user/contacts must resolve contacts by
extension number (ext) and additional numbers, not only by main number.
Run against local adapter:
pytest test_05_retrieve_contacts_v2.py \
--server-url http://127.0.0.1:4001 \
--user 111000111 --password zzzxxx123
"""
i... | WebTrit/webtrit_bss_adapter_python | app/bss/adapters/portaswitch/tests/test_05_retrieve_contacts_v2.py | .py | d81d2cd17fe2f906 | 7 | 9 |
import base64
import hashlib
import logging
import uuid
from typing import Optional
from cryptography.fernet import Fernet, InvalidToken
from report_error import WebTritErrorException
def _fernet_from_secret(secret: str) -> Fernet:
"""Derive a Fernet cipher from an arbitrary secret string.
The 32-byte key ... | WebTrit/webtrit_bss_adapter_python | app/bss/adapters/portaswitch/utils.py | .py | 8cceaf052eb8c243 | 7.5 | 9 |
import threading
import shelve
import logging
from bss.types import AppConfig
class TiedKeyValue():
"""Dict-like access to external database, similar to
Perl's tied hash. This class works as a dictionary, but with
locks for data changes, so it can be safely used in FastAPI apps.
It is a base class for ... | WebTrit/webtrit_bss_adapter_python | app/bss/dbs.py | .py | 79d2f838d582faf9 | 7.5 | 9 |
import threading
import shelve
import logging
class TiedKeyValue:
"""Dict-like access to external database, similar to
Perl's tied hash. This class works as a dictionary, but with
locks for data changes, so it can be safely used in FastAPI apps.
It is a base class for your sub-classes,
which will i... | WebTrit/webtrit_bss_adapter_python | app/bss/dbs/__init__.py | .py | 987dfb2e30718b68 | 7.5 | 9 |
from datetime import datetime, timedelta
import logging
import uuid
from module_loader import ModuleLoader
import bss.dbs
from bss.dbs import FileStoredKeyValue, TiedKeyValue
from bss.dbs.firestore import FirestoreKeyValue
from bss.types import SessionInfo, UserInfo, safely_extract_scalar_value
from abc import ABC, abs... | WebTrit/webtrit_bss_adapter_python | app/bss/sessions.py | .py | 73a935bb31aa6e07 | 7.5 | 9 |
from phonenumbers import (NumberParseException, PhoneNumberFormat, PhoneNumberType,
parse as parse_phone_number, is_valid_number, format_number)
class PhonenumPrefixSet:
def __init__(self, prefixes: str = ""):
"""
Initializes the PhonenumPrefixSet with optional comma-separ... | WebTrit/webtrit_bss_adapter_python | app/phonenum_utils.py | .py | a65d59af37ad98a9 | 7.5 | 9 |
from fastapi import HTTPException
from fastapi.responses import JSONResponse
import os
import logging
import inspect
import traceback
from request_trace import sanitize_data
# for now we decided to protect the "initial" API calls
# such as login with username&password or creation
# of OTP by IP address filtering or o... | WebTrit/webtrit_bss_adapter_python | app/report_error.py | .py | 5d3cccf690e094e7 | 7.5 | 9 |
import requests
import pytest
def test_get_system_info_200(api_url, system_info_path):
print(f"sending req to {api_url + system_info_path}")
response = requests.get(api_url + system_info_path)
assert response.status_code == 200
def test_get_system_info_json(api_url, system_info_path):
response = req... | WebTrit/webtrit_bss_adapter_python | tests/test_01_system-info.py | .py | b7de7f5748f5c929 | 7 | 9 |
#!/usr/bin/env python3
"""
Check daily arXiv digest activity logs.
This script shows whether the system has run today and displays recent activity.
"""
from collections import defaultdict
from datetime import datetime
from src.logger import logger
def format_date_with_weekday(date_str: str) -> str:
"""Format d... | yang3kc/daily_arxiv_digest | check_log.py | .py | a6106168c6bb6578 | 7.65 | 19 |
#!/usr/bin/env python3
"""Fetch the latest arXiv papers from RSS feeds.
Standard library only — no third-party dependencies, no API keys.
Prints a JSON document to stdout (or --output file):
{
"fetched_at": "...", # UTC ISO timestamp
"subjects": ["cs.CL", ...],
"stats": {"papers_fetched": N, "by_subj... | yang3kc/daily_arxiv_digest | skills/arxiv-fetch/scripts/fetch_arxiv.py | .py | 709fbc014dfd4710 | 7.65 | 19 |
import json
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime, timezone
from pathlib import Path
import pandas as pd
from src.llm import LLMPaperReader
from src.logger import logger
from src.rss import ArxivRSS
def fetch_papers(config):
"""Fetch and deduplicate papers... | yang3kc/daily_arxiv_digest | src/digest.py | .py | d564ff24fe830cd7 | 7.65 | 19 |
import os
from typing import List
import pandas as pd
from openai import OpenAI, OpenAIError
from pydantic import BaseModel, Field
# Each provider is exposed through the OpenAI SDK: OpenRouter and Anthropic
# both offer OpenAI-compatible endpoints, so one code path serves all three.
PROVIDERS = {
"openai": {
... | yang3kc/daily_arxiv_digest | src/llm.py | .py | a0e796d2aebc4b87 | 7.65 | 19 |
import json
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Optional
class ActivityLogger:
def __init__(self, log_file: str = "logs/activity.jsonl"):
self.log_file = Path(log_file)
self.log_file.parent.mkdir(parents=True, exist_ok=True)
def log_activ... | yang3kc/daily_arxiv_digest | src/logger.py | .py | d0d97024e40288c2 | 7.65 | 19 |
"""Offline unit checks for markdown rendering (no API keys / network needed).
Run with: uv run python test_digest.py
Covers the cross-topic note behavior shared by run_digest and --rethreshold,
plus the short-label helpers.
"""
import json
import tempfile
from pathlib import Path
import pandas as pd
from src.digest... | yang3kc/daily_arxiv_digest | test_digest.py | .py | 1a422c56a4e35d7c | 8.15 | 19 |
""" compatibility OpenTimelineIO 0.12.0 and newer
"""
from typing import Optional
import os
import re
import opentimelineio as otio
from . import utils
import hiero.core
import hiero.ui
TRACK_TYPE_MAP = {
hiero.core.VideoTrack: otio.schema.TrackKind.Video,
hiero.core.AudioTrack: otio.schema.TrackKind.Audio
}... | ynput/ayon-hiero | client/ayon_hiero/api/otio/hiero_export.py | .py | 3f1d2d286c29277a | 7.42 | 6 |
import re
import json
import opentimelineio as otio
def timecode_to_frames(timecode, framerate):
rt = otio.opentime.from_timecode(timecode, 24)
return int(otio.opentime.to_frames(rt))
def frames_to_timecode(frames, framerate):
rt = otio.opentime.from_frames(frames, framerate)
return otio.opentime.t... | ynput/ayon-hiero | client/ayon_hiero/api/otio/utils.py | .py | 94fdcf3fb2cae051 | 7.42 | 6 |
"""
Basic avalon integration
"""
from copy import deepcopy
import os
import contextlib
from collections import OrderedDict
import hiero
from pyblish import api as pyblish
from ayon_core.host import (
HostBase,
IWorkfileHost,
ILoadHost,
IPublishHost
)
from ayon_core.lib import Logger
from ayon_core.pip... | ynput/ayon-hiero | client/ayon_hiero/api/pipeline.py | .py | dc875a56dd793e98 | 7.42 | 6 |
# -*- coding: utf-8 -*-
__author__ = "Daniel Flehner Heen"
__credits__ = ["Jakub Jezek", "Daniel Flehner Heen"]
import os
import hiero.core
from hiero.core import util
import opentimelineio as otio
from ayon_hiero.api.otio import hiero_export
class OTIOExportTask(hiero.core.TaskBase):
def __init__(self, initDi... | ynput/ayon-hiero | client/ayon_hiero/api/startup/Python/Startup/otioexporter/OTIOExportTask.py | .py | 54bfc11db6b04055 | 7.42 | 6 |
# -*- coding: utf-8 -*-
__author__ = "Daniel Flehner Heen"
__credits__ = ["Jakub Jezek", "Daniel Flehner Heen"]
import hiero.ui
from .OTIOExportTask import (
OTIOExportTask,
OTIOExportPreset
)
from qtpy import QtCore
from qtpy.QtWidgets import QCheckBox
try:
# Hiero >= 11.x
from hiero.ui.FnTaskUIForm... | ynput/ayon-hiero | client/ayon_hiero/api/startup/Python/Startup/otioexporter/OTIOExportUI.py | .py | 62d8822e1c213449 | 7.42 | 6 |
from hiero.core.util import uniquify, version_get, version_set
import hiero.core
import hiero.ui
import nuke
from qtpy.QtWidgets import QAction
# A globally variable for storing the current Project
gTrackedActiveProject = None
# This selection handler will track changes in items selected/deselected in the Bin/Timeli... | ynput/ayon-hiero | client/ayon_hiero/api/startup/Python/Startup/project_helpers.py | .py | 54e696e7f0782af2 | 7.42 | 6 |
from typing import Optional
import json
import re
import hiero
import ayon_api
from ayon_core.lib import Logger
from ayon_core.pipeline import get_current_project_name
from . import constants
log = Logger.get_logger(__name__)
def tag_data():
return {
"[Lenses]": {
"Set lense here": {
... | ynput/ayon-hiero | client/ayon_hiero/api/tags.py | .py | 15935cfc0cadde2e | 7.42 | 6 |
import os
import hiero
from ayon_core.lib import Logger
log = Logger.get_logger(__name__)
def file_extensions():
return [".hrox"]
def has_unsaved_changes():
# There are no methods for querying unsaved changes to a project, so
# enforcing to always save.
# but we could at least check if a current o... | ynput/ayon-hiero | client/ayon_hiero/api/workio.py | .py | 9664d2f322bc5c3c | 7.42 | 6 |
# -*- coding: utf-8 -*-
"""Creator plugin for creating workfiles."""
from ayon_core.pipeline.create import CreatedInstance, AutoCreator
from ayon_hiero.api import tags, constants
class CreateWorkfile(AutoCreator):
"""Workfile auto-creator."""
settings_category = "hiero"
identifier = "io.ayon.creators.hi... | ynput/ayon-hiero | client/ayon_hiero/plugins/create/create_workfile.py | .py | b13b8f6e420b8d3b | 7.42 | 6 |
import ayon_api
from ayon_core.pipeline import get_representation_path
from ayon_core.lib.transcoding import (
VIDEO_EXTENSIONS,
IMAGE_EXTENSIONS
)
import ayon_hiero.api as phiero
class LoadClip(phiero.SequenceLoader):
"""Load a product to timeline as clip
Place clip to timeline on its asset origin ... | ynput/ayon-hiero | client/ayon_hiero/plugins/load/load_clip.py | .py | cb03eb96f4389bbc | 7.42 | 6 |
from typing import Dict, Any
from pathlib import Path
import os
import glob
from ayon_core.pipeline import (
AYON_CONTAINER_ID,
load,
get_representation_path,
)
from ayon_hiero.api import lib, tags
import hiero.core
class LoadEditorialPackage(load.LoaderPlugin):
"""Load editorial package to timeline... | ynput/ayon-hiero | client/ayon_hiero/plugins/load/load_editorial_package.py | .py | 70dd91e838e7b764 | 7.42 | 6 |
import pyblish
from ayon_core.pipeline import PublishError
from ayon_hiero.api.otio import utils
class CollectEditorialAudio(pyblish.api.InstancePlugin):
"""Collect new audio."""
order = pyblish.api.CollectorOrder - 0.48
label = "Collect Audio"
hosts = ["hiero"]
families = ["audio"]
def pro... | ynput/ayon-hiero | client/ayon_hiero/plugins/publish/collect_audio.py | .py | a4ee0298bd951ff9 | 7.42 | 6 |
import re
import copy
import pyblish.api
class CollectClipEffects(pyblish.api.InstancePlugin):
"""Collect soft effects instances."""
order = pyblish.api.CollectorOrder - 0.078
label = "Collect Clip Effects Instances"
families = ["clip"]
settings_category = "hiero"
effect_categories = []
... | ynput/ayon-hiero | client/ayon_hiero/plugins/publish/collect_clip_effects.py | .py | 5323c4cf7f6e0043 | 7.42 | 6 |
from pprint import pformat
import json
import re
import ast
import pyblish.api
class CollectFrameTagInstances(pyblish.api.ContextPlugin):
"""Collect frames from tags.
Tag is expected to have metadata:
{
"productBaseType": "frame"
"productName": "main"
}
"""
order = pyblish.a... | ynput/ayon-hiero | client/ayon_hiero/plugins/publish/collect_frame_tag_instances.py | .py | 1dd09c8699b1d51e | 7.42 | 6 |
import pyblish.api
from ayon_hiero.api import lib
from ayon_hiero.api.otio import hiero_export
import hiero
class CollectOTIOTimeline(pyblish.api.ContextPlugin):
"""Inject the otio timeline"""
label = "Collect OTIO Timeline"
hosts = ["hiero"]
order = pyblish.api.CollectorOrder - 0.491
def proc... | ynput/ayon-hiero | client/ayon_hiero/plugins/publish/collect_otio_timeline.py | .py | dd29379fe9858d88 | 7.42 | 6 |
import pyblish
from ayon_core.pipeline import PublishError
from ayon_hiero.api.otio import utils
class CollectPlate(pyblish.api.InstancePlugin):
"""Collect new plates."""
order = pyblish.api.CollectorOrder - 0.48
label = "Collect Plate"
hosts = ["hiero"]
families = ["plate"]
def process(sel... | ynput/ayon-hiero | client/ayon_hiero/plugins/publish/collect_plates.py | .py | ec0dd9a46a3a3e0d | 7.42 | 6 |
import pyblish
from ayon_core.pipeline import PublishError
from ayon_hiero.api import lib
from ayon_hiero.api.otio import utils
import hiero
class CollectShot(pyblish.api.InstancePlugin):
"""Collect new shots."""
order = pyblish.api.CollectorOrder - 0.49
label = "Collect Shots"
hosts = ["hiero"]
... | ynput/ayon-hiero | client/ayon_hiero/plugins/publish/collect_shots.py | .py | 571653aa47727fb7 | 7.42 | 6 |
"""Collect comments from tags on selected track items and their sources."""
from __future__ import annotations
from pyblish import api
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from hiero.core import Tag
class CollectClipTagComments(api.InstancePlugin):
"""Collect comments from tags on selected tra... | ynput/ayon-hiero | client/ayon_hiero/plugins/publish/collect_tag_comments.py | .py | 77bf36b88d597b87 | 7.42 | 6 |
from pyblish import api
import json
class CollectClipTagTasks(api.InstancePlugin):
"""Collect Tags from selected track items."""
order = api.CollectorOrder - 0.077
label = "Collect Tag Tasks"
hosts = ["hiero"]
families = ["shot"]
def process(self, instance):
# gets tags
tags ... | ynput/ayon-hiero | client/ayon_hiero/plugins/publish/collect_tag_tasks.py | .py | 7ea62f34e9bbaf8a | 7.42 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.