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 typing import Self from .individual import Individual class Population: """Object to store individuals. The individuals used during the run can be stored in the population, like a list. Additionally, the object has the attribute :attr:`generation`. Whenever new individuals are assigned the gene...
OHANAN1/fucrimodo
src/fucrimodo/core/population.py
.py
f9858d4c47bafd37
7.24
2
import numpy as np from ase.cell import Cell from ase_ga.utilities import CellBounds from ..individual import Individual class CustomCellBounds: """Define and check the max/min allowed size of a unitcell. This class works like :class:`ase_ga.utilities.CellBounds` from the `ASE library <https://github.com/dt...
OHANAN1/fucrimodo
src/fucrimodo/core/utils/cellbounds_custom.py
.py
2c21655d6abaa352
7.24
2
import ase import numpy as np from ase import data as ase_data from ase_ga import utilities as ase_utilities from ..individual import Individual class CustomClosestDistances(dict[tuple[int, int], float]): """Check if atoms are too close to each other based on coval radii. This class works like :meth:`ase_ga...
OHANAN1/fucrimodo
src/fucrimodo/core/utils/closest_distances_class.py
.py
fce9761ab374760d
7.24
2
from collections.abc import Sequence import numpy as np from ..abstracts.fitness_function import FitnessFunction from ..individual import Individual from ..population import Population def _seperate_fitness_and_weights( fitness_functions: ( Sequence[FitnessFunction | tuple[FitnessFunction, float]] | Fit...
OHANAN1/fucrimodo
src/fucrimodo/core/utils/fitness_utils.py
.py
fb6d5b595c9bbee2
7.24
2
import warnings import ase import numpy as np from ase import data as ase_data from ase_ga import utilities as ase_utilities warnings.warn( "Please do not use the legacy ClosestDistancesClass. It contains minor bugs." ) def parallelepiped_heights( a: np.ndarray | list[float], b: np.ndarray | list[float]...
OHANAN1/fucrimodo
src/fucrimodo/core/utils/legacy_closest_distances_class.py
.py
c335f3a48e5c9752
7.24
2
import shutil import subprocess def get_last_commit_msg(run_path: str) -> str: """Returns the last commit message of the specified git repo. This can be used to set the description of the :class:`MultiStageSearch` automatically to the last commit message. :run_path: Path to dir, where git command sh...
OHANAN1/fucrimodo
src/fucrimodo/core/utils/reproducability.py
.py
a7e17b5e1629c2c4
7.24
2
import pandas as pd from ...analysis.utils import load_dict_from_file def load_ga_stage_attributes( dir_path: str, info_dict: dict, ) -> dict: """Return a dictionary with attributes specific to the stage type. :return: Mapping with keys: * ``parent_selection``: name of the parent selection ...
OHANAN1/fucrimodo
src/fucrimodo/customs/ga_stage/analysis.py
.py
db4d6ae9da7dec30
7.24
2
import json import os from typing import Any, Callable, Sequence import numpy as np from ase.db.core import Database from deap import tools from ...core import Individual, Population from ...core.abstracts import FitnessFunction, PopulationSelection, Stage from ..break_conditions import BreakCondition from .crossover...
OHANAN1/fucrimodo
src/fucrimodo/customs/ga_stage/ga_stage.py
.py
c6805381866ff5f5
7.24
2
import ase.data as ase_data import ase_ga.standardmutations as ase_standard_mut import numpy as np from ....core import Individual from ....core.utils import CustomClosestDistances from ...utils import LegacyRNGAdapter from .abstract import Mutation class ReplaceAtomsMutation(Mutation): """ Replace atoms in ...
OHANAN1/fucrimodo
src/fucrimodo/customs/ga_stage/mutations/element_mutations.py
.py
3583fba07469493a
7.24
2
from ase_ga import soft_mutation as ase_soft_mut from ....core import Individual from .abstract import Mutation class SoftMutation(Mutation): """ Apply a soft mutation to the individual using the ASE soft mutation. The mutation is deterministic, so ``max_retries`` is set to ``1``. The individual's `...
OHANAN1/fucrimodo
src/fucrimodo/customs/ga_stage/mutations/energy_optimisation_mutations.py
.py
3d89d8eff17e4588
7.24
2
import ase_ga.standardmutations as ase_standard_mut import numpy as np from ....core import Individual from ....core.utils.closest_distances_class import CustomClosestDistances from .abstract import Mutation class RattleMutation(Mutation): """ Randomly displace a subset of atoms. ``n_top`` atoms are sel...
OHANAN1/fucrimodo
src/fucrimodo/customs/ga_stage/mutations/position_mutations.py
.py
84641bff2ca86a11
7.24
2
# TODO: Fix weird error # ^- Wow, nobody wants to read such a thing... # I forgot the bug, so here is a seahorse: # # \/)/) # _' oo(_.-. # /'. .---' # /'-./ ( # ) ; __\ # \_.'\ : __| # ) _/ # ( (,. # mrf'-.-' # import matid import numpy as np from ....core import In...
OHANAN1/fucrimodo
src/fucrimodo/customs/ga_stage/mutations/symmetry_mutations.py
.py
d000cd317179c645
7.24
2
import warnings from typing import Literal, overload import ase import numpy as np from ase.data import chemical_symbols from dscribe.descriptors import SOAP from numpy.typing import NDArray from fucrimodo.core import Individual class GlobalSOAP: """Wrapper for :class:`dscribe.descriptors.SOAP` that produces gl...
OHANAN1/fucrimodo
src/fucrimodo/customs/global_soap_target.py
.py
aa37a6fcf4e1693e
7.24
2
# -*- coding: utf-8 -*- import os import pytest from omnicli.errors import ( ArgListMissingError, InvalidBooleanValueError, InvalidFloatValueError, InvalidIntegerValueError, ) from omnicli import parse_args @pytest.fixture def clean_env(): """Remove all OMNI_ARG related environment variables befor...
omnicli/sdk-python
tests/test_argparser.py
.py
98b6e7a5c92f59ac
7.5
0
from typing import TYPE_CHECKING import click from app.models.allowed_refresh_token import AllowedRefreshToken from app.services.maintenance_service import purge_abandoned_guests if TYPE_CHECKING: from flask import Flask from app.extensions import assets_env from app.services.maintenance_service import ( pur...
ImanuelBertrand/cinetag.it
app/cli.py
.py
5d37b458e0340bb3
7
0
import os from urllib.parse import urlparse, urlunparse def _build_test_db_uri() -> str | None: """Always return a URI pointing at a dedicated test database. Priority: 1. TEST_DATABASE_URI env var (explicit override) 2. DATABASE_URI env var with the db name suffixed with '_test' Never falls back...
ImanuelBertrand/cinetag.it
app/config.py
.py
1aa79d3d60d0f31e
7
0
import base64 from apscheduler.executors.pool import ThreadPoolExecutor from flask import current_app, request from flask_apscheduler import APScheduler from flask_assets import Bundle, Environment from flask_babel import Babel from flask_bcrypt import Bcrypt from flask_caching import Cache from flask_jwt_extended imp...
ImanuelBertrand/cinetag.it
app/extensions.py
.py
4b5df0e0185dbde5
7
0
from __future__ import annotations import logging from datetime import UTC, datetime from typing import TYPE_CHECKING from sqlalchemy import DateTime, ForeignKey, String from sqlalchemy.orm import Mapped, backref, mapped_column, relationship from app.extensions import db _logger = logging.getLogger(__name__) if TY...
ImanuelBertrand/cinetag.it
app/models/allowed_refresh_token.py
.py
0b64e37eb1fd7c2d
7
0
from __future__ import annotations from datetime import UTC, datetime from sqlalchemy import CheckConstraint, DateTime, ForeignKey, Index from sqlalchemy.orm import Mapped, backref, mapped_column, relationship from app.extensions import db from app.models.user import User class Friendship(db.Model): """ Re...
ImanuelBertrand/cinetag.it
app/models/friendship.py
.py
98cc36e19671c898
7
0
from __future__ import annotations from datetime import UTC, datetime from typing import TYPE_CHECKING import sqlalchemy import sqlalchemy.exc from sqlalchemy import DateTime, String from sqlalchemy.orm import Mapped, mapped_column, relationship from app.extensions import db from app.models.user_calendar import User...
ImanuelBertrand/cinetag.it
app/models/user.py
.py
2f0b5c528aaca102
7
0
import secrets from datetime import UTC, datetime from typing import TYPE_CHECKING, Self from sqlalchemy import DateTime, ForeignKey, Index, String from sqlalchemy.orm import Mapped, mapped_column, relationship from app.extensions import db if TYPE_CHECKING: from app.models.user import User class UserCalendar(...
ImanuelBertrand/cinetag.it
app/models/user_calendar.py
.py
7ad0d33f44aa2997
7
0
import atexit import fcntl import logging import os from datetime import UTC, datetime from functools import partial from typing import Any, cast from app.extensions import scheduler from app.models.allowed_refresh_token import AllowedRefreshToken from app.services.backup_service import run_backup_if_due from app.serv...
ImanuelBertrand/cinetag.it
app/scheduler.py
.py
84c8ce25d29d77db
7
0
import logging from app.extensions import db from app.models.friend_request import FriendRequest from app.models.friendship import Friendship from app.models.user import User _logger = logging.getLogger(__name__) # Uniform "request sent" response. Returned for both a genuine send and an # unknown friend code so an a...
ImanuelBertrand/cinetag.it
app/services/friend_service.py
.py
10bd4405a0359969
7
0
import contextlib import http import logging import os import re import time import uuid from typing import Any import requests from flask import current_app from PIL import Image from app.errors import ImageFetchError _logger = logging.getLogger(__name__) # Rungs span the real render sizes: ~200px (smallest deskto...
ImanuelBertrand/cinetag.it
app/services/image_service.py
.py
fd9fafe37c7e71fc
7
0
import secrets from pathlib import Path def load_words(filename: str) -> list[str]: """ Load words from a data file Args: filename (str): Name of the file to load Returns: list: List of words from the file """ data_dir = Path(__file__).parent.parent / "data" file_path = d...
ImanuelBertrand/cinetag.it
app/utils/friend_code.py
.py
211f623f645e44c9
7
0
"""Helpers for rotating HMAC signing keys without invalidating live tokens. A token is signed with the primary key and stamped with a `kid` header that matches the current key id. On decode, tokens whose `kid` matches the current id are verified with the primary key; everything else (including tokens with no `kid` pre...
ImanuelBertrand/cinetag.it
app/utils/jwt_keys.py
.py
bb81afe6bad10187
7
0
import json import logging from collections import defaultdict from datetime import UTC, datetime, timedelta from typing import TYPE_CHECKING, Any from babel.dates import format_date from flask import url_for from app.errors import WebPushSubscriptionExpiredError from app.extensions import db from app.models.movie_re...
ImanuelBertrand/cinetag.it
app/utils/notifications.py
.py
fc0df495b563c8ab
7
0
import logging import time from collections import defaultdict from functools import wraps from typing import Any, Self _logger = logging.getLogger(__name__) def profile_function(func): """ Decorator to profile a function's execution time. """ @wraps(func) def wrapper(*args: Any, **kwargs: Any):...
ImanuelBertrand/cinetag.it
app/utils/profiler.py
.py
154bd42a4063ab37
7
0
"""Generate docs/rankedstats/brawler_classes.js from the live BrawlAPI brawler list. This is a maintainer-run, build-time generator — it is never invoked from the browser at page load. Run it manually whenever Supercell ships new brawlers (or whenever BrawlAPI backfills a previously-"Unknown" class), and commit the re...
simholmen/BrawlStarsNorgeWiki
rankedstats/gen_brawler_classes.py
.py
2900a3f9df270d58
7.15
1
"""Load the roster of tracked players from docs/_personer/*.md front matter. Mirrors the front-matter parsing approach used in winratefetching/extract_names_and_tags.py (find the `---` fence pair, then yaml.safe_load the block between the fences) without importing from that folder, so rankedstats/ stays self-contained...
simholmen/BrawlStarsNorgeWiki
rankedstats/roster.py
.py
d06ab7b61e714042
7.15
1
"""Pure set-grouping logic for Brawl Stars Ranked (soloRanked) battlelogs. No network calls, no database access, no file writes. Every function here takes plain Python data (dicts/lists straight out of parsed battlelog JSON) and returns plain Python data, so it can be exercised directly by ``rankedstats/test_sets.py``...
simholmen/BrawlStarsNorgeWiki
rankedstats/sets.py
.py
866b08c85b013866
7.15
1
"""Thin PostgREST wrapper for the Supabase project backing Ranked Stats. Env loading mirrors the approach used in rankedstats/bs_api.py's `load_api_key`: the environment variable takes precedence, falling back to a manual line-by-line parse of the repo root `.env`, with no extra env-file-parsing dependency added. Both...
simholmen/BrawlStarsNorgeWiki
rankedstats/supa.py
.py
be5ea79170add5fb
7.15
1
"""In-memory fallback for the MongoDB collection. Implements the small subset of the pymongo collection API this bot uses so the app can run without a MongoDB instance. State lives in a plain dict keyed by the document's ``_id`` and is lost when the process exits. Supported operations: - find_one(filter) - fi...
nub-coders/zipper
memory_db.py
.py
47c7ee1f7302b24d
7
0
"""Safe archive extraction and inspection (audit findings Z-02, Z-07, Z-06). Design notes ------------ Archive metadata is attacker-controlled, so nothing declared in a header is trusted. Two independent defences: 1. **Limits are enforced during extraction, not after.** The previous code summed the declared ``Size...
nub-coders/zipper
safe_archive.py
.py
599da2dde492366c
7
0
"""Filesystem path safety for user-supplied names. SECURITY CRITICAL. Every filesystem path derived from user-controlled input (Telegram filename attributes, chat messages, URLs, archive members) must be built through :func:`resolve_in_user_dir`. Nothing else may join user data onto a path. Threat model: a name is fu...
nub-coders/zipper
safe_paths.py
.py
eba9d47caaa811ad
7
0
from datetime import datetime import time from typing import Dict, Any from config import collection _STAT_KEYS = ("files_sent", "zip_with_pass", "zip_without_pass", "external_uploads") def _today_start() -> int: """Return the start-of-day timestamp for the current date.""" return int(time.mktime(datetime.no...
nub-coders/zipper
stats_manager.py
.py
b0549d345f41bdb8
7
0
"""tests/test_async_compression.py — Non-blocking Compression and Admin Utilities Test Suite.""" import asyncio import os import pytest from unittest.mock import AsyncMock, MagicMock, patch from tools import Timer, get_admin_ids, is_admin, create_zip_file from plugins.admin_handlers import _get_admin_broadcast_state, ...
nub-coders/zipper
tests/test_async_compression.py
.py
de830f7bee258d2c
7.5
0
"""tests/test_extraction.py — Safe Archive Extraction and Lifetime Scope Test Suite.""" import asyncio import os import tempfile import zipfile import pytest from unittest.mock import AsyncMock, MagicMock, patch from safe_archive import ( ArchiveError, ArchiveFailed, ArchiveTimeout, ArchiveTooLarge, ...
nub-coders/zipper
tests/test_extraction.py
.py
838137ece7764bf7
7.5
0
"""tests/test_quota_limits.py — Storage Quota Calculation and Batch Queue Limiting Test Suite.""" import pytest import config from unittest.mock import AsyncMock, MagicMock, patch from batch_manager import ( MAX_BATCH_QUEUE, enqueue_media_message, enqueue_link_message, get_user_batch, cancel_user_b...
nub-coders/zipper
tests/test_quota_limits.py
.py
a2bb00c74831c0bc
7.5
0
"""tests/test_rich_ui.py — Test suite for Bot API 10.2 & 10.3 Rich UI features and fallbacks in Zipper Bot.""" import pytest from pyrogram.enums import ButtonStyle from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, InputRichMessage from utils.emoji import Emoji, EmojiTag from utils.premium_emoji im...
nub-coders/zipper
tests/test_rich_ui.py
.py
6d90a38f722f647a
7.5
0
"""tests/test_ssrf_bypass.py — SSRF Protection and IPv4-Mapped IPv6 Test Suite.""" import ipaddress import socket import pytest from unittest.mock import AsyncMock, patch, MagicMock from safe_download import ( _is_blocked_ip, _validate_url_target, _validate_url_target_sync, safe_download, safe_head...
nub-coders/zipper
tests/test_ssrf_bypass.py
.py
ca18f9551650ed2f
7.5
0
class BitString: """ Stores the message data bits that we have yet to parse and lets us read arbitrary-length bits from the front. We need to operate at the bit level since some fields are non-byte-aligned (eg. DEBUG_MSG's 4-bit DEBUG_LEVEL and DEBUG_MSG's 12-bit LINE_NUM) """ def __init__(self,...
waterloo-rocketry/parsley
src/parsley/bitstring.py
.py
334cd1baee373ec6
7.15
1
from __future__ import annotations from typing import Any, Literal import struct Number = int | float class Field: """ Abstract base class for all fields that can be transcoded. Note: data is assumed to be LSB-aligned to match the implementation of BitString. """ def __init__(self, name: str, le...
waterloo-rocketry/parsley
src/parsley/fields.py
.py
2827a6d84deed6c9
7.15
1
''' Contains the new static class implementation of Parsley.py ''' from collections.abc import Iterator from typing import Any from parsley.parsley_message import ParsleyObject, ParsleyError from parsley.bitstring import BitString from parsley.message_definitions import CAN_MESSAGE, MESSAGE_PRIO, MESSAGE_TYPE, BOARD_TY...
waterloo-rocketry/parsley
src/parsley/parse_to_object.py
.py
10d34d70238890c1
7.15
1
import crc8 # pyright: ignore[reportMissingTypeStubs] from collections.abc import Iterator from typing import Any import struct from parsley.bitstring import BitString from parsley.fields import Field from parsley.message_definitions import MESSAGE_SID from deprecated import deprecated from parsley.parse_to_object imp...
waterloo-rocketry/parsley
src/parsley/parsley.py
.py
e5f7ace2bcc6aa34
7.15
1
import pytest import parsley from pytest import approx from parsley.bitstring import BitString from parsley.fields import ASCII, Enum, Numeric, Floating, Bitfield from parsley.message_definitions import TIMESTAMP_2, MESSAGES import parsley.message_types as mt class TestCANMessage: """ We are testing only the...
waterloo-rocketry/parsley
tests/test_message_definitions.py
.py
2af278bd49217670
7.65
1
#!/usr/bin/env python3 """ Script that downloads backup files from Tasmota Devices as listed in the config file """ __author__ = "saurabh Datta" __version__ = "0.1.0" __license__ = "MIT" import time from datetime import datetime import json import urllib.request import os curr_dir = os.path.join(os.path.dirname(__fi...
dattasaurabh82/IoTDevicesBackup
app.py
.py
080b2216a6769419
7.15
1
"""Validate committed capability negotiation evidence.""" from __future__ import annotations import json from pathlib import Path from typing import Any from PermutiveAPI.capabilities import capability_contract_manifest CONTRACT_PATH = Path("capabilities/contract-v1.json") def validate_capability_contract(path: P...
fatmambot33/PermutiveAPI
scripts/validate_capability_contract.py
.py
0b098b4f55ac7d3c
7.3
3
"""Validate committed first-success evidence and execute the budget gate.""" from __future__ import annotations import json from pathlib import Path from typing import Any from PermutiveAPI.first_success import ( first_success_contract, measure_first_success, ) CONTRACT_PATH = Path("metrics/first-success-v1...
fatmambot33/PermutiveAPI
scripts/validate_first_success.py
.py
bf2895e00e73028c
7.3
3
"""Compile and execute the canonical PermutiveAPI recipe catalog.""" from __future__ import annotations import importlib.util from typing import Any from PermutiveAPI.recipes import RecipeCategory, recipe_catalog def validate_recipes() -> tuple[int, int]: """Compile every recipe and execute recipes with instal...
fatmambot33/PermutiveAPI
scripts/validate_recipes.py
.py
da6cf4759c634b59
7.3
3
"""Validate committed governed-scenario recipes and HTTP fixtures.""" from __future__ import annotations import json from pathlib import Path from PermutiveAPI.scenario_fixtures import scenario_fixture_catalog from PermutiveAPI.scenarios import scenario_recipe_catalog def _load(path: Path) -> object: """Load o...
fatmambot33/PermutiveAPI
scripts/validate_scenario_evidence.py
.py
97d2848fe814aba0
7.3
3
"""Agent-facing integration helpers built on the neutral tool registry.""" from __future__ import annotations from typing import Any, Mapping, Sequence from .ai_native import ( AgentWorkflowRunner, AuditSink, ExecutionPolicy, GovernedToolExecutor, InvocationContext, InvocationResult, Work...
fatmambot33/PermutiveAPI
src/PermutiveAPI/agent.py
.py
3983d7eded24cc55
7.3
3
"""Governed execution primitives for AI-native Permutive workflows.""" from __future__ import annotations import hashlib import json from dataclasses import dataclass, field from datetime import datetime, timezone from enum import Enum from typing import Any, Callable, Mapping, Sequence from .actionable_errors impor...
fatmambot33/PermutiveAPI
src/PermutiveAPI/ai_native.py
.py
97731c6f93917140
7.3
3
"""Typed asynchronous Permutive API client and parity helpers.""" from __future__ import annotations import asyncio from typing import ( Any, AsyncIterator, Awaitable, Callable, Dict, Generic, List, Mapping, Optional, Protocol, Sequence, Tuple, TypeVar, cast, ) ...
fatmambot33/PermutiveAPI
src/PermutiveAPI/async_client.py
.py
bc412b0a6e0555a0
7.3
3
"""Import management for the Permutive API.""" import logging from collections import defaultdict from dataclasses import dataclass, field from datetime import datetime, timezone from pathlib import Path from typing import ( Any, Callable, DefaultDict, Dict, Iterable, List, Optional, Tu...
fatmambot33/PermutiveAPI
src/PermutiveAPI/audience/imports.py
.py
cf965e23b10191a6
7.3
3
"""Versioned capability discovery and negotiation contracts.""" from __future__ import annotations from dataclasses import dataclass from importlib.metadata import PackageNotFoundError, version from typing import Mapping, Optional, Protocol, Tuple CAPABILITY_CONTRACT_VERSION = "1.0" TOOL_SCHEMA_VERSION = "1.0" CAPAB...
fatmambot33/PermutiveAPI
src/PermutiveAPI/capabilities.py
.py
691c81a3a5bec6aa
7.3
3
"""Local credential, validation, and lifecycle commands for PermutiveAPI.""" from __future__ import annotations import argparse import getpass import json import os import sys from pathlib import Path from typing import Dict, Optional, Sequence from dotenv import dotenv_values from .evaluations import run_default_e...
fatmambot33/PermutiveAPI
src/PermutiveAPI/cli.py
.py
8e005dc0af6d1b3f
7.3
3
"""Simple resource-oriented public client.""" from __future__ import annotations from functools import cached_property from .resource_registry import resource_definition from .resources import Resource from .sdk import JSONObject, PermutiveClient as TransportClient def _decode_object(payload: JSONObject) -> JSONOb...
fatmambot33/PermutiveAPI
src/PermutiveAPI/client.py
.py
65174c500e1effb2
7.3
3
"""Typed configuration shared by SDK integration surfaces.""" from __future__ import annotations import os from dataclasses import dataclass from typing import Mapping, Optional, Tuple, Union from urllib.parse import urlparse from .sdk import RetryPolicy @dataclass(frozen=True) class Secret: """Secret value wh...
fatmambot33/PermutiveAPI
src/PermutiveAPI/config.py
.py
64a3ff8ce815e886
7.3
3
"""Deterministic 6.8 consolidation evidence for public, resource, and integration contracts.""" from __future__ import annotations import hashlib import json from typing import Iterable from .capabilities import capability_contract_manifest from .integration_registry import integration_registry_manifest from .public...
fatmambot33/PermutiveAPI
src/PermutiveAPI/consolidation.py
.py
7bd4b602f45b691f
7.3
3
"""Context segmentation helpers for the Permutive API. This module wraps the Context API endpoint, allowing callers to submit a page URL and associated page properties to retrieve contextual segment matches. """ from __future__ import annotations from dataclasses import dataclass from typing import Any, Callable, Di...
fatmambot33/PermutiveAPI
src/PermutiveAPI/context.py
.py
330ce7cf61a1b634
7.3
3
"""Versioned endpoint coverage and structural response contracts.""" from __future__ import annotations import hashlib import json from dataclasses import dataclass from enum import Enum from typing import Mapping from .sdk import JSONValue API_CONTRACT_VERSION = 1 class ResponseKind(str, Enum): """Supported ...
fatmambot33/PermutiveAPI
src/PermutiveAPI/contracts.py
.py
25f7df82e58a98ee
7.3
3
"""Credential providers for local and plugin-driven SDK use.""" from __future__ import annotations import os from dataclasses import dataclass from pathlib import Path from typing import Mapping, Optional, Protocol, Sequence, Union from dotenv import dotenv_values class CredentialsError(RuntimeError): """Raise...
fatmambot33/PermutiveAPI
src/PermutiveAPI/credentials.py
.py
1a79a389382a713b
7.3
3
"""Measure installed-package time to a first successful canonical result.""" from __future__ import annotations import json import subprocess import sys import time from dataclasses import dataclass FIRST_SUCCESS_CONTRACT_VERSION = 1 FIRST_SUCCESS_BUDGET_SECONDS = 5.0 FIRST_SUCCESS_RECIPE = "workspace-inspection" ...
fatmambot33/PermutiveAPI
src/PermutiveAPI/first_success.py
.py
14959d239450bdc6
7.3
3
"""User identification helpers for the Permutive API.""" import logging from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple from dataclasses import dataclass from . import _API_ENDPOINT from .alias import Alias from requests import Response from ..utils import http from ..utils.http import Batch...
fatmambot33/PermutiveAPI
src/PermutiveAPI/identify/identify.py
.py
db1bb10e02755f27
7.3
3
"""Shared typed metadata for agent, plugin, MCP, and tool integration surfaces.""" from __future__ import annotations from dataclasses import dataclass from typing import Tuple INTEGRATION_REGISTRY_VERSION = 1 @dataclass(frozen=True) class IntegrationSurface: """Describe one supported extension surface without...
fatmambot33/PermutiveAPI
src/PermutiveAPI/integration_registry.py
.py
c1d9bf58747d27de
7.3
3
"""Typed configuration helpers for the official Permutive MCP server. The MCP server is hosted and versioned by Permutive. This module intentionally provides client configuration only; it does not proxy or duplicate hosted MCP tools. """ from __future__ import annotations import json import os from dataclasses impor...
fatmambot33/PermutiveAPI
src/PermutiveAPI/mcp.py
.py
36dd6d01cde5ad6b
7.3
3
"""Typed request contracts for canonical Permutive actions.""" from __future__ import annotations from typing import List from typing_extensions import NotRequired, TypedDict from .sdk import JSONObject class AliasPayload(TypedDict): """External identifier attached to one user.""" id: str tag: str ...
fatmambot33/PermutiveAPI
src/PermutiveAPI/models.py
.py
b52e8bb9bb3e3f04
7.3
3
"""Deterministic performance-budget measurement helpers.""" from __future__ import annotations import json import time from dataclasses import dataclass from pathlib import Path from statistics import median from typing import Callable, Mapping, Sequence PERFORMANCE_CONTRACT_VERSION = 1 @dataclass(frozen=True) cla...
fatmambot33/PermutiveAPI
src/PermutiveAPI/performance.py
.py
610ae99502b6dc5c
7.3
3
"""Stable plugin surface for PermutiveAPI integrations.""" from __future__ import annotations from dataclasses import dataclass from importlib.metadata import entry_points from typing import Dict, Iterable, Protocol from ..agent import PermutiveAgentKit from ..client import PermutiveClient from ..credentials import ...
fatmambot33/PermutiveAPI
src/PermutiveAPI/plugins/base.py
.py
b29589658c8b8d42
7.3
3
"""First-class Codex integration for PermutiveAPI.""" from __future__ import annotations from importlib.metadata import PackageNotFoundError, version from typing import Any, Mapping, cast from ..actionable_errors import classify_exception from ..agent import PermutiveAgentKit from ..capabilities import ( Capabil...
fatmambot33/PermutiveAPI
src/PermutiveAPI/plugins/codex.py
.py
4d3c40b99b392aff
7.3
3
"""Safe runtime policy and validation primitives for PermutiveAPI plugins.""" from __future__ import annotations from dataclasses import dataclass from typing import Literal PluginMode = Literal["read_only", "read_write"] @dataclass(frozen=True) class PluginPolicy: """Control which plugin operations may be exp...
fatmambot33/PermutiveAPI
src/PermutiveAPI/plugins/runtime.py
.py
85b5ca3b9f338398
7.3
3
"""Typed Pydantic models for native Permutive query payloads.""" from __future__ import annotations import json import sys from typing import Any, Literal, Union if sys.version_info >= (3, 11): from enum import StrEnum else: from typing_extensions import StrEnum # type: ignore[attr-defined] from typing_ext...
fatmambot33/PermutiveAPI
src/PermutiveAPI/query.py
.py
3f682e07ba8569cf
7.3
3
"""Composable builders for native Permutive query payloads.""" from __future__ import annotations from dataclasses import dataclass from typing import Any, Dict, Iterable, Optional, Tuple, Union Scalar = Union[str, int, float, bool] @dataclass(frozen=True) class QueryExpression: """Immutable query expression w...
fatmambot33/PermutiveAPI
src/PermutiveAPI/query_dsl.py
.py
bce6d9a3914eed16
7.3
3
"""Sanitized HTTP recording and deterministic transport replay.""" from __future__ import annotations import json from collections import deque from dataclasses import dataclass, field from pathlib import Path from typing import Any, Deque, Mapping, cast from urllib.parse import urlsplit, urlunsplit from requests im...
fatmambot33/PermutiveAPI
src/PermutiveAPI/recording.py
.py
75ee4d68e98b03e0
7.3
3
"""Loader for background cards derived from all_cards.parquet.""" from __future__ import annotations import ast import re from dataclasses import dataclass from functools import lru_cache from pathlib import Path from typing import Any, Mapping, Tuple from logging_util import get_logger from deck_builder.partner_back...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/background_loader.py
.py
b92d257a0380ca81
7.3
3
from __future__ import annotations from functools import lru_cache from pathlib import Path from typing import Dict, List, Optional, Tuple import json import yaml from deck_builder.combos import detect_combos from .phases.phase0_core import BRACKET_DEFINITIONS from type_definitions import ComplianceReport, CategoryFi...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/brackets_compliance.py
.py
c5baf199d9f49b68
7.3
3
""" Utilities for include/exclude card functionality. Provides fuzzy matching, card name normalization, and validation for must-include and must-exclude card lists. """ from __future__ import annotations import difflib import re from typing import List, Dict, Set, Tuple, Optional from dataclasses import dataclass f...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/include_exclude_utils.py
.py
0a3422abe406ea4d
7.3
3
from __future__ import annotations from typing import List, Optional import pandas as pd from .phase0_core import BracketDefinition, BRACKET_DEFINITIONS # noqa: F401 """Phase 1: Commander & Tag Selection logic. Extracted from builder.py to reduce monolith size. All public method names and signatures preserved; DeckB...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/phases/phase1_commander.py
.py
d7e7d18d5ff5434e
7.3
3
from __future__ import annotations from typing import List import random from .. import builder_constants as bc from .. import builder_utils as bu """Phase 2 (part 4): Fetch lands (Land Step 4). Extracted logic for adding color-specific and generic fetch lands. Provided by LandFetchMixin: - add_fetch_lands(request...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/phases/phase2_lands_fetch.py
.py
ac59c0a622507e6c
7.3
3
from __future__ import annotations from typing import List, Dict from .. import builder_constants as bc """Phase 2 (part 2): Staple nonbasic lands (Land Step 2). Extracted logic for adding generic staple lands (excluding kindred / tribal, fetches, etc.). Provided by LandStaplesMixin: - _current_land_count(): count...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/phases/phase2_lands_staples.py
.py
96bafd25d2c18655
7.3
3
from __future__ import annotations from typing import Optional, List, Dict, Set import re from .. import builder_constants as bc class LandTripleMixin: """Mixin providing logic for adding three-color (triple) lands (Step 6). Extraction rationale: - Isolates a coherent land selection concern from the ...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/phases/phase2_lands_triples.py
.py
7d176cc1da5ecc56
7.3
3
"""Rule predicates for the Rulebreaker commander mechanic (Roadmap 35). Each predicate takes a single card row (``pd.Series`` or any Mapping with ``type``/``manaValue``/``text`` keys) plus the archetype's ``params`` dict from ``RULEBREAKER_ARCHETYPES`` and returns whether that card is eligible under the archetype's ru...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/rulebreaker_rules.py
.py
0917b23e14fb00d4
7.3
3
"""Shared text helpers to keep CLI and web copy in sync.""" from __future__ import annotations from typing import Optional __all__ = ["build_land_headline", "dfc_card_note"] def build_land_headline(traditional: int, dfc_bonus: int, with_dfc: Optional[int] = None) -> str: """Return the consistent land summary h...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/shared_copy.py
.py
77a800d74b6948b5
7.3
3
"""Detect tokens/emblems a deck's cards will create (roadmap_39, Milestone 5). Pure functions, no builder-instance dependency -- mirrors the `combos.py` pattern. Purely informational: never affects deck legality, card count, price totals, or bracket compliance. """ from __future__ import annotations from dataclasses ...
mwisnowski/mtg_python_deckbuilder
code/deck_builder/tokens.py
.py
538eafef8e16573c
7.3
3
""" Art tags cache builder for card detail view / search. Downloads the Scryfall Art Tags bulk file (community-maintained illustration tagging project, see https://scryfall.com/docs/tagger-tags) and writes an `artTags` column directly onto all_cards.parquet, mapping tags to cards by illustration_id (not oracle_id -- a...
mwisnowski/mtg_python_deckbuilder
code/file_setup/art_tags_cache.py
.py
aae0f8432eff565f
7.3
3
""" Card Data Aggregator Consolidates individual card CSV files into a single Parquet file for improved performance in card browsing, theme cataloging, and searches. Key Features: - Merges all card CSVs into all_cards.parquet (50-70% size reduction, 2-5x faster) - Excludes master files (cards.csv, commander_cards.csv...
mwisnowski/mtg_python_deckbuilder
code/file_setup/card_aggregator.py
.py
1055dfb030e7fd85
7.3
3
"""Data loader abstraction for CSV and Parquet formats. This module provides a unified interface for reading and writing card data in both CSV and Parquet formats. It handles format detection, conversion, and schema validation. Introduced in v3.0.0 as part of the Parquet migration. """ from __future__ import annotat...
mwisnowski/mtg_python_deckbuilder
code/file_setup/data_loader.py
.py
9c6175d511bd67ff
7.3
3
from __future__ import annotations import copy import itertools import logging import typing import warnings from collections.abc import Mapping from dataclasses import dataclass from typing import ( Any, Callable, ClassVar, TypeVar, ) from pydantic import ( BaseModel, ConfigDict, Field, ...
nlp-unibo/cinnamon
cinnamon/configuration.py
.py
d0366842e2c2de72
7.24
2
""" Static analyzer for cinnamon bound components. Verifies that configurations are registered correctly with the components they are bound to. This framework does *not* require a ``Component`` class: components are plain Python classes referenced by a fully-qualified string path (see ``Registry.instantiate``). The an...
nlp-unibo/cinnamon
cinnamon/utility/static_analyzer.py
.py
399fc0a5ff72ba4e
7.24
2
"""Offline, checksum-based address validators for config.analysis.CRYPTO_PATTERNS. CRYPTO_PATTERNS is pure shape matching -- a regex alternation with zero coin-specific structural or checksum verification. That is what let Rust mangled-symbol strings (e.g. "d6thread6Thread5cname17hd86fb86E") get recorded as candidate ...
mdostal/coin-finder
config/address_validators.py
.py
6347a786cbcea516
7
0
import json import os from pathlib import Path # Add the project root to the Python path # sys.path.append(str(Path(__file__).resolve().parent)) from tools.search_wallets import search_for_wallets from tools.analyze_wallets import analyze_wallets from tools.check_wallet_balances import check_wallet_balances from tools...
mdostal/coin-finder
run_pipeline.py
.py
6308493681c2ab7e
7
0
"""Tests for config/address_validators.py -- the offline checksum filter that stops shape-only regex matches (CRYPTO_PATTERNS) from being trusted as real addresses. Every "Group 1" real-address fixture below is a genuine, published address pulled from the coin's own documentation or a public block explorer (never fabr...
mdostal/coin-finder
tests/test_address_validators.py
.py
ccc187aa42728117
7.5
0
from enum import Enum import os from typing import List, Dict, Literal class ModelConfig: def __init__(self, name: str, url: str, path: str = None, type: str = "whisper", tokenizer_url: str = None, revision: str = None, model_file: str = None,): """ Initialize a model configuration. name...
MeherwerAli/whisper-webui
src/config.py
.py
42283923da13f232
7
0
import argparse import gc import json import os from pathlib import Path import tempfile from typing import TYPE_CHECKING, List import torch import ffmpeg class DiarizationEntry: def __init__(self, start, end, speaker): self.start = start self.end = end self.speaker = speaker def __re...
MeherwerAli/whisper-webui
src/diarization/diarization.py
.py
2633903c6aa67778
7
0
import json from pathlib import Path def load_transcript_json(transcript_file: str): """ Parse a Whisper JSON file into a Whisper JSON object # Parameters: transcript_file (str): Path to the Whisper JSON file """ with open(transcript_file, "r", encoding="utf-8") as f: whisper_result =...
MeherwerAli/whisper-webui
src/diarization/transcriptLoader.py
.py
af279720e9968231
7
0
from src.hooks.progressListener import ProgressListener from typing import Union class SubTaskProgressListener(ProgressListener): """ A sub task listener that reports the progress of a sub task to a base task listener Parameters ---------- base_task_listener : ProgressListener The base pro...
MeherwerAli/whisper-webui
src/hooks/subTaskProgressListener.py
.py
0d56a1977c03d9ba
7
0
import abc class AbstractPromptStrategy: """ Represents a strategy for generating prompts for a given audio segment. Note that the strategy must be picklable, as it will be serialized and sent to the workers. """ @abc.abstractmethod def get_segment_prompt(self, segment_index: int, whispe...
MeherwerAli/whisper-webui
src/prompts/abstractPromptStrategy.py
.py
b3fb866a84ed308d
7
0
import json from typing import Dict from src.prompts.abstractPromptStrategy import AbstractPromptStrategy class JsonPromptSegment(): def __init__(self, segment_index: int, prompt: str, format_prompt: bool = False): self.prompt = prompt self.segment_index = segment_index self.format_prompt ...
MeherwerAli/whisper-webui
src/prompts/jsonPromptStrategy.py
.py
4ab2423b85fe98d3
7
0
from src.config import VadInitialPromptMode from src.prompts.abstractPromptStrategy import AbstractPromptStrategy class PrependPromptStrategy(AbstractPromptStrategy): """ A simple prompt strategy that prepends a single prompt to all segments of audio, or prepends the prompt to the first segment of audio. "...
MeherwerAli/whisper-webui
src/prompts/prependPromptStrategy.py
.py
c57be4e3462a857f
7
0