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 |
|---|---|---|---|---|---|---|
"""Update entities for GPM."""
from __future__ import annotations
from datetime import timedelta
from typing import Any
from homeassistant.components.update import UpdateEntity, UpdateEntityFeature
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant... | tomasbedrich/gpm | custom_components/gpm/update.py | .py | faf5e547673efffa | 7.52 | 10 |
"""Common fixtures for the GPM tests."""
import logging
import shutil
from collections.abc import AsyncGenerator, Generator, Mapping
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from custom_components.gpm import get_manager
from custom_components.gpm._manager import (
... | tomasbedrich/gpm | tests/conftest.py | .py | c75f8dafaa228b91 | 8.02 | 10 |
#!/usr/bin/env python3
"""Check that the test layout mirrors the source layout (TinyCTA variant).
This is a repo-local adaptation of the Rhiza ``check_test_layout.py`` gate. It
keeps the strict 1:1 mirror as the default, but recognises that a handful of
TinyCTA test suites intentionally have *no* ``src/`` counterpart,... | tschm/TinyCTA | scripts/check_test_layout.py | .py | d049998e494860fe | 8.13 | 17 |
"""Configuration model for the Basanos engine."""
from pydantic import BaseModel, Field, ValidationInfo, field_validator
class Config(BaseModel):
"""Configuration for correlation-aware position optimization (Basanos engine).
Example:
>>> from pydantic import ValidationError
>>> from tinycta.... | tschm/TinyCTA | src/tinycta/config.py | .py | d0f88a36c624b67f | 7.63 | 17 |
"""Engine for correlation-aware risk position optimization.
This module is the Polars-facing orchestration layer: :class:`Engine` validates and holds
the aligned ``prices``/``mu`` frames, derives the volatility-adjusted returns and per-timestamp
EWMA correlation matrices, and hands the resulting NumPy arrays to the pu... | tschm/TinyCTA | src/tinycta/engine.py | .py | 2760957655017c93 | 7.63 | 17 |
"""Experiment setup helpers: logger configuration."""
import os
from pathlib import Path
from typing import Any, NamedTuple
import yaml
from loguru import logger
_FILE_SINKS: dict[str, int] = {}
class ExperimentConfig(NamedTuple):
"""Resources bundled for a notebook experiment run.
Example:
>>> fr... | tschm/TinyCTA | src/tinycta/hyper/_setup.py | .py | 17a415fba3b7438b | 7.63 | 17 |
"""Frozen Study result and Optuna-based hyperparameter optimisation."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
import optuna
from jquantstats import Portfolio
from loguru import logger
@datacla... | tschm/TinyCTA | src/tinycta/hyper/_study.py | .py | d81cff454ded57a5 | 7.63 | 17 |
"""Oscillator signal utilities built on Polars expressions.
This module provides a helper to compute an oscillator from price series using
exponentially weighted moving averages (EWMA) and an analytical scaling factor.
The functions are designed to be used inside Polars pipelines
(e.g., with DataFrame.with_columns) an... | tschm/TinyCTA | src/tinycta/osc.py | .py | 917dedc08cae942d | 7.63 | 17 |
# Copyright (c) 2023 Thomas Schmelzer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | tschm/TinyCTA | src/tinycta/signal.py | .py | 7f47069cc0a9f3bd | 7.63 | 17 |
"""Volatility adjustment and price normalization helpers (Polars expressions).
This module provides expression-level building blocks used to standardize
log returns by an exponentially weighted volatility estimate and to integrate
those standardized returns into adjusted log-price series. These are designed
for use wi... | tschm/TinyCTA | src/tinycta/util.py | .py | 2c94b4b8877593f6 | 7.63 | 17 |
"""Property-based tests for TinyCTA using Hypothesis.
Tests mathematical invariants for linalg and signal modules.
"""
from __future__ import annotations
import math
import numpy as np
import polars as pl
import pytest
from hypothesis import given, settings
from hypothesis import strategies as st
from hypothesis.ex... | tschm/TinyCTA | tests/property/test_properties.py | .py | 7de8c4ea186e1f8d | 7.13 | 17 |
"""Guard the core-install contract.
``pip install tinycta`` provides only ``[project].dependencies``. The Optuna-based
``tinycta.hyper`` layer and the four packages it needs (``jquantstats``, ``loguru``,
``optuna``, ``pyyaml``) arrive only with ``pip install "tinycta[hyper]"``.
Nothing else in the suite can see that ... | tschm/TinyCTA | tests/test_core_install.py | .py | 5010a5e0f9a60f78 | 8.13 | 17 |
"""Tests for repository-owned README links."""
from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
README = ROOT / "README.md"
def test_license_badge_uses_main_branch() -> None:
"""The README license badge should point at LICENSE on the main branch."""
rea... | tschm/TinyCTA | tests/test_readme_links.py | .py | 396bbcb54bb20cf9 | 7.13 | 17 |
"""The first test a freshly synced Python project has.
This file flows down via a SYNC action from the jebel-quant/rhiza repository
(https://github.com/jebel-quant/rhiza).
**Why it exists.** Two reasons, and the second is the one that is easy to lose.
It checks a real invariant: that the version the project *declare... | tschm/TinyCTA | tests/test_rhiza_packaging.py | .py | df427ab81aeed6d1 | 8.13 | 17 |
"""Workflow tests for security-related CI gates."""
from __future__ import annotations
from pathlib import Path
from typing import Any
import yaml
ROOT = Path(__file__).resolve().parents[1]
def _load_workflow(name: str) -> dict[str, Any]:
"""Load a workflow YAML, normalizing the truthy ``on:`` key back to a s... | tschm/TinyCTA | tests/test_workflows.py | .py | d5c0e8ea841690d9 | 8.13 | 17 |
"""Test fixtures for the TinyCTA package.
This module contains pytest fixtures that are used across multiple test files.
These fixtures provide common test data and resources to ensure consistent testing.
Security Notes:
- S101 (assert usage): Asserts are the standard way to validate test conditions in pytest.
They... | tschm/TinyCTA | tests/tinycta/conftest.py | .py | e17431f617d9b737 | 8.13 | 17 |
"""Tests for tinycta.hyper._setup: _load_yaml and get_config."""
from __future__ import annotations
import pytest
import tinycta.hyper._setup as setup_mod
from tinycta.hyper._setup import ExperimentConfig, _load_yaml, get_config
class TestLoadYaml:
"""Tests for the private _load_yaml helper."""
def test_r... | tschm/TinyCTA | tests/tinycta/hyper/test__setup.py | .py | 044a2de7c0c20d14 | 8.13 | 17 |
"""Behavioural tests for tinycta._kernel, the pure-NumPy numeric kernel.
The kernel is otherwise exercised only indirectly through :mod:`tinycta.engine`.
These tests pin its leaf functions on observable output for known inputs — the
solved risk position, the EWMA profit-variance recursion, and the degenerate
fallback ... | tschm/TinyCTA | tests/tinycta/test__kernel.py | .py | 88e5406780b687ff | 8.13 | 17 |
"""Tests for tinycta.config.Config."""
from __future__ import annotations
import pytest
from pydantic import ValidationError
from tinycta.config import Config
class TestConfig:
"""Behavioural tests for the frozen Config model."""
def test_valid_config(self):
"""Config accepts valid field values.""... | tschm/TinyCTA | tests/tinycta/test_config.py | .py | 63b5b7a5ba3cab69 | 8.13 | 17 |
"""Tests for tinycta.engine.Engine."""
from __future__ import annotations
import datetime
import numpy as np
import polars as pl
import pytest
from tinycta.config import Config
from tinycta.engine import Engine
def _synthetic_prices(n_days: int = 500, assets: list[str] | None = None) -> pl.DataFrame:
"""Retur... | tschm/TinyCTA | tests/tinycta/test_engine.py | .py | d8a166b55329334b | 8.13 | 17 |
"""Tests for the ewm_covariance function."""
from __future__ import annotations
import numpy as np
import polars as pl
import pytest
from tinycta.ewm_cov import NegativeWarmupError, ewm_covariance
@pytest.fixture
def returns() -> pl.DataFrame:
"""Two-asset returns DataFrame with a date index."""
rng = np.r... | tschm/TinyCTA | tests/tinycta/test_ewm_cov.py | .py | 2f5ae805e55c4a6a | 8.13 | 17 |
"""Tests for tinycta.ewma.ma_cross.
These tests validate that the EWMA crossover signal:
- equals the sign of the difference between fast and slow EWMA means,
- yields zeros when fast == slow (tie), and
- works column-wise for multiple assets when used in with_columns.
"""
from __future__ import annotations
from dat... | tschm/TinyCTA | tests/tinycta/test_ewma.py | .py | 4b57219a33021f3a | 8.13 | 17 |
"""Tests for the linear algebra module of TinyCTA.
This module contains tests for the linear algebra functions in the TinyCTA package.
It tests various matrix operations including validation, norm calculations, and
solving linear systems with different input scenarios including edge cases.
"""
from __future__ import ... | tschm/TinyCTA | tests/tinycta/test_linalg.py | .py | 260210253decd89d | 7.13 | 17 |
"""Tests for tinycta.osc.osc.
These tests validate that the oscillator expression:
- produces finite outputs for typical parameters,
- matches the analytically scaled EWM difference,
- raises when invalid fast/slow parameters are used.
"""
from __future__ import annotations
import math
from datetime import date, tim... | tschm/TinyCTA | tests/tinycta/test_osc.py | .py | 2353da7f4f38a582 | 8.13 | 17 |
"""Tests for the signal processing module of TinyCTA."""
from __future__ import annotations
import math
import numpy as np
import polars as pl
import polars.testing as pt
import pytest
from tinycta.signal import moving_absolute_deviation, shrink2id
def _mad_reference(col: str, com: int) -> pl.Expr:
"""Indepen... | tschm/TinyCTA | tests/tinycta/test_signal.py | .py | 1f9dd88b2c21e194 | 8.13 | 17 |
"""Execute the end-to-end tutorial and verify its documented output.
``docs/tutorial.md`` is a runnable walkthrough: its non-skipped ``python`` code
blocks are concatenated and executed, and the merged stdout must match the
concatenated ``result`` blocks. This keeps the tutorial honest — if the API or
its behaviour dr... | tschm/TinyCTA | tests/tinycta/test_tutorial.py | .py | 6f3d2c1a4b4c7f14 | 8.13 | 17 |
"""Tests for tinycta.util helpers: vol_adj and adj_log_prices.
These tests verify that:
- vol_adj standardizes log returns and applies clipping,
- adj_log_prices integrates the adjusted returns via cum_sum,
- both functions are usable as Polars expressions in with_columns.
"""
from __future__ import annotations
from... | tschm/TinyCTA | tests/tinycta/test_util.py | .py | 88fc69e58de8fa9e | 8.13 | 17 |
"""Test suite configuration."""
from collections.abc import Iterable
from typing import Union
from unittest.mock import MagicMock, patch
import pytest
from deepl import Formality, Language, TextResult, Translator
DEFAULT_SOURCE_LANG = "DE"
def translate_text_mock(
text: Union[str, Iterable[str]],
*,
ta... | dribia/deepl-haystack | tests/conftest.py | .py | ea1b384859f7dc27 | 7.95 | 7 |
"""Top level test suite."""
import re
import sys
from importlib import reload
from importlib.metadata import PackageNotFoundError
from unittest.mock import patch
import deepl_haystack
class TestInit:
@patch("importlib.metadata.version", side_effect=PackageNotFoundError)
def test_version_not_found(self, mock... | dribia/deepl-haystack | tests/test_deepl_haystack_init.py | .py | d1be05672b543e16 | 7.95 | 7 |
#!/usr/bin/env python3
import os
import subprocess
import time
import uuid
import pytest
import nvim_remote
# Helper functions
def run_nvim(env: dict[str, str]) -> subprocess.Popen[bytes]:
nvim = subprocess.Popen(["nvim", "-nu", "NORC", "--headless"], env=env)
time.sleep(1)
return nvim
def run_nvim_... | 1995parham/nvim-remote | tests/test_nvr.py | .py | 0827b72a00e60f8e | 7.07 | 13 |
"""MorphoDepot — contributor data entry via Slicer table nodes (PROTOTYPE / NON-PRODUCTION).
NOT production code. The shipped implementation lives in `MorphoDepot/MorphoDepotLib/contributors.py`;
this file is a kept exploration only. The hardcoded `REPO` below is a throwaway example.
Investigates using Slicer's nativ... | SlicerMorph/SlicerMorphoDepot | Experiments/contributor_table_prototype.py | .py | c28c6a518f9170f1 | 7.45 | 7 |
"""MorphoDepotAccessionForm (split from MorphoDepot.py)."""
import os
import re
import logging
import qt
import ctk
import slicer
from slicer.i18n import tr as _
from slicer.i18n import translate
from MorphoDepotLib.forms import (FormBaseQuestion, FormRadioQuestion, FormCheckBoxesQuestion,
FormTextQuestion, FormCom... | SlicerMorph/SlicerMorphoDepot | MorphoDepot/MorphoDepotLib/accession_form.py | .py | 151e24e82eb62873 | 7.45 | 7 |
"""MorphoDepotSearchForm (split from MorphoDepot.py)."""
import os
import re
import logging
import qt
import ctk
import slicer
from slicer.i18n import tr as _
from slicer.i18n import translate
from MorphoDepotLib.forms import (FormBaseQuestion, FormRadioQuestion, FormCheckBoxesQuestion,
FormTextQuestion, FormComboB... | SlicerMorph/SlicerMorphoDepot | MorphoDepot/MorphoDepotLib/search_form.py | .py | 421f8748dfa33f7a | 7.45 | 7 |
"""Shared input-validation helpers used by both the Create and Release tabs.
Kept in a dedicated mixin (rather than living on one tab mixin and being called from another)
so the dependency is explicit and either tab can use them without an implicit cross-tab coupling.
"""
import logging
class ValidationMixin:
d... | SlicerMorph/SlicerMorphoDepot | MorphoDepot/MorphoDepotLib/widget_validation.py | .py | 2b68432cfe028009 | 7.45 | 7 |
"""End-to-end fixtures + flows: drive REAL create / publish / release against live GitHub + the
App (test-mode). Uses the global `H` (Harness). These are heavier and stateful, kept separate from
the fast workflow net. A repo named with the mdtest- prefix routes through the App test-mode (no
reviewer email; approve-id f... | SlicerMorph/SlicerMorphoDepot | MorphoDepot/Testing/Python/md_e2e.py | .py | 40db8738ecca5e0f | 7.95 | 7 |
"""MorphoDepot workflow smoke tests (happy path, valid input). Breadth over
depth: touch a representative interaction in each tab so a refactor that breaks
any tab's wiring shows up. Uses the global `H` (Harness) set up by md_run.py."""
def _create_redistribution_gate():
H.goTab("Create")
H.fillValidForm(name... | SlicerMorph/SlicerMorphoDepot | MorphoDepot/Testing/Python/md_tests.py | .py | a001febed03fb9f0 | 7.95 | 7 |
"""KittyCAD language"""
from importlib.resources import files as _files
from ._binding import language
def _get_query(name, file):
query = _files(f"{__package__}.queries") / file
globals()[name] = query.read_text()
return globals()[name]
def __getattr__(name):
# NOTE: uncomment these to include an... | KittyCAD/tree-sitter-kcl | bindings/python/tree_sitter_kcl/__init__.py | .py | c33ee2b5e65a2a48 | 7.48 | 8 |
# Note: initially copied from https://github.com/florimondmanca/httpx-sse/blob/master/src/httpx_sse/_decoders.py
from __future__ import annotations
import json
import inspect
from types import TracebackType
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast
from typing_ext... | conductor-is/quickbooks-desktop-python | src/conductor/_streaming.py | .py | 6393c16efe38eb54 | 7.5 | 9 |
from __future__ import annotations
from os import PathLike
from typing import (
IO,
TYPE_CHECKING,
Any,
Dict,
List,
Type,
Tuple,
Union,
Mapping,
TypeVar,
Callable,
Iterable,
Iterator,
Optional,
Sequence,
AsyncIterable,
)
from typing_extensions import (
... | conductor-is/quickbooks-desktop-python | src/conductor/_types.py | .py | 7bebaad29d530b60 | 7.5 | 9 |
from __future__ import annotations
from typing import Any
from typing_extensions import override
from ._proxy import LazyProxy
class ResourcesProxy(LazyProxy[Any]):
"""A proxy for the `conductor.resources` module.
This is used so that we can lazily import `conductor.resources` only when
needed *and* so... | conductor-is/quickbooks-desktop-python | src/conductor/_utils/_resources_proxy.py | .py | c90d96dc05198256 | 7.5 | 9 |
import logging
from logging.config import fileConfig
from flask import current_app
from alembic import context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers b... | weisserw/ibjjf-elo | app/migrations/env.py | .py | 45a7e86923a0ab47 | 7.48 | 8 |
"""Add default_golds table
Revision ID: 05baa9af70fd
Revises: 437b007233f4
Create Date: 2024-12-25 23:14:12.400334
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "05baa9af70fd"
down_revision = "437b007233f4"
branch_labels = None
depends_on = None
def upgrad... | weisserw/ibjjf-elo | app/migrations/versions/05baa9af70fd_add_default_golds_table.py | .py | c8da8c6e3144e66a | 7.48 | 8 |
"""add medals only column
Revision ID: 09e07cec375d
Revises: 92048bfbe6a9
Create Date: 2025-11-19 20:38:14.082291
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "09e07cec375d"
down_revision = "92048bfbe6a9"
branch_labels = None
depends_on = None
def upgrade... | weisserw/ibjjf-elo | app/migrations/versions/09e07cec375d_add_medals_only_column.py | .py | 4d0ab309ade2fa70 | 7.48 | 8 |
"""add end time for streams
Revision ID: 14c3d5b66ab0
Revises: 4b9aad15cd37
Create Date: 2025-12-05 22:51:39.218842
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "14c3d5b66ab0"
down_revision = "4b9aad15cd37"
branch_labels = None
depends_on = None
def upgrad... | weisserw/ibjjf-elo | app/migrations/versions/14c3d5b66ab0_add_end_time_for_streams.py | .py | 9fcf87779e44acea | 7.48 | 8 |
"""add manual_promotions table
Revision ID: 15a704d921bf
Revises: 515b1aeeedc3
Create Date: 2025-10-26 12:37:35.368957
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "15a704d921bf"
down_revision = "515b1aeeedc3"
branch_labels = None
depends_on = None
def upg... | weisserw/ibjjf-elo | app/migrations/versions/15a704d921bf_add_manual_promotions_table.py | .py | f73b115a395001b7 | 7.48 | 8 |
"""add profile image saved at column
Revision ID: 162c522eb7ba
Revises: 6c9ba0f0bbb1
Create Date: 2025-10-18 22:09:10.976857
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "162c522eb7ba"
down_revision = "6c9ba0f0bbb1"... | weisserw/ibjjf-elo | app/migrations/versions/162c522eb7ba_add_profile_image_saved_at_column.py | .py | cecfaf7c75a93c13 | 7.48 | 8 |
"""suspend Roosevelt Souza
Revision ID: 1b8307290539
Revises: dc06d1a5a17b
Create Date: 2026-04-15 18:45:06.517970
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "1b8307290539"
down_revision = "dc06d1a5a17b"
branch_labels = None
depends_on = None
def upgrad... | weisserw/ibjjf-elo | app/migrations/versions/1b8307290539_suspend_roosevelt_souza.py | .py | e42b1a94692323e1 | 7.48 | 8 |
"""add result_medals table
Revision ID: 26f5ef66820b
Revises: f2c7ad981d29
Create Date: 2026-05-16 09:03:29.749279
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "26f5ef66820b"
down_revision = "f2c7ad981d29"
branch_labels = None
depends_on = None
def upgrad... | weisserw/ibjjf-elo | app/migrations/versions/26f5ef66820b_add_result_medals_table.py | .py | f800db72d78507c2 | 7.48 | 8 |
"""add bracket cache
Revision ID: 324d24f6ead6
Revises: e411802c23af
Create Date: 2025-01-26 08:35:49.937157
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "324d24f6ead6"
down_revision = "e411802c23af"
branch_labels = None
depends_on = None
def upgrade():
... | weisserw/ibjjf-elo | app/migrations/versions/324d24f6ead6_add_bracket_cache.py | .py | 0ef910596bd2ec9b | 7.48 | 8 |
"""add division_size to matches
Revision ID: 3b8a6d4f2c1e
Revises: 8d4c7f6a91b2
Create Date: 2026-06-13 00:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "3b8a6d4f2c1e"
down_revision = "8d4c7f6a91b2"
branch_labels = None
depends_on = None
def u... | weisserw/ibjjf-elo | app/migrations/versions/3b8a6d4f2c1e_add_division_size_to_matches.py | .py | 279c014ad529f3cc | 7.48 | 8 |
"""fix and rename current_ratings
Revision ID: 437b007233f4
Revises: 69f04669a1a3
Create Date: 2024-12-22 22:41:43.076766
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "437b007233f4"
down_revision = "69f04669a1a3"
branch_labels = None
depends_on = None
def... | weisserw/ibjjf-elo | app/migrations/versions/437b007233f4_fix_and_rename_current_ratings.py | .py | 85a0d160794123cf | 7.48 | 8 |
"""add livestream archive queue requested at
Revision ID: 4b2c9d8e7f10
Revises: 1c2d3e4f5a6b
Create Date: 2026-07-06 00:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "4b2c9d8e7f10"
down_revision = "1c2d3e4f5a6b"
branch_labels = None
depends_on =... | weisserw/ibjjf-elo | app/migrations/versions/4b2c9d8e7f10_add_livestream_archive_queue_requested_at.py | .py | cf19f085d0361329 | 7.48 | 8 |
"""add flo event tags table
Revision ID: 4b9aad15cd37
Revises: ce02b112a731
Create Date: 2025-12-04 22:18:30.017465
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "4b9aad15cd37"
down_revision = "ce02b112a731"
branch_labels = None
depends_on = None
def upgrad... | weisserw/ibjjf-elo | app/migrations/versions/4b9aad15cd37_add_flo_event_tags_table.py | .py | 6110674b292d262c | 7.48 | 8 |
from __future__ import annotations
import abc
import pathlib
import sys
from typing import Any
from typing import Protocol
from typing import runtime_checkable
from typing import TYPE_CHECKING
if sys.version_info >= (3, 11): # pragma: >=3.11 cover
from typing import Self
else: # pragma: <3.11 cover
from typ... | proxystore/taps | taps/apps/_protocol.py | .py | 107532dcef5f0186 | 7.56 | 12 |
"""Cholesky decomposition application."""
from __future__ import annotations
import logging
import pathlib
from typing import TypeAlias
import numpy
from numpy.typing import NDArray
from taps.engine import Engine
from taps.engine import task
from taps.engine import TaskFuture
from taps.logging import APP_LOG_LEVEL
... | proxystore/taps | taps/apps/cholesky.py | .py | acd3d3c626c67174 | 7.56 | 12 |
from __future__ import annotations
import pathlib
from typing import Literal
from pydantic import Field
from pydantic import field_validator
from taps.apps import App
from taps.apps import AppConfig
from taps.plugins import register
@register('app')
class DockingConfig(AppConfig):
"""Docking application config... | proxystore/taps | taps/apps/configs/docking.py | .py | 5c35d6459b7e2756 | 7.56 | 12 |
from __future__ import annotations
import sys
from typing import Any
from typing import Literal
if sys.version_info >= (3, 11): # pragma: >=3.11 cover
from typing import Self
else: # pragma: <3.11 cover
from typing_extensions import Self
from pydantic import Field
from pydantic import field_validator
from ... | proxystore/taps | taps/apps/configs/failures.py | .py | faf358e428531c2f | 7.56 | 12 |
from __future__ import annotations
import pathlib
from typing import Literal
from pydantic import Field
from pydantic import field_validator
from taps.apps import App
from taps.apps import AppConfig
from taps.plugins import register
@register('app')
class MoldesignConfig(AppConfig):
"""Moldesign application co... | proxystore/taps | taps/apps/configs/moldesign.py | .py | ac6718f78ceb9fc3 | 7.56 | 12 |
from __future__ import annotations
import pathlib
from typing import Literal
from pydantic import Field
from taps.apps import App
from taps.apps import AppConfig
from taps.plugins import register
@register('app')
class MontageConfig(AppConfig):
"""Montage application configuration."""
name: Literal['monta... | proxystore/taps | taps/apps/configs/montage.py | .py | bbe7fcf0542e6f7d | 7.56 | 12 |
from __future__ import annotations
import logging
import os
import pathlib
import shutil
import subprocess
import uuid
from time import monotonic
import pandas as pd
from taps.apps.docking.train import run_model
from taps.apps.docking.train import train_model
from taps.engine import as_completed
from taps.engine imp... | proxystore/taps | taps/apps/docking/app.py | .py | e3649d702e8e047f | 7.56 | 12 |
"""Data download CLI for the docking app."""
from __future__ import annotations
import argparse
import pathlib
import sys
from typing import Sequence
import requests
REPO = 'https://raw.githubusercontent.com/Parsl/parsl-docking-tutorial/1460cb2d79c4660cfc7144c394606fd101e272e6'
FILES = {
'1iep_receptor.pdbqt': ... | proxystore/taps | taps/apps/docking/data.py | .py | b4e23bebb9cfaaec | 7.56 | 12 |
"""Protein docking model training.
Module adapted from [ParslDock](https://github.com/Parsl/parsl-docking-tutorial/blob/1460cb2d79c4660cfc7144c394606fd101e272e6/ml_functions.py).
"""
from __future__ import annotations
import numpy
import pandas
from numpy.typing import NDArray
from sklearn.base import BaseEstimator
... | proxystore/taps | taps/apps/docking/train.py | .py | 0413cda65e1637a5 | 7.56 | 12 |
from __future__ import annotations
import functools
import logging
import pathlib
import random
from typing import Any
from typing import Callable
from typing import cast
from typing import ParamSpec
from typing import TypeVar
from taps.apps import AppConfig
from taps.apps.failures.types import FAILURE_FUNCTIONS
from... | proxystore/taps | taps/apps/failures/app.py | .py | d6c3aa336a393d34 | 7.56 | 12 |
from __future__ import annotations
import enum
import logging
import os
import random
import signal
import sys
import tempfile
if sys.version_info >= (3, 11): # pragma: >=3.11 cover
from typing import Self
else: # pragma: <3.11 cover
from typing_extensions import Self
import psutil
logger = logging.getLog... | proxystore/taps | taps/apps/failures/types.py | .py | df1618f6c5e7f7ba | 7.56 | 12 |
from __future__ import annotations
import pathlib
import torch
import torchvision
from torch import nn
from torch.nn import functional as F # noqa: N812
from torch.utils.data import Dataset
from torchvision import transforms
from taps.apps.fedlearn.types import DataChoices
class CifarModule(nn.Module):
"""Cif... | proxystore/taps | taps/apps/fedlearn/modules.py | .py | 0d170e89f7d6039a | 7.56 | 12 |
from __future__ import annotations
import logging
import math
import pathlib
import random
import shutil
import string
from collections import Counter
from typing import Generator
from typing import TypeVar
from taps.engine import Engine
from taps.engine import task
from taps.logging import APP_LOG_LEVEL
T = TypeVar... | proxystore/taps | taps/apps/mapreduce.py | .py | 8b81174510bebf16 | 7.56 | 12 |
from __future__ import annotations
import logging
import pathlib
import time
import numpy
import pandas
from matplotlib import pyplot as plt
from taps.apps.moldesign.tasks import combine_inferences
from taps.apps.moldesign.tasks import compute_vertical
from taps.apps.moldesign.tasks import run_model
from taps.apps.m... | proxystore/taps | taps/apps/moldesign/app.py | .py | 5f96b29dd8a9534a | 7.56 | 12 |
from __future__ import annotations
import logging
import pathlib
import pandas as pd
from taps.engine import Engine
from taps.engine import task
from taps.engine import wait
from taps.logging import APP_LOG_LEVEL
logger = logging.getLogger(__name__)
def configure_montage(
img_folder: pathlib.Path,
img_tbl... | proxystore/taps | taps/apps/montage.py | .py | 4847f4c59bf3968d | 7.56 | 12 |
from __future__ import annotations
import logging
import math
import pathlib
import random
import sys
import time
from dataclasses import dataclass
import matplotlib.pyplot as plt
import numpy
import pybullet
import pybullet_data
from noise import pnoise2
from numpy.typing import NDArray
from scipy.ndimage import gau... | proxystore/taps | taps/apps/physics.py | .py | 6049ecd5d135a418 | 7.56 | 12 |
from __future__ import annotations
import logging
import pathlib
import random
import sys
import time
import uuid
from taps.apps.configs.synthetic import WorkflowStructure
from taps.engine import as_completed
from taps.engine import Engine
from taps.engine import task
from taps.engine import TaskFuture
from taps.engi... | proxystore/taps | taps/apps/synthetic.py | .py | 453aa6ec0bcfe720 | 7.56 | 12 |
from __future__ import annotations
import dataclasses
import functools
import socket
import time
from dataclasses import field
from typing import Any
from typing import Callable
from typing import Generic
from typing import overload
from typing import ParamSpec
from typing import Protocol
from typing import runtime_ch... | proxystore/taps | taps/engine/task.py | .py | 5300af95eb2eb3af | 7.56 | 12 |
from __future__ import annotations
import logging
import sys
from types import TracebackType
from typing import Any
from typing import Generic
from typing import Iterable
from typing import Mapping
if sys.version_info >= (3, 11): # pragma: >=3.11 cover
from typing import Self
else: # pragma: <3.11 cover
fro... | proxystore/taps | taps/engine/transform.py | .py | 96791f81d0724203 | 7.56 | 12 |
from __future__ import annotations
import abc
from concurrent.futures import Executor
from pydantic import BaseModel
from pydantic import ConfigDict
class ExecutorConfig(abc.ABC, BaseModel):
"""Abstract [`Executor`][concurrent.futures.Executor] plugin configuration.""" # noqa: E501
name: str
model_co... | proxystore/taps | taps/executor/_protocol.py | .py | a38c383c2af7fa8e | 7.56 | 12 |
from __future__ import annotations
import logging
from concurrent.futures import Executor
from concurrent.futures import Future
from typing import Any
from typing import Callable
from typing import cast
from typing import Generator
from typing import Iterable
from typing import Iterator
from typing import Literal
from... | proxystore/taps | taps/executor/dask.py | .py | 6fee76a14d2a9347 | 7.56 | 12 |
from __future__ import annotations
from typing import Literal
import globus_compute_sdk
from pydantic import Field
from taps.executor import ExecutorConfig
from taps.executor.utils import FutureDependencyExecutor
from taps.plugins import register
@register('executor')
class GlobusComputeConfig(ExecutorConfig):
... | proxystore/taps | taps/executor/globus.py | .py | ba4aa5caa8d79add | 7.56 | 12 |
from __future__ import annotations
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
from concurrent.futures import ThreadPoolExecutor
from typing import Literal
from pydantic import Field
from taps.executor import ExecutorConfig
from taps.executor.utils import FutureDependencyExecutor
from t... | proxystore/taps | taps/executor/python.py | .py | d5cc1ec09bcbf703 | 7.56 | 12 |
from __future__ import annotations
from concurrent.futures import Executor
from concurrent.futures import Future
from typing import Any
from typing import Callable
from typing import Literal
from typing import ParamSpec
from typing import TypeVar
try:
import ray
RAY_IMPORT_ERROR = None
except ImportError as ... | proxystore/taps | taps/executor/ray.py | .py | 1096d8a50ea7b659 | 7.56 | 12 |
from __future__ import annotations
import inspect
import logging
import sys
import time
from typing import Any
from typing import Callable
from typing import Generator
from typing import Iterable
from typing import Iterator
from typing import Literal
from typing import ParamSpec
from typing import TypeVar
from pydant... | proxystore/taps | taps/executor/taskvine.py | .py | c4b32806d11c6537 | 7.56 | 12 |
from __future__ import annotations
import functools
import itertools
import logging
import socket
import sys
import threading
import time
from concurrent.futures import Executor
from concurrent.futures import Future
from types import TracebackType
from typing import Any
from typing import Callable
from typing import G... | proxystore/taps | taps/executor/utils.py | .py | d0bdab63e9105190 | 7.56 | 12 |
from __future__ import annotations
import dataclasses
from typing import Any
from typing import BinaryIO
import tomli_w
from tosholi.protocols import DataClassProtocol
def _scrub(obj: Any) -> None:
# https://stackoverflow.com/a/20692955
if isinstance(obj, dict):
for key in list(obj.keys()):
... | gpauloski/tosholi | tosholi/format.py | .py | 5f04bb79a35f63a6 | 7.45 | 7 |
from __future__ import annotations
import dataclasses
import datetime
import types
import typing
from collections import defaultdict
from tosholi.protocols import DataClassProtocol
TomlTypes = {
# Primitive types
str,
int,
float,
bool,
datetime.datetime,
Ellipsis,
# Container types
... | gpauloski/tosholi | tosholi/validate.py | .py | 54ca2793fab4828e | 7.45 | 7 |
"""Best-effort "a newer fiberhmm is on PyPI" reminder.
Design constraints (all of them matter):
* **stderr only.** Many tools stream a BAM to stdout (``-o -``); a single byte
on stdout corrupts that stream. The reminder is written to ``sys.stderr``
exclusively.
* **Silent on failure.** Offline, PyPI down, slow DN... | fiberseq/FiberHMM | fiberhmm/_update_check.py | .py | 64bda0c55e57d7d8 | 7.52 | 10 |
"""Shared argparse argument factories for FiberHMM CLI tools.
Each function adds a group of related arguments to an ArgumentParser.
Default values can be overridden per-script where needed.
"""
import argparse
import sys
from typing import Optional
OBSERVATION_MODES = ('pacbio-fiber', 'nanopore-fiber', 'daf')
def ... | fiberseq/FiberHMM | fiberhmm/cli/common.py | .py | 51289a7a71445930 | 7.52 | 10 |
#!/usr/bin/env python3
"""CLI entry point for fiberhmm-daf-encode.
Reads a plain aligned BAM, identifies C->T / G->A deamination mismatches,
and encodes them as IUPAC Y/R with an st:Z tag for DAF-seq calling.
"""
import argparse
from fiberhmm.cli.common import add_version_args
from fiberhmm.daf.encoder import proces... | fiberseq/FiberHMM | fiberhmm/cli/daf_encode.py | .py | 5b29c9a1f1ba18c8 | 7.52 | 10 |
"""Stage helpers for fused HMM apply plus TF recall inference."""
from __future__ import annotations
from typing import Any, Mapping, Optional, Sequence
import numpy as np
from fiberhmm.inference.circular import (
project_center_nuc_calls,
project_center_runs,
project_center_tf_calls,
split_interval... | fiberseq/FiberHMM | fiberhmm/inference/fused_stages.py | .py | 59389888d55e0d80 | 7.52 | 10 |
"""Shared read skip/filter policy for inference pipelines."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import AbstractSet, Optional
@dataclass(frozen=True)
class ReadFilterConfig:
"""Filtering options shared by streaming inference paths."""
min_mapq: int = 0
... | fiberseq/FiberHMM | fiberhmm/inference/read_filters.py | .py | 7d6148d082f9c24d | 7.52 | 10 |
"""Genome region planning helpers for region-parallel inference."""
from __future__ import annotations
import re
from typing import Optional, Set
import pysam
def _is_main_chromosome(chrom: str) -> bool:
"""
Check if a chromosome name is a main chromosome (not a scaffold/contig).
Returns True for:
... | fiberseq/FiberHMM | fiberhmm/inference/region_planning.py | .py | 3738d357c767422b | 7.52 | 10 |
"""FiberHMM footprint statistics and QC plotting."""
import numpy as np
import pysam
from fiberhmm.io.ma_tags import flip_intervals_to_seq
class FootprintStats:
"""Collects footprint statistics from sampled reads."""
def __init__(self):
self.footprint_sizes = []
self.gap_sizes = [] # gaps... | fiberseq/FiberHMM | fiberhmm/inference/stats.py | .py | 53762116479a913f | 7.52 | 10 |
"""Multiprocessing worker entry points for streaming inference pipelines."""
from __future__ import annotations
import numpy as np
from fiberhmm.core.model_io import freeze_model_for_inference, load_model
from fiberhmm.inference.engine import (
CHIMERA_SKIP,
_process_single_read,
configure_daf_chimera_fi... | fiberseq/FiberHMM | fiberhmm/inference/streaming_workers.py | .py | 91d1f3d85c0e8a64 | 7.52 | 10 |
"""Shared annotation/tag writing helpers for inference pipelines."""
from __future__ import annotations
import array as pyarray
from typing import Optional, Sequence, Tuple
import numpy as np
from fiberhmm.inference.circular import circular_intervals_overlap
from fiberhmm.inference.tf_recaller import TFCall, write_... | fiberseq/FiberHMM | fiberhmm/inference/tagging.py | .py | 5a78e4e309eb1a7e | 7.52 | 10 |
"""Small result containers shared by multiprocessing worker drains."""
from typing import NamedTuple, Tuple
class WorkerChunkResult(NamedTuple):
"""Per-chunk worker output plus failures hidden behind pass-through reads."""
results: list
read_failures: int = 0
def coerce_worker_chunk_result(value) -> T... | fiberseq/FiberHMM | fiberhmm/inference/worker_results.py | .py | 338ae0ea7de53ad9 | 7.52 | 10 |
from pathlib import Path
from PIL import Image
from nonebot import logger
from .utils import resize_img
from .utils import svg_to_png
from .models import Band
from .models import Star
from .models import Attribute
from .downloader import AsyncDownloader
BAND_URL = "https://bestdori.com/res/icon/band_{}.svg"
CARD_URL... | Kasumi-Games/kasumi-next | plugins/bang_avatar/initialize.py | .py | a4fa0a16cf7d2188 | 7.56 | 12 |
from pathlib import Path
from PIL import Image
from nonebot import get_plugin_config
from nonebot.adapters.satori import MessageSegment
from utils.images import image_segment
from utils.image_tasks import run_image_task
from .utils import paste_img
from .utils import resize_img
from .utils import circle_corner
from ... | Kasumi-Games/kasumi-next | plugins/bang_avatar/render.py | .py | 4aef48e6f24063c1 | 7.56 | 12 |
from io import BytesIO
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFilter
from aiohttp import ClientSession
from nonebot.adapters.satori import MessageSegment
from utils.images import image_segment
from utils.image_tasks import run_image_task
def _decode_image(payload: bytes) -> Image.Image... | Kasumi-Games/kasumi-next | plugins/bang_avatar/utils.py | .py | 0fc1f18e06e4115a | 7.56 | 12 |
from nonebot import require
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
require("nonebot_plugin_localstore")
import nonebot_plugin_localstore as store # noqa: E402
from .models import Base # noqa: E402
# Database path
database_path = store.get_data_file("blackjack", "games.db")
#... | Kasumi-Games/kasumi-next | plugins/blackjack/database.py | .py | d4b863e91cc93b56 | 7.56 | 12 |
"""
Blackjack game database service for storing and retrieving game records.
"""
import time
from typing import List
from typing import Optional
from .models import GameResult
from .models import BlackjackGame
from .database import get_session
class BlackjackGameService:
"""Service class for handling blackjack ... | Kasumi-Games/kasumi-next | plugins/blackjack/game_service.py | .py | 97575b40b6b467b3 | 7.56 | 12 |
import random
from enum import StrEnum
from typing import List
from sqlalchemy import Column
from sqlalchemy import String
from sqlalchemy import Integer
from sqlalchemy.ext.declarative import declarative_base
# Database base class
Base = declarative_base()
suits = ("powerful", "cool", "happy", "pure")
number_ranks ... | Kasumi-Games/kasumi-next | plugins/blackjack/models.py | .py | ae2ceb5a7cb01f16 | 7.56 | 12 |
"""The stats card — what ``/黑香澄统计`` replies with.
One themed card replaces the emoji text block and the unthemed matplotlib
chart the command used to send: the Tier A identity strip on top, a record
panel (hands, wins/losses/pushes, BlackJack count, net profit) closed by the
win-rate meter, and a Pt ledger panel (tota... | Kasumi-Games/kasumi-next | plugins/blackjack/stats_render.py | .py | 5ae99fa55296fcec | 7.56 | 12 |
"""
Blackjack game statistics service for analyzing player game data.
The former ``create_win_loss_chart`` matplotlib figure is gone: ``/黑香澄统计``
now answers with the themed card in ``stats_render``, so this module is pure
data assembly.
"""
from typing import List
from dataclasses import dataclass
from .models impor... | Kasumi-Games/kasumi-next | plugins/blackjack/stats_service.py | .py | 6ad996e0c3985663 | 7.56 | 12 |
import random
from PIL import Image
from PIL import ImageEnhance
from nonebot.adapters.satori import MessageSegment
from utils.images import image_segment
def image_to_message(image: Image.Image) -> MessageSegment:
"""
将 Image 对象转换为 MessageSegment 对象
参数:
image (Image.Image): Image 对象
返回:
... | Kasumi-Games/kasumi-next | plugins/cck/draw.py | .py | e6848e14a3c5ca59 | 7.56 | 12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.