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 |
|---|---|---|---|---|---|---|
# SPDX-FileCopyrightText: 2024-present Hasan Sezer Tasan <hasansezertasan@gmail.com>
#
# SPDX-License-Identifier: MIT
"""
Minimal FastUI Admin example — single model, fewest lines possible.
Run with:
uvicorn examples.minimal.main:app --reload --port 5000
Then visit:
http://localhost:5000/admin/
"""
from __fu... | hasansezertasan/fastui-admin | examples/minimal/main.py | .py | db73279d34527d3f | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024-present Hasan Sezer Tasan <hasansezertasan@gmail.com>
#
# SPDX-License-Identifier: MIT
"""
Read-only admin example — demonstrates permission flags.
Run with:
uvicorn examples.readonly.main:app --reload --port 5000
Then visit:
http://localhost:5000/admin/
"""
from __future__ imp... | hasansezertasan/fastui-admin | examples/readonly/main.py | .py | b70fb467d8a0b3b5 | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024-present Hasan Sezer Tasan <hasansezertasan@gmail.com>
#
# SPDX-License-Identifier: MIT
"""Core admin class for FastUI Admin.
Warning:
FastUI Admin does NOT provide authentication, authorization, or CSRF protection.
All admin endpoints are publicly accessible by default.
Mutat... | hasansezertasan/fastui-admin | src/fastui_admin/base.py | .py | 42da8c9a92518272 | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024-present Hasan Sezer Tasan <hasansezertasan@gmail.com>
#
# SPDX-License-Identifier: MIT
"""Layout system for FastUI Admin pages."""
from __future__ import annotations
from typing import TYPE_CHECKING, Literal
from fastui import components as c
from fastui import prebuilt_html
from fastu... | hasansezertasan/fastui-admin | src/fastui_admin/layout.py | .py | e91fe841b61a9203 | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024-present Hasan Sezer Tasan <hasansezertasan@gmail.com>
#
# SPDX-License-Identifier: MIT
"""Utility functions for FastUI Admin."""
import logging
import re
from datetime import date, datetime, time
from decimal import Decimal
from typing import Any, Optional
from pydantic import BaseModel... | hasansezertasan/fastui-admin | src/fastui_admin/utils.py | .py | 0729be6ab45320fb | 7.45 | 7 |
# SPDX-FileCopyrightText: 2024-present Hasan Sezer Tasan <hasansezertasan@gmail.com>
#
# SPDX-License-Identifier: MIT
"""Shared test fixtures."""
from collections.abc import AsyncGenerator
from datetime import datetime, timezone
from typing import ClassVar
import pytest
import pytest_asyncio
from fastapi import FastA... | hasansezertasan/fastui-admin | tests/conftest.py | .py | 18f8c510cef2b972 | 7.95 | 7 |
# SPDX-FileCopyrightText: 2024-present Hasan Sezer Tasan <hasansezertasan@gmail.com>
#
# SPDX-License-Identifier: MIT
"""Tests for BaseAdmin engine/session_maker validation."""
import pytest
from fastapi import FastAPI
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from fastui_admin impo... | hasansezertasan/fastui-admin | tests/test_base_admin_config.py | .py | 5ae0cb93bcba940f | 7.95 | 7 |
#!/usr/bin/env python3
"""Probe the Fuel Finder incremental endpoints with several timestamp formats.
The Fuel Finder API docs contradict themselves on what `effective-start-timestamp`
should look like for the incremental endpoints (GET /pfs and GET /pfs/fuel-prices):
the parameter schema says `format: date` (e.g. "20... | beecho01/Fuel-Prices-UK | scripts/check_incremental_formats.py | .py | 9e5bdb1d947486bf | 7.62 | 16 |
"""Shared pytest fixtures/setup for the Fuel Prices UK test suite."""
from __future__ import annotations
import asyncio
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
if sys.platform.startswith("win") and ... | beecho01/Fuel-Prices-UK | tests/conftest.py | .py | 684399d99fcd6459 | 8.12 | 16 |
"""Mocked-API tests for FuelPricesAPI's refresh/pagination/fallback logic.
Uses aioresponses to stand in for the live Fuel Finder API so these run
without network access or real credentials. This is the highest-value test
file in the suite: it locks in the fix for GitHub issue #14 (incremental
refresh always falling b... | beecho01/Fuel-Prices-UK | tests/test_api_client_refresh.py | .py | 43c1e6957d76f24f | 7.12 | 16 |
"""Tests for the stale-data Repair logic in FuelPricesDataUpdateCoordinator.
This exercises _record_failure_and_maybe_raise_repair/_clear_stale_data_issue
directly on a bare instance (bypassing DataUpdateCoordinator.__init__, which
needs a real Home Assistant runtime) with hass and issue_registry mocked out.
That keep... | beecho01/Fuel-Prices-UK | tests/test_coordinator_repair.py | .py | 90f843b50e69a18f | 7.12 | 16 |
"""Tests for custom_components.fuel_prices_uk.price_parser.coerce_price."""
from __future__ import annotations
import pytest
from custom_components.fuel_prices_uk.price_parser import coerce_price
@pytest.mark.parametrize(
("value", "expected"),
[
# Already in pounds (below the pence threshold) - pa... | beecho01/Fuel-Prices-UK | tests/test_price_parser.py | .py | 07b7629ac4b2871a | 8.12 | 16 |
from src import parse_ter,canonical_name
import gzip
# TODO: Add test for generate_diff
class TestTer:
def test_large_parser(self):
with gzip.open("test/large.html.gz") as f:
rows = parse_ter(f.read())
assert len(rows) == 1447
def test_scheme_name(self):
assert canoni... | captn3m0/india-mutual-fund-ter-tracker | test/test_ter.py | .py | 0a3ca2092e77f321 | 7.13 | 17 |
"""
Constants for hot water energy calculations
Note: a 'documentation' excel workbook is to be created, and we
intend to add it into the repository and link to it from this
docstring. Links to supporting literature will be added here.
"""
WATER_SPECIFIC_HEAT_CAPACITY_KWH_PER_KG_K = 0.001162
WATER_DENSITY_KG_PER_L ... | EECA-NZ/home-efficiency-calculator | app/constants/hot_water_energy.py | .py | 6ca578414e7a0f7d | 7.45 | 7 |
"""
Main module to run the FastAPI application.
"""
import logging
from contextlib import asynccontextmanager
import uvicorn
from fastapi import FastAPI, responses
from .api.checkbox_behaviour_endpoint import router as checkbox_behaviour_router
from .api.component_savings_endpoints import router as component_savings... | EECA-NZ/home-efficiency-calculator | app/main.py | .py | 0ae62d926cd42d60 | 7.45 | 7 |
"""
Driving (EV charging) electricity usage profile calculation.
"""
import logging
import numpy as np
import pandas as pd
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def _ev_charging_windows(day_of_week: int) -> list[tuple[str, str]]:
"""
Return a list of (start_time, end_... | EECA-NZ/home-efficiency-calculator | app/models/hourly_profiles/driving.py | .py | 17cd77818c33124e | 7.45 | 7 |
"""
Space heating profile calculation with heat pump COP logic.
We compute an hourly space heating demand profile for the postcode,
factoring in day-of-week scheduling and optional heat pump COP.
Demand is computed as: max(setpoint - T_outside, 0).
There is always heating in two baseline windows per day:
- Mornin... | EECA-NZ/home-efficiency-calculator | app/models/hourly_profiles/heating.py | .py | 0141daa2a0cf8395 | 7.45 | 7 |
"""
Hot water heating profile calculation.
For backward compatibility we use the total annual electricity
demand for hot water heating to reverse-engineer a daily profile.
Demand is distributed over the year based on ambient temperatures.
The duration of water heating required each day is estimated, and
used to cons... | EECA-NZ/home-efficiency-calculator | app/models/hourly_profiles/hot_water.py | .py | 9fd9a5688064b985 | 7.45 | 7 |
"""
Class for storing user answers on stovetop cooking.
"""
from typing import Literal, Optional
from pydantic import BaseModel
from ...constants import (
AVERAGE_HOUSEHOLD_SIZE,
DAYS_IN_YEAR,
STANDARD_HOUSEHOLD_COOKTOP_ENERGY_USAGE_KWH,
)
from ...models.hourly_profiles.cooktop import cooktop_hourly_usag... | EECA-NZ/home-efficiency-calculator | app/models/user_answers/cooktop.py | .py | ca93ab3a4e394883 | 7.45 | 7 |
"""
Class for storing user answers on household driving.
"""
# pylint: disable=too-many-locals
from typing import Literal, Optional
from pydantic import BaseModel
from ...constants import (
ASSUMED_DISTANCES_PER_WEEK,
BATTERY_ECONOMY_KWH_PER_100KM,
CALENDAR_YEAR,
DAYS_IN_YEAR,
DEFAULT_CHARGER_KW... | EECA-NZ/home-efficiency-calculator | app/models/user_answers/driving.py | .py | 74d546b30dd08dfe | 7.45 | 7 |
"""
Class for storing user answers on living room space heating.
"""
from typing import Literal, Optional
from pydantic import BaseModel
from ...constants import (
DAYS_IN_YEAR,
ELECTRIC_HEATER_SPACE_HEATING_EFFICIENCY,
GAS_SPACE_HEATING_EFFICIENCY,
HEAT_PUMP_COP_BY_CLIMATE_ZONE,
HEATING_DAYS_PER... | EECA-NZ/home-efficiency-calculator | app/models/user_answers/heating.py | .py | 314a3ca40fc8516f | 7.45 | 7 |
"""
Class for storing user answers on hot water heating.
"""
from typing import Literal, Optional
from pydantic import BaseModel
from ...constants import (
DAYS_IN_YEAR,
HOT_WATER_FLEXIBLE_KWH_FRACTION,
HOT_WATER_POWER_INPUT_KW,
)
from ...models.hourly_profiles.hot_water import (
solar_friendly_hot_w... | EECA-NZ/home-efficiency-calculator | app/models/user_answers/hot_water.py | .py | 3074fb41c9dd6e86 | 7.45 | 7 |
"""
Class for storing user answers on solar generation.
"""
from pydantic import BaseModel
from ...services.postcode_lookups import get_solar_generation
from ..usage_profiles import SolarGeneration, YearlyFuelUsageProfile
class SolarAnswers(BaseModel):
"""
Should the calculations include adding solar panels... | EECA-NZ/home-efficiency-calculator | app/models/user_answers/solar.py | .py | 126cd02bd658d4b1 | 7.45 | 7 |
# pylint: disable=no-self-argument
"""
Class for storing user answers on geography and household size.
"""
from pydantic import BaseModel, conint, constr, field_validator, model_validator
from app.constants import EXCLUDE_POSTCODES
from app.services.postcode_lookups.get_climate_zone import postcode_dict
known_postco... | EECA-NZ/home-efficiency-calculator | app/models/user_answers/your_home.py | .py | eedfe0d63cd360d5 | 7.45 | 7 |
"""
Default answers for the components of a household energy profile.
"""
from ...models.user_answers import (
CooktopAnswers,
DrivingAnswers,
HeatingAnswers,
HotWaterAnswers,
HouseholdAnswers,
OtherAnswers,
SolarAnswers,
YourHomeAnswers,
)
from ...services.energy_calculator import esti... | EECA-NZ/home-efficiency-calculator | app/services/configuration/user_answers_default.py | .py | f850e4f47da3a5cf | 7.45 | 7 |
"""
This module provides functions to optimize the cost of energy for a household.
"""
# pylint: disable=too-many-locals
import logging
import numpy as np
from ..constants import CHECKBOX_BEHAVIOUR, DAYS_IN_YEAR
from ..models.response_models import SavingsData
from ..models.usage_profiles import EnergyCostBreakdown... | EECA-NZ/home-efficiency-calculator | app/services/cost_calculator.py | .py | 15fe538565c49579 | 7.45 | 7 |
"""
This module provides functions to estimate a household's yearly fuel usage profile.
"""
# pylint: disable=too-many-locals
from app.constants import DAYS_IN_YEAR, EMISSIONS_FACTORS
from app.models.hourly_profiles.get_base_demand_profile import (
other_electricity_energy_usage_profile,
)
from app.models.usage_p... | EECA-NZ/home-efficiency-calculator | app/services/energy_calculator.py | .py | 10fdfb5f3078c80a | 7.45 | 7 |
"""
Module for generic helper functions.
"""
import logging
import numpy as np
from pydantic import BaseModel
from app.models.usage_profiles import YearlyFuelUsageProfile
from ..constants import HEATING_PERIOD_FACTOR
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def heating_frequen... | EECA-NZ/home-efficiency-calculator | app/services/helpers.py | .py | 391d68d7de4fa3d2 | 7.45 | 7 |
"""
Functions relating to spatial data. Map postcodes to
EDB zones and to electricity and methane plans.
Postcodes are mapped to EDB zones, which are then mapped
to electricity plans. The mapping from EDB to electricity
plan is based on a pre-computed search for a plan available
in the EDB zone and favorable to an ele... | EECA-NZ/home-efficiency-calculator | app/services/postcode_lookups/get_energy_plans.py | .py | 7acbf9b0fe77329c | 7.45 | 7 |
"""
This module provides a function to simulate
the operation of a hot water diverter, which
shifts excess solar energy into a hot water
cylinder while maintaining thermal balance.
The same logic is applied to hot water heat
pumps, on the basis that similar behaviour
can be obtained with a smart controller.
"""
# pyli... | EECA-NZ/home-efficiency-calculator | app/services/solar_calculator/solar_diverter.py | .py | 378e84232ceece5c | 7.45 | 7 |
import ast
import os
import subprocess
from collections.abc import Generator
from typing import Any
import toml
from flake8.options.manager import OptionManager
ERROR_CODE = "CPE001"
ERROR_MESSAGE = f"{ERROR_CODE} Forbidden import found: {{import_name}}"
class Flake8ImportGuard:
"""
A Flake8 plugin to enfor... | K-dash/flake8-import-guard | src/main.py | .py | cbe5e75a89ea944d | 7.42 | 6 |
"""Performance benchmarks for flake8-import-guard using CodSpeed."""
import ast
import pytest
from src.main import Flake8ImportGuard
def generate_large_ast(num_imports: int) -> ast.AST:
"""Generate an AST with a specified number of import statements."""
imports = []
for i in range(num_imports):
... | K-dash/flake8-import-guard | tests/test_benchmark.py | .py | 0ed4142c8ac122a0 | 7.92 | 6 |
import ast
import subprocess
from unittest.mock import MagicMock, patch
import pytest
from src.main import Flake8ImportGuard
@pytest.fixture
def enforcer():
"""
Fixture to create a Flake8ImportGuard instance for testing.
Returns:
function: A function that creates a Flake8ImportGuard instance.
... | K-dash/flake8-import-guard | tests/test_main.py | .py | e70f64e9848084c8 | 7.92 | 6 |
#!/usr/bin/env python3
"""
First Breath — Deterministic sanctum scaffolding.
This script runs BEFORE the conversational awakening. It creates the sanctum
folder structure, copies template files with config values substituted,
copies all capability files and their supporting references into the sanctum,
and auto-genera... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-agent-builder/assets/init-sanctum-template.py | .py | f8efabce7f5aac41 | 7.63 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# ///
"""
Waking — load the agent's sanctum in one pass, or route to First Breath.
Run on activation. Determines the mode from the filesystem (and the --pulse
flag) and, when the sanctum exists, prints the full identity in a single read
(INDEX, PERSONA, ... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-agent-builder/assets/wake-template.py | .py | 4b181ad41f0171e0 | 7.63 | 17 |
#!/usr/bin/env python3
# vendored from bmad-workflow-builder/scripts; canonical source there
# /// script
# requires-python = ">=3.9"
# dependencies = ["tiktoken"]
# ///
"""count_tokens — the single length metric for skill authoring.
Token counts replace line counts everywhere in the builder and eval-runner.
This scri... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-agent-builder/scripts/count_tokens.py | .py | a9095cab1987c347 | 7.63 | 17 |
#!/usr/bin/env python3
"""Process BMad agent template files.
Performs deterministic variable substitution and conditional block processing
on template files from assets/. Replaces {varName} placeholders with provided
values and evaluates {if-X}...{/if-X} conditional blocks, keeping content
when the condition is in the... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-agent-builder/scripts/process-template.py | .py | 707424da4f8cd205 | 7.63 | 17 |
#!/usr/bin/env python3
"""Deterministic path standards scanner for BMad skills.
Validates all .md and .json files against BMad path conventions:
1. {project-root} for any project-scope path (not just _bmad)
2. Bare _bmad references must have {project-root} prefix
3. Config variables used directly — no double-prefix wi... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-agent-builder/scripts/scan-path-standards.py | .py | a37fd299deda25e9 | 7.63 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# ///
"""lint-spine — the mechanical half of spine decision-integrity, done deterministically.
LLMs miscount IDs and miss literal placeholders; a grep does not. This linter owns the
checks a script does better than a prompt, and leaves the semantic half ... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-architecture/scripts/lint_spine.py | .py | 040e0f1c13d31e6a | 7.63 | 17 |
# /// script
# requires-python = ">=3.10"
# dependencies = ["pytest>=8.0"]
# ///
"""Tests for lint_spine.py. Run: uv run --with pytest pytest scripts/tests/test_lint_spine.py
The spine under test: a clean spine lints empty; the linter catches exactly the
mechanical defects a prompt is unreliable at — literal placehold... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-architecture/scripts/tests/test_lint_spine.py | .py | e86bb9a62c5cca74 | 7.13 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.9"
# dependencies = []
# ///
"""Remove legacy module directories from _bmad/ after config migration.
After merge-config.py and merge-help-csv.py have migrated config data and
deleted individual legacy files, this script removes the now-redundant
directory tr... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-bmb-setup/scripts/cleanup-legacy.py | .py | dd7ed76e40d042c7 | 7.63 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.9"
# dependencies = ["pyyaml"]
# ///
"""Merge module configuration into shared _bmad/config.yaml and config.user.yaml.
Reads a module.yaml definition and a JSON answers file, then writes or updates
the shared config.yaml (core values at root + module section... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-bmb-setup/scripts/merge-config.py | .py | fcc3687bf6628279 | 7.63 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.9"
# dependencies = []
# ///
"""Merge module help entries into shared _bmad/module-help.csv.
Reads a source CSV with module help entries and merges them into a target CSV.
Uses an anti-zombie pattern: all existing rows matching the source module code
are rem... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-bmb-setup/scripts/merge-help-csv.py | .py | a222fd5b9856fa2c | 7.63 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# ///
"""Enumerate customizable BMad skills installed alongside this one.
Scans a skills directory (by default: the directory this script's own skill
lives in, derived from __file__), finds every sibling directory containing a
`customize.toml`, classifie... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-customize/scripts/list_customizable_skills.py | .py | 8787f542930b9277 | 7.63 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# ///
"""Tests for recon_kit.py."""
import io
import json
import sys
import unittest
from contextlib import redirect_stdout
from datetime import date
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from recon_ki... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-deep-recon/scripts/tests/test_recon_kit.py | .py | 1b4ddf482dd2d11a | 8.13 | 17 |
#!/usr/bin/env python3
"""Guard the clean-room env contract in run_evals.py and run_triggers.py.
The eval result is only honest if nothing from the host shell leaks into the
subprocess. Both scripts carry their own build_case_env (they are
deliberately self-contained); this test pins the contract on both copies:
exact... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-eval-runner/scripts/tests/test_env_isolation.py | .py | 03c2f39182f5c02f | 8.13 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# ///
"""Resolve the personas and parties the forge can bring into the room.
The forge cross-examines witnesses: the installed BMAD agents, plus any
custom personas and party groups the user has authored for `bmad-party-mode`.
This surfaces all of them i... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-forge-idea/scripts/resolve_personas.py | .py | b3e5f2f38de013ad | 7.63 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# ///
"""Unit tests for resolve_personas.py — pool merge, alias, party resolution."""
import sys
import unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
import resolve_personas as rp # noqa: E402
AGENTS... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-forge-idea/scripts/tests/test_resolve_personas.py | .py | 1c4fa4b1d68bfbd1 | 8.13 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# ///
"""Tests for scaffold-setup-skill.py"""
import json
import subprocess
import sys
import tempfile
from pathlib import Path
SCRIPT = Path(__file__).resolve().parent.parent / "scaffold-setup-skill.py"
TEMPLATE_DIR = Path(__file__).resolve().parent.pa... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-module-builder/scripts/tests/test-scaffold-setup-skill.py | .py | f10d300453cbd509 | 8.13 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# ///
"""Tests for scaffold-standalone-module.py"""
import json
import subprocess
import sys
import tempfile
from pathlib import Path
SCRIPT = Path(__file__).resolve().parent.parent / "scaffold-standalone-module.py"
def make_skill_dir(tmp: Path, name:... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-module-builder/scripts/tests/test-scaffold-standalone-module.py | .py | f2d9a2b67a94cb24 | 8.13 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# ///
"""Validate a BMad module's structure and help CSV integrity.
Supports two module types:
- Multi-skill modules with a dedicated setup skill (*-setup directory)
- Standalone single-skill modules with self-registration (assets/module-setup.md)
Perfo... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-module-builder/scripts/validate-module.py | .py | 122612a9e0c2afc7 | 7.63 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# ///
"""Resolve the party-mode roster, lazily.
Merges the installed BMAD agents with the user's custom `party_members`
into one collective, then projects only what the moment needs:
* default (no flag) — the active roster to load on entry: the
`d... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-party-mode/scripts/resolve_party.py | .py | 0bed5ad2139f4412 | 7.63 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# ///
"""Unit tests for resolve_party.py — merge, alias, override, group resolution."""
import sys
import unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
import resolve_party as rp # noqa: E402
AGENTS ... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-party-mode/scripts/tests/test_resolve_party.py | .py | bb53fe03ec3013ed | 8.13 | 17 |
# /// script
# requires-python = ">=3.10"
# ///
"""Measure git commit and file-change evidence over a revision range.
Prints ONLY JSON to stdout. Errors are emitted as JSON to stdout with a
non-zero exit code: 2 for invalid arguments (rejected before git runs),
1 for git or I/O failures. This script only MEASURES — it... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-retrospective/scripts/git_evidence.py | .py | 6e08688d2943217b | 8.13 | 17 |
# /// script
# requires-python = ">=3.10"
# dependencies = ["ruamel.yaml>=0.18"]
# ///
"""Detect the current retrospective epic and surgically update sprint-status.yaml.
Prints ONLY JSON to stdout. Errors are emitted as JSON to stdout with a non-zero
exit code. The ``update`` subcommand round-trips the YAML to preserv... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-retrospective/scripts/sprint_status.py | .py | a697eecd53cd9177 | 7.13 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# ///
"""Tests for word_metrics.py."""
import sys
import unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from word_metrics import section_metrics, word_count
DOC = """Intro line before any heading.
# ... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-review/scripts/tests/test_word_metrics.py | .py | 3b5a285d3c9f611b | 8.13 | 17 |
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# ///
"""Exact word counts for a document, as JSON.
Emits the document's total word count and a per-heading-section breakdown so
an editorial review can ground word-impact estimates and reduction
percentages in real numbers instead of guessing. Sections ... | raffaelespazzoli/virtualization-migration-factory-reference-implementation | .agents/skills/bmad-review/scripts/word_metrics.py | .py | fb45007a7f3cfc18 | 7.63 | 17 |
"""Database configuration module."""
from typing import Dict, Any
from dataclasses import dataclass
from config.config import MONGODB_URI, MONGODB_DATABASE
@dataclass
class MongoDBConfig:
"""MongoDB configuration settings."""
uri: str
database: str
collections: Dict[str, str]
options: Dict[st... | mujakayadan/Resume-Builder-TeX | config/database_config.py | .py | 1a7e780a880c3643 | 7.54 | 11 |
from dataclasses import dataclass, field
from typing import Dict, Any, Optional
import os
from dotenv import load_dotenv
load_dotenv()
@dataclass
class ModelConfig:
name: str
default_temperature: float
max_tokens: Optional[int] = None
default_options: Dict[str, Any] = field(default_factory=dict)
clas... | mujakayadan/Resume-Builder-TeX | config/llm_config.py | .py | 8dac67bf86f3e5e1 | 7.54 | 11 |
import os
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
import logging
from typing import Optional
from pathlib import Path
import time
import psutil
logger = logging.getLogger(__name__)
class SeleniumConnection:
def __in... | mujakayadan/Resume-Builder-TeX | easy_applier/connections/selenium_connection.py | .py | 033e734d2108ee5b | 7.54 | 11 |
from linkedin_api import Linkedin
import logging
from typing import Optional, List, Dict
import time
logger = logging.getLogger(__name__)
class JobExtractor:
def __init__(self, username: str, password: str):
"""
Initialize JobExtractor with LinkedIn API
Args:
username:... | mujakayadan/Resume-Builder-TeX | easy_applier/job_extractor.py | .py | 2bc6bd5f31d89811 | 7.54 | 11 |
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from src.core.database.unit_of_work import MongoUnitOfWork
from src.core.database.models.resume import Resume
from src.generator.utils.output_m... | mujakayadan/Resume-Builder-TeX | easy_applier/linkedin_job_manager.py | .py | 0201852c930221a6 | 7.54 | 11 |
"""
Main application module for the Resume Builder API.
This module initializes the FastAPI application and configures routes, middleware and settings.
"""
import os
import sys
from pathlib import Path
from typing import Dict
from fastapi import FastAPI, Depends
from fastapi.middleware.cors import CORSMiddleware
# A... | mujakayadan/Resume-Builder-TeX | src/api/main.py | .py | 4bc59df25173eb59 | 7.54 | 11 |
"""Authentication router module."""
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi.security import OAuth2PasswordRequestForm
import logging
from src.api.schemas.auth import Token
from src.api.schemas.user import User, UserCreate
from src.core.security.auth import get_current_active_user
fr... | mujakayadan/Resume-Builder-TeX | src/api/routers/auth.py | .py | 50ea5de4fe08fbbb | 7.54 | 11 |
"""Resume schemas module."""
from typing import Optional
from datetime import datetime
from pydantic import BaseModel, Field
class ResumeBase(BaseModel):
"""Base resume schema."""
title: str = "My Resume"
template_id: str = "default"
version: int = 1
personal_information: str
career_summary: s... | mujakayadan/Resume-Builder-TeX | src/api/schemas/resume.py | .py | 2f003f2b3e6e6205 | 7.54 | 11 |
"""User schemas module."""
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, EmailStr, Field, ConfigDict
class UserBase(BaseModel):
"""Base user schema."""
email: EmailStr
is_active: bool = True
is_superuser: bool = False
full_name: Optional[str] = None
cla... | mujakayadan/Resume-Builder-TeX | src/api/schemas/user.py | .py | f72924363bd03667 | 7.54 | 11 |
"""Authentication service module."""
from typing import Optional
from datetime import datetime, timezone, timedelta
from jose import JWTError, jwt
from passlib.context import CryptContext
import logging
from ..schemas.user import UserCreate, UserLogin, UserResponse, UserUpdate
from src.core.database.factory import ge... | mujakayadan/Resume-Builder-TeX | src/api/services/auth_service.py | .py | b7a53e577032bf13 | 7.54 | 11 |
"""MongoDB connection handler module."""
from typing import Optional
from pymongo import MongoClient
from pymongo.client_session import ClientSession
from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorClientSession
import logging
logger = logging.getLogger(__name__)
class MongoConnection:
"""MongoDB... | mujakayadan/Resume-Builder-TeX | src/core/database/connections/mongo_connection.py | .py | 261503415161efa3 | 7.54 | 11 |
"""Database factory module for creating database connections and unit of work."""
from typing import AsyncGenerator
from config.config import MONGODB_URI, MONGODB_DATABASE
from .connections import MongoConnection, AsyncMongoConnection
from .unit_of_work import MongoUnitOfWork, AsyncMongoUnitOfWork
def get_database_co... | mujakayadan/Resume-Builder-TeX | src/core/database/factory.py | .py | d7b1ce56e5e2debd | 7.54 | 11 |
"""
Chromium installation and configuration helper.
"""
import platform
import subprocess
import webbrowser
from pathlib import Path
def check_chromium_installation():
"""Checks Chromium installation and provides instructions."""
system = platform.system()
print(f"🔍 Checking Chromium installation o... | yanx9/thePrivator | install_chromium_helper.py | .py | c9d6c8c5175716a9 | 7.48 | 8 |
#!/usr/bin/env python3
"""claude-worktree-write-guard.py — Claude Code PreToolUse hook that blocks
file-tool writes escaping a worktree into the protected main checkout.
Why this exists: Claude Code runs sub-agents (the Task tool) IN-PROCESS — they
share the orchestrator's OS process and tool pipeline, so there is no ... | vintasoftware/vintasend | ai-tools/skills/prepare-worktree/scripts/claude-worktree-write-guard.py | .py | 43106f8204201e5c | 7.48 | 8 |
"""Git helpers shared by the tagging scripts.
Pushing a release tag is the irreversible step in this project: it triggers
`publish.yml`, and a version that reaches PyPI can never be re-uploaded. Every
helper here exists so the tagging scripts can refuse *before* that push rather
than diagnose afterwards.
"""
from __f... | vintasoftware/vintasend | scripts/_git.py | .py | 000602d05c195611 | 7.48 | 8 |
"""Shared discovery of the vintasend packages in this superproject.
Both `bump_version.py` and `prepare_release.py` need the same answers -- which
directories hold a Python package, what each one is called, and how its
`pyproject.toml` is laid out -- so the TOML line grammar lives here rather than
being duplicated and... | vintasoftware/vintasend | scripts/_packages.py | .py | 60e47fed9b5fe2e1 | 7.48 | 8 |
"""Asking PyPI what is already published.
The release runs in waves -- the root first, then the packages that depend on
it, then the packages that depend on those. What separates one wave from the
next is a version becoming installable, so every script that orders the family
needs the same question answered: is `name=... | vintasoftware/vintasend | scripts/_pypi.py | .py | 5d0307923c7771ff | 7.48 | 8 |
#!/usr/bin/env python3
"""Bump every vintasend package to one shared version number.
The whole family -- this repo plus each `vintasend-*` submodule -- releases in
lockstep, so every `pyproject.toml` carries the same `version`. This script is
the one place that number moves.
The root package is the source of truth: t... | vintasoftware/vintasend | scripts/bump_version.py | .py | d5bf089c087efb2b | 7.48 | 8 |
#!/usr/bin/env python3
"""Run the whole vintasend release, wave by wave, without babysitting it.
The steps are the ones you would run by hand, in the only order that works:
1. tag_release.py tag the root and push -- publish.yml uploads it
2. wait until that version is installable f... | vintasoftware/vintasend | scripts/release_all.py | .py | d4a4a09ce22b2d1a | 7.48 | 8 |
#!/usr/bin/env python3
"""Tag the root vintasend package and publish its GitHub release.
Pushing the tag is what ships the release: `.github/workflows/publish.yml`
triggers on `v*`, runs the matrix, builds with Poetry and uploads to PyPI. A
version that reaches PyPI is immutable -- it can never be re-uploaded, and a
d... | vintasoftware/vintasend | scripts/tag_release.py | .py | 56320492acfb5d61 | 7.48 | 8 |
#!/usr/bin/env python3
"""Tag the vintasend-* subpackages that are ready, at the shared version.
Each submodule is its own git repository with its own `publish.yml`, triggered
by its own `v*` tag. This tags them at the one version the family shares and
pushes each tag, so a whole wave publishes together.
scripts/... | vintasoftware/vintasend | scripts/tag_subpackages.py | .py | 9b2460ab7ee31feb | 7.48 | 8 |
#!/usr/bin/env python3
"""Clone this template into a new, renamed vintasend-* implementation package.
Usage:
python scripts/clone.py /path/to/vintasend-my-integration
python scripts/clone.py /path/to/vintasend-my-integration --package-name vintasend-my-integration
Copies this directory to the target path, the... | vintasoftware/vintasend | templates/vintasend-implementation-template/scripts/clone.py | .py | 9e52beee71f4f51e | 7.48 | 8 |
"""Delivery seam stub.
Subclass ``BaseNotificationAdapter`` (and its AsyncIO twin) to actually deliver a rendered
notification -- send an email, post to a push service, whatever this integration targets. Use
``BackgroundNotificationAdapter`` / ``AsyncIOBackgroundNotificationAdapter`` instead of the plain
bases when de... | vintasoftware/vintasend | templates/vintasend-implementation-template/vintasend_implementation_template/adapter.py | .py | 5d361817d42abf1a | 7.48 | 8 |
"""Background-send queue seam stub.
Subclass ``BaseNotificationQueueService`` (and its AsyncIO twin) to hand a notification id off to
a background worker -- Celery, RQ, an SQS queue, whatever this integration targets. The queue
service carries only the notification id across the wire; the worker reloads the notificati... | vintasoftware/vintasend | templates/vintasend-implementation-template/vintasend_implementation_template/queue_service.py | .py | 0b81134bca442ec0 | 7.48 | 8 |
"""Replication queue seam stub.
Subclass ``BaseNotificationReplicationQueueService`` (and its AsyncIO twin) to hand a
``(notification_id, backend_identifier)`` pair off to a background worker -- Celery, RQ, an SQS
queue, whatever this integration targets. The replication queue carries only the notification id
and the ... | vintasoftware/vintasend | templates/vintasend-implementation-template/vintasend_implementation_template/replication_queue_service.py | .py | 7e5df0bd77843981 | 7.48 | 8 |
import hashlib
import mimetypes
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
from vintasend.services.attachment_managers.base import (
download_from_url,
is_url,
read_file_data,
)
if TYPE_CHECKING:
from vintasend.services.dataclasses import (
AttachmentFile,
At... | vintasoftware/vintasend | vintasend/services/attachment_managers/asyncio_base.py | .py | 7a8a73fb4c39bab1 | 7.48 | 8 |
import hashlib
import io
import mimetypes
from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING, BinaryIO
from vintasend.exceptions import UnsupportedAttachmentFileTypeError
if TYPE_CHECKING:
from vintasend.services.dataclasses import (
AttachmentFile,
Atta... | vintasoftware/vintasend | vintasend/services/attachment_managers/base.py | .py | 69858df63dc9a785 | 7.48 | 8 |
import datetime
import io
import mimetypes
import uuid
from abc import ABC, abstractmethod
from dataclasses import dataclass, field, fields
from pathlib import Path
from typing import Any, BinaryIO, Literal, TypedDict, TypeGuard
# Type alias for supported file inputs (for creating notifications)
FileAttachment = (
... | vintasoftware/vintasend | vintasend/services/dataclasses.py | .py | eb3ddb577ab01d95 | 7.48 | 8 |
from abc import ABC, abstractmethod
class AsyncIOBaseGitCommitShaProvider(ABC):
"""AsyncIO twin of `BaseGitCommitShaProvider`. See its docstring."""
@abstractmethod
async def get_current_git_commit_sha(self) -> str | None:
"""Return the current commit SHA, or None if it cannot be determined right... | vintasoftware/vintasend | vintasend/services/git_commit_sha_providers/asyncio_base.py | .py | a49ba56da9dc4195 | 7.48 | 8 |
from abc import ABC, abstractmethod
class BaseGitCommitShaProvider(ABC):
"""Resolves the git commit SHA of the source-code revision currently running.
Injected into a `NotificationService` exactly like `BaseNotificationQueueService` or
`BaseAttachmentManager` -- as an instance, a dotted import string, or... | vintasoftware/vintasend | vintasend/services/git_commit_sha_providers/base.py | .py | ba8874410e77db90 | 7.48 | 8 |
import uuid
from abc import abstractmethod
from typing import Generic, TypeVar
from vintasend.services.notification_adapters.base import BaseNotificationAdapter
from vintasend.services.notification_backends.base import BaseNotificationBackend
from vintasend.services.notification_template_renderers.base import BaseNoti... | vintasoftware/vintasend | vintasend/services/notification_adapters/async_base.py | .py | b68c6af5b3ff8abb | 7.48 | 8 |
import uuid
from abc import abstractmethod
from typing import Generic, TypeVar
from vintasend.services.notification_adapters.asyncio_base import AsyncIOBaseNotificationAdapter
from vintasend.services.notification_backends.asyncio_base import AsyncIOBaseNotificationBackend
from vintasend.services.notification_template_... | vintasoftware/vintasend | vintasend/services/notification_adapters/asyncio_background_base.py | .py | 654f22e8a7374902 | 7.48 | 8 |
import warnings
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Generic, TypeVar, cast, overload
from vintasend.services.notification_backends.asyncio_base import AsyncIOBaseNotificationBackend
from vintasend.services.notification_template_renderers.base import (
BaseNotificationTemplate... | vintasoftware/vintasend | vintasend/services/notification_adapters/asyncio_base.py | .py | ebbed1f5b91adfb6 | 7.48 | 8 |
from abc import ABC, abstractmethod
from typing import Optional, Tuple
class ProviderAdapter(ABC):
"""
Abstract base class for implementing provider adapters.
Subclasses must override the `fetch_current_item` method to provide specific
functionality for fetching data from different providers.
The... | mazdakdev/TGNowPlaying | TGNowPlaying/adapters/base.py | .py | 1b214f3f8b724c14 | 7.6 | 15 |
import numpy as np
import math
from scipy.special import comb as binom
from typing import Sequence, Tuple, TypeVar
class CoalitionSampler:
'''
Samples coalitions without replacement according to given sampling weights per coalition size.
The sampling procedure has two main steps:
1. Given a budget, com... | rtealwitter/leverageshap | leverageshap/estimators/sampling.py | .py | 83931e7b0a0ccf1f | 7.56 | 12 |
import numpy as np
from tabulate import tabulate
from .datasets import load_dataset
class Game:
def __init__(self, model, baseline, explicand):
self.model = model
self.baseline = baseline
self.explicand = explicand
def value(self, S):
# S is a m by n binary matrix
i... | rtealwitter/leverageshap | leverageshap/utils.py | .py | 19d4c3a6933e42a7 | 7.56 | 12 |
import numpy as np
import pytest
import scipy.special
from leverageshap.estimators.ablations import RegressionEstimator
@pytest.mark.parametrize("n", [12, 60, 79, 101])
def test_binomial_budget_at_5n_within_2_percent(n):
"""RegressionEstimator.find_constant_for_bernoulli must not
integer-round the oversampli... | rtealwitter/leverageshap | tests/test_ablations.py | .py | 209e920d182e6208 | 8.06 | 12 |
import numpy as np
import polyscope as ps
from polyscope import imgui
from uipc import view
from uipc import Logger, Timer, Animation
from uipc import Vector3, Transform, Quaternion, AngleAxis
import uipc.builtin as builtin
from uipc.core import Engine, World, Scene, ContactSystemFeature
from uipc.geometry import (Geo... | spiriMirror/libuipc-samples | examples/20_contact_system_feature/main.py | .py | 47e9bd8adec1eeae | 7.59 | 14 |
"""Jinja2 filters for Base64 encoding/decoding."""
from __future__ import annotations
from base64 import b64decode
from base64 import b64encode
__all__ = ["do_b64decode", "do_b64encode"]
def do_b64decode(value: str, encoding: str = "utf-8") -> str:
"""Decode a Base64 encoded string.
Args:
value: A... | copier-org/jinja2-copier-extension | src/jinja2_copier_extension/_filters/base64.py | .py | 446f47eb05fbb39a | 7.42 | 6 |
"""Jinja2 filters for date/time functions."""
from __future__ import annotations
from datetime import datetime
from time import localtime
from time import strftime
__all__ = ["do_strftime", "do_to_datetime"]
def do_strftime(
format: str, # noqa: A002
second: float | None = None,
) -> str:
"""Convert a... | copier-org/jinja2-copier-extension | src/jinja2_copier_extension/_filters/datetime.py | .py | 45c735abb7b922c4 | 7.42 | 6 |
"""Jinja2 filters for random functions."""
from __future__ import annotations
import re
from random import Random
from typing import TYPE_CHECKING
from typing import TypeVar
from typing import overload
if TYPE_CHECKING:
from collections.abc import Sequence
__all__ = ["do_random", "do_random_mac", "do_shuffle"]... | copier-org/jinja2-copier-extension | src/jinja2_copier_extension/_filters/random.py | .py | 33012ccd54235557 | 7.42 | 6 |
"""Jinja2 filters for regular expressions."""
from __future__ import annotations
import re
from typing import Literal
__all__ = ["do_regex_escape", "do_regex_findall", "do_regex_replace", "do_regex_search"]
_REGEX_ESCAPE_POSIX_BASIC_PATTERN = re.compile(r"([\[\]\.\^\$\*\\])")
def do_regex_escape(
pattern: st... | copier-org/jinja2-copier-extension | src/jinja2_copier_extension/_filters/regex.py | .py | 1d4e945d65157502 | 7.42 | 6 |
"""Jinja2 filters related to types."""
from __future__ import annotations
from contextlib import suppress
from typing import Any
__all__ = ["do_bool", "do_type_debug"]
def do_bool(value: Any) -> bool:
"""Parse anything to boolean.
Tries to be as smart as possible:
1. Cast to number. Then: `0 → False... | copier-org/jinja2-copier-extension | src/jinja2_copier_extension/_filters/types.py | .py | 83b4c30bd6769730 | 7.42 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.