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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
"""Snapshot critical AAIF ops data to local, versioned files.
Default target is the AAIF Community Intake Ops sheet. Pass a target to back up any
other file: a Google Drive fileId (native Docs/Sheets/Slides are exported to
.docx/.xlsx/.pptx; already-binary Drive files are downloaded as-is) or a ... | aaif/community-events | skills/aaif-backup/scripts/backup.py | .py | f61fce6d7dac39df | 7.45 | 7 |
#!/usr/bin/env python3
"""Deterministic, local-file event creator: clone the example section in an
Event Tracker.docx, fill details, and stamp all phase due-dates from the event date.
Operates on a docx the agent has ALREADY downloaded via the gws CLI — this script
never touches Drive. Pure-Python docx edit."""
import ... | aaif/community-events | skills/aaif-create-event/scripts/create_event.py | .py | 6899e6d092f7bdbb | 7.45 | 7 |
"""Shared orchestrator utilities for multi-phase workflows."""
import json
import os
import subprocess
# Path to workflow scripts directory (parent of modules/)
WORKFLOWS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def run_phase(script: str, args: list[str], console, phase_name: str, capture_... | MarkusNeusinger/anyplot | agentic/workflows/modules/orchestrator.py | .py | dd55fd014a35ddfa | 7.56 | 12 |
"""Helper module for the `/regen` slash command.
Each step in `agentic/commands/regen.md` calls into this package via
`uv run python -m agentic.workflows.modules.regen <subcommand> ...`.
The behavior that used to live as inline shell + Python in the markdown
is now in named, testable functions here — same module-as-CL... | MarkusNeusinger/anyplot | agentic/workflows/modules/regen/__init__.py | .py | f0428fa8d121c930 | 7.56 | 12 |
"""Build + write `metadata/python/{library}.yaml` from a `QualityEval`.
Replaces regen.md step 2g. The YAML structure mirrors what
`impl-generate.yml` writes (`preview_url_light`/`preview_url_dark`,
`preview_html_light`/`preview_html_dark`, full `review.criteria_checklist`).
"""
from __future__ import annotations
im... | MarkusNeusinger/anyplot | agentic/workflows/modules/regen/metadata.py | .py | 67d052706374b91c | 7.56 | 12 |
"""Pick (or validate) the spec to regen.
Two callers from `regen.md` step 1b:
- `pick_oldest()` — bare `/regen`, finds the oldest spec on `origin/main`
- `validate_spec(id)` — `/regen <spec-id>`, confirms the spec exists
Both read the metadata YAMLs straight out of the `origin/main` git tree
(`git ls-tree`/`git ... | MarkusNeusinger/anyplot | agentic/workflows/modules/regen/picker.py | .py | e40ac3a16fe7dcd4 | 7.56 | 12 |
"""Render both light + dark themes for a single library implementation.
Replaces regen.md step 2d. Two responsibilities:
1. Sidestep the **self-import collision**. Implementations are named after
their library (e.g. `altair.py`), so running them as a script normally
puts their directory on `sys.path[0]` and ... | MarkusNeusinger/anyplot | agentic/workflows/modules/regen/render.py | .py | ba78317656291d68 | 7.56 | 12 |
"""Optimize + responsive-resize both theme renders, then upload to GCS staging.
Replaces regen.md step 2i. Mirrors the bundle that `impl-generate.yml`
uploads (`plot-light*.{png,webp}` + `plot-dark*.{png,webp}` + optional
`plot-{light,dark}.html`) and stages it under
`gs://anyplot-images/staging/{spec_id}/python/{libr... | MarkusNeusinger/anyplot | agentic/workflows/modules/regen/staging.py | .py | ba0641e1dfe2a393 | 7.56 | 12 |
"""Workflow state management for composable agentic workflows.
Provides persistent state management via file storage and
transient state passing between scripts via stdin/stdout.
"""
import json
import os
import sys
from typing import Any, Dict, Optional
class WorkflowState:
"""Persistent state container for mu... | MarkusNeusinger/anyplot | agentic/workflows/modules/state.py | .py | 73b9c59c66ae26d7 | 7.56 | 12 |
"""Shared template loading and rendering for workflow scripts."""
import os
def load_template(template_path: str, working_dir: str) -> str:
"""Load a template file from the working directory."""
full_path = os.path.join(working_dir, template_path)
if not os.path.exists(full_path):
raise FileNotFo... | MarkusNeusinger/anyplot | agentic/workflows/modules/template.py | .py | 956aac5063cc5af6 | 7.56 | 12 |
"""
Alembic environment configuration for async migrations.
Supports two connection modes:
1. DATABASE_URL - Direct connection (local development)
2. INSTANCE_CONNECTION_NAME - Cloud SQL Connector (GitHub Actions, Cloud Run)
"""
import asyncio
import os
from logging.config import fileConfig
from dotenv import load_d... | MarkusNeusinger/anyplot | alembic/env.py | .py | af77d3082eb9c237 | 7.56 | 12 |
"""initial_schema
Revision ID: 393d66bd73d9
Revises:
Create Date: 2025-12-11 23:37:27.851407
"""
from typing import Sequence
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "393d66bd73d9"
down_revision: str | None ... | MarkusNeusinger/anyplot | alembic/versions/393d66bd73d9_initial_schema.py | .py | aeaec4959df8469c | 7.56 | 12 |
"""add_language_version_to_impls
Adds a `language_version` column to the `impls` table to record the runtime
version of the implementation's own language — Python interpreter for python
libraries, R interpreter for ggplot2. The existing `python_version` column
keeps its original meaning ("Python that ran the impl-gene... | MarkusNeusinger/anyplot | alembic/versions/3a7e1b5c0c4f_add_language_version_to_impls.py | .py | 8bb1e765905adbc0 | 7.56 | 12 |
"""add_extended_review_fields
Add extended review data fields to impls table for issue #2845:
- review_image_description: AI's visual description of the plot
- review_criteria_checklist: Detailed per-criterion scoring breakdown
- review_verdict: "APPROVED" or "REJECTED"
Revision ID: 6345896e2e90
Revises: d0c76553a5cc... | MarkusNeusinger/anyplot | alembic/versions/6345896e2e90_add_extended_review_fields.py | .py | 41e7029fff6f62e8 | 7.56 | 12 |
"""rename_implementations_to_impls
Revision ID: 6a8ae95eaf56
Revises: 393d66bd73d9
Create Date: 2025-12-12 21:23:53.707324
"""
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "6a8ae95eaf56"
down_revision: str = "393d66bd73d9"
branch_labels: None = None
depends_on: None = None
def ... | MarkusNeusinger/anyplot | alembic/versions/6a8ae95eaf56_rename_implementations_to_impls.py | .py | dfafcd26348f9473 | 7.56 | 12 |
"""add_tags_gin_index
Revision ID: 7ccd65103917
Revises: b26e9f4b532d
Create Date: 2025-12-21 22:24:19.543818
GIN index on specs.tags JSONB column for fast tag filtering.
Supports queries like: WHERE tags->'plot_type' ? 'scatter'
"""
from typing import Sequence
from alembic import op
# revision identifiers, used ... | MarkusNeusinger/anyplot | alembic/versions/7ccd65103917_add_tags_gin_index.py | .py | 71fabd55ab6efad0 | 7.56 | 12 |
"""merge feedback + language migration heads
The feedback-widget branch (#7143) and the language-descriptions branch
(#7142) both descended from `3a7e1b5c0c4f` and merged to main
independently, leaving two alembic heads (`e5b1c9d4a7f2`,
`c5f9a3d72be1`). That broke `Sync: PostgreSQL` on every push to main
with "Multipl... | MarkusNeusinger/anyplot | alembic/versions/7efe9fc8bde1_merge_feedback_language_migration_heads.py | .py | be62ca2703ffa134 | 7.56 | 12 |
"""migrate_highcharts_to_javascript
Phase 2 of the JavaScript rollout (docs/concepts/library-expansion.md §6, the
"most-used variant" rule): native highcharts.js (~1 M npm downloads/wk) vastly
outweighs the highcharts-core Python wrapper (~5 k/wk), so the canonical
`highcharts` registry entry moves from Python to Java... | MarkusNeusinger/anyplot | alembic/versions/a1c7e2f9b8d3_migrate_highcharts_to_javascript.py | .py | 824f0b567a00d9bc | 7.56 | 12 |
"""add_impl_tags
Add impl_tags JSONB column to impls table for issue #2434:
Implementation-level tags describing HOW code is implemented.
5 dimensions: dependencies, techniques, patterns, dataprep, styling
Revision ID: a2f4b8c91d23
Revises: 6345896e2e90
Create Date: 2026-01-07
"""
from typing import Sequence
impor... | MarkusNeusinger/anyplot | alembic/versions/a2f4b8c91d23_add_impl_tags.py | .py | 0d4fa7c63ed36b57 | 7.56 | 12 |
"""add_description_to_libraries
Revision ID: b26e9f4b532d
Revises: 6a8ae95eaf56
Create Date: 2025-12-17 21:56:35.415221
"""
from typing import Sequence
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "b26e9f4b532d"
down_revision: str | None = "6a8ae95eaf56"... | MarkusNeusinger/anyplot | alembic/versions/b26e9f4b532d_add_description_to_libraries.py | .py | 702fe3bfef33b861 | 7.56 | 12 |
"""remove_preview_thumb_column
Revision ID: b833d85c09ed
Revises: a2f4b8c91d23
Create Date: 2026-03-31 23:07:22.910889
"""
from typing import Sequence
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "b833d85c09ed"
down_revision: str | None = "a2f4b8c91d23"
... | MarkusNeusinger/anyplot | alembic/versions/b833d85c09ed_remove_preview_thumb_column.py | .py | a838af859727921c | 7.56 | 12 |
"""remove_review_improvements_column
Revision ID: c36d82383e1d
Revises: d1d415f44d31
Create Date: 2025-12-22 23:35:11.604405
"""
from typing import Sequence
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "c36d8238... | MarkusNeusinger/anyplot | alembic/versions/c36d82383e1d_remove_review_improvements_column.py | .py | 18200b8398148025 | 7.56 | 12 |
"""add_feedback_table
Add `feedback` table for the in-app quick feedback widget (issue #5662).
Stores lightweight user remarks submitted via the floating widget on
anyplot.ai. Entries are immutable once written; triage is manual.
Revision ID: c5d7e9f1a3b2
Revises: 3a7e1b5c0c4f
Create Date: 2026-05-17
"""
from typin... | MarkusNeusinger/anyplot | alembic/versions/c5d7e9f1a3b2_add_feedback_table.py | .py | 933c3fc8e333b089 | 7.56 | 12 |
"""update language descriptions and backfill metadata
Refreshes the seeded `languages` rows so they carry meaningful descriptions
and complete metadata. The initial seed (LANGUAGES_METADATA) populated
python with a meta-y placeholder ("the default language for anyplot plot
implementations") that didn't actually descri... | MarkusNeusinger/anyplot | alembic/versions/c5f9a3d72be1_update_language_descriptions.py | .py | b2ac6422cea81fc2 | 7.56 | 12 |
"""add_performance_indexes
Add indexes on frequently queried columns for better query performance:
- impls.library_id (foreign key, heavily queried)
- specs.issue (lookup field)
- impls.quality_score (sorting/filtering)
Note: ix_impls_spec_id is NOT needed because the unique constraint on
(spec_id, library_id) create... | MarkusNeusinger/anyplot | alembic/versions/d0c76553a5cc_add_performance_indexes.py | .py | fb8d8807c143e8ec | 7.56 | 12 |
"""refactor_metadata_remove_history_add_review
Revision ID: d1d415f44d31
Revises: 7ccd65103917
Create Date: 2025-12-21 22:59:03.135462
"""
from typing import Sequence
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from alembic import op
# revision identifiers, used by Alembic.
revision: str =... | MarkusNeusinger/anyplot | alembic/versions/d1d415f44d31_refactor_metadata_remove_history_add_.py | .py | 318a9d1b2054e419 | 7.56 | 12 |
"""add_language_to_libraries
Revision ID: e1f3a2c4d5b6
Revises: b833d85c09ed
Create Date: 2026-04-20 12:00:00.000000
"""
from typing import Sequence
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "e1f3a2c4d5b6"
down_revision: str | None = "b833d85c09ed"
br... | MarkusNeusinger/anyplot | alembic/versions/e1f3a2c4d5b6_add_language_to_libraries.py | .py | a1a9cc00edade503 | 7.56 | 12 |
"""feedback_uuid_and_status
Two cleanups on the feedback table:
1. Fix `feedback.id` column type. PR #5662 created it as varchar(36), but the
model declares `UniversalUUID` which binds parameters as native UUID on
Postgres. Result: every read of a freshly-inserted row failed with
`operator does not exist: ch... | MarkusNeusinger/anyplot | alembic/versions/e5b1c9d4a7f2_feedback_uuid_and_status.py | .py | f69589753f060559 | 7.56 | 12 |
"""add_languages_table_and_preview_variants
Phase B of the big plot migration:
- Create a `languages` table (analog to `libraries`) so future R, JavaScript,
Julia etc. can be added without another schema change.
- Convert `libraries.language` (String) into `libraries.language_id` (FK → languages.id).
- Add `impls.la... | MarkusNeusinger/anyplot | alembic/versions/f2d9c8a1b4e0_add_languages_table_and_preview_variants.py | .py | dbe439a918918cd7 | 7.56 | 12 |
"""add_impl_check_constraints
Close a model↔migration drift on the impls table: the ORM
(core/database/models.py, Impl.__table_args__) has declared
`ck_quality_score_range` and `ck_review_verdict_valid` since the columns were
introduced, but no migration ever created them — so databases built via the
migration chain (... | MarkusNeusinger/anyplot | alembic/versions/f4b8d2c6a9e1_add_impl_check_constraints.py | .py | c76cd59735851d81 | 7.56 | 12 |
"""add_framework_to_libraries
Adds the `framework` column to the libraries table. It models the UI-framework
runtime constraint a charting library imposes (none | react | vue | svelte |
angular) so a single `javascript` language entry can cover both
framework-agnostic libraries (Chart.js, D3, ECharts) and React-only l... | MarkusNeusinger/anyplot | alembic/versions/f7a2c9d4e8b1_add_framework_to_libraries.py | .py | 5f0f7e6085115374 | 7.56 | 12 |
#!/usr/bin/env python3
"""Build/refresh manifest.json — the asset index for every generated image.
Scans all job JSON files (batch*.json, cover.json, mockups.json …) for
prompts/params, matches them to files on disk, records derived variants
(cut/md/sm/lg/webp) with sizes. Existing manifest entries win on fields
the s... | skywain/trip-planner-skill | themes/build_manifest.py | .py | 9f383edb8f51ec84 | 7.62 | 16 |
#!/usr/bin/env python3
"""Split one generated sprite SHEET into individual cut-out assets.
Why: gpt-image-2 bills per image, so N small props cost N × $0.053 when
generated one by one. Asking for ONE sheet with N props laid out on a white
grid costs $0.053 total — then this script finds the white gutters, crops
each c... | skywain/trip-planner-skill | themes/split_sheet.py | .py | 689521c1fdaa8b41 | 7.62 | 16 |
#!/usr/bin/env python3
"""PNG → embeddable webp, plus the sized variants data_uri() knows about.
The renderers only ever inline webp (theme_common.data_uri). cutout.py and
split_sheet.py already write `<stem>.cut.webp` for transparent stickers; this
is the missing step for everything else — an opaque 16:9 night plate,... | skywain/trip-planner-skill | themes/towebp.py | .py | 460edf132a7a5f3c | 7.62 | 16 |
#!/usr/bin/env python3
"""
Analyze profiling results from cProfile output.
Extracts top bottlenecks and generates a summary report.
Usage: python analyze_profile.py PROFILE_FILE [--detailed]
"""
import argparse
import pstats
import sys
from pathlib import Path
def analyze_profile(prof_file: str, detailed: bool = Fa... | cwensel/arcaneum | scripts/analyze_profile.py | .py | deb2f0e4c5987363 | 7.45 | 7 |
#!/usr/bin/env python3
"""
Benchmarking script for indexing pipeline performance.
This script measures:
1. Embedding generation speed (embeddings/sec, GPU utilization)
2. PDF indexing throughput (chunks/sec, bytes/sec)
3. Batch size impact (256 vs 512 vs 1024)
4. GPU vs CPU comparison
5. Multi-file indexing with paral... | cwensel/arcaneum | scripts/benchmark_indexing.py | .py | 9a73529fcb67e1d5 | 7.45 | 7 |
#!/usr/bin/env python3
"""
PDF indexing benchmark script.
Measures real-world PDF indexing performance with the optimizations applied.
Features:
- Test on sample PDFs or generate synthetic PDFs for testing
- Measure throughput: chunks/sec, bytes/sec, embeddings/sec
- GPU utilization tracking
- Memory usage profiling
... | cwensel/arcaneum | scripts/benchmark_pdf_indexing.py | .py | 346090fa03717c5d | 7.45 | 7 |
#!/usr/bin/env python3
"""
Profile PDF indexing pipeline with cProfile to identify CPU bottlenecks.
Usage: python profile_indexing.py --pdfs NUM_PDFS [--pages PAGES_PER_PDF] [--output OUTFILE]
"""
import argparse
import cProfile
import pstats
import sys
import tempfile
from pathlib import Path
from io import StringIO
... | cwensel/arcaneum | scripts/profile_indexing.py | .py | 9d5c8a34eb4c9ab3 | 7.45 | 7 |
#!/usr/bin/env python3
"""
Profile PDF indexing with cProfile using the existing benchmark infrastructure.
Generates test PDFs and indexes them, collecting CPU profiling data.
Usage: python profile_with_cprofile.py --pdfs NUM --pages PAGES
"""
import argparse
import cProfile
import pstats
import sys
import os
from pa... | cwensel/arcaneum | scripts/profile_with_cprofile.py | .py | 8de9e6d968bbcc5e | 7.45 | 7 |
#!/usr/bin/env python3
"""
Monitor Qdrant segment consolidation progress.
Usage:
python3 scripts/qdrant-monitor-segments.py [--watch] [--interval SECONDS]
"""
import argparse
import sys
import time
from qdrant_client import QdrantClient
def get_collection_stats(client):
"""Get segment counts for all collect... | cwensel/arcaneum | scripts/qdrant-monitor-segments.py | .py | 86f5bdb43ec13f8c | 7.45 | 7 |
"""Cross-process concurrency caps for embedder-loading commands.
Background: every `arc search semantic` invocation cold-loads an embedding
model into a fresh Python process. When agents fan out N parallel searches,
N copies of the model end up resident at once, which on consumer hardware
thrashes RAM/swap (observed: ... | cwensel/arcaneum | src/arcaneum/cli/concurrency.py | .py | 670a3653ae191b19 | 7.45 | 7 |
"""Configuration and cache management commands."""
import shutil
import click
from pathlib import Path
from arcaneum.paths import get_models_dir, get_data_dir, get_legacy_arcaneum_dir
from arcaneum.cli.output import print_info, print_success, print_error, print_json
from arcaneum.utils.formatting import format_size
... | cwensel/arcaneum | src/arcaneum/cli/config.py | .py | 96096628c14c53ac | 7.45 | 7 |
"""Command wrapper utilities for consistent error handling and logging.
This module provides decorators and context managers for CLI command functions
that standardize:
- Interaction logging (RDR-018)
- Error handling with proper exit codes
- Custom exception handling (InvalidArgumentError, ResourceNotFoundError)
Exa... | cwensel/arcaneum | src/arcaneum/cli/core/command_wrapper.py | .py | 1616a8c004ae08c7 | 7.45 | 7 |
"""Per-corpus advisory write lock (kata htmw).
`arc corpus sync` reads "what is already indexed" and then writes to both
Qdrant and MeiliSearch. Those two steps are not atomic with respect to another
run, so two concurrent syncs of the same corpus interleave and produce
duplicate points/documents, lost deletes under `... | cwensel/arcaneum | src/arcaneum/cli/corpus_lock.py | .py | e0cca669b406f864 | 7.45 | 7 |
"""Setup verification and diagnostics command (RDR-006 enhancement)."""
import importlib.util
import os
import sys
from typing import Dict, Tuple
from rich.console import Console
from rich.table import Table
from arcaneum.cli.errors import EXIT_ERROR, EXIT_SUCCESS
from arcaneum.cli.output import print_error, print_i... | cwensel/arcaneum | src/arcaneum/cli/doctor.py | .py | 4d0af8511b2c955a | 7.45 | 7 |
"""Console-script entry point that names the process before doing real work.
`arcaneum.cli.main` transitively imports qdrant_client and fastembed, which
costs roughly 700ms. Setting the process title from inside `main()` meant a
short-lived `arc` -- the hook's spool call, or a drain that exits immediately
on a held lo... | cwensel/arcaneum | src/arcaneum/cli/entrypoint.py | .py | 2b98cd5c48a987ac | 7.45 | 7 |
"""Custom exception classes for CLI error handling (RDR-006).
This module defines exception classes that map to specific exit codes following
reference implementation practices for structured error handling.
Exit Codes:
- 0: Success
- 1: General error
- 2: Invalid arguments
- 3: Resource not found
"""
# Exit codes (... | cwensel/arcaneum | src/arcaneum/cli/errors.py | .py | e5caed51a7977085 | 7.45 | 7 |
"""Compute the files a git revision or range touched (kata vq0n).
`arc corpus sync --changed-since <rev>` and the installed git hook both need
the same question answered: which paths did this commit (or this range) add,
modify, or delete? Asking git is far cheaper than walking a large working tree
just to have mtime+s... | cwensel/arcaneum | src/arcaneum/cli/git_changes.py | .py | e1c684ed1402a30e | 7.45 | 7 |
"""Shared record for hook-driven indexing (follow-up to kata vq0n).
A drain that fails leaves the same empty spool a drain that succeeded does,
once the batch is consumed. Without a line per batch there is no way to tell
those apart afterwards -- and a launchd-driven drain wrote nowhere at all,
because the plist captu... | cwensel/arcaneum | src/arcaneum/cli/hook_log.py | .py | b364ad17018b6136 | 7.45 | 7 |
"""Arc CLI interaction logging (RDR-018).
Logs all Arc CLI interactions to ~/.arcaneum/logs/ for:
- Debugging search patterns and query effectiveness
- Understanding search behavior over time (both agent and user)
- Auditing Arc usage across sessions
- Correlating search patterns with project work
"""
import json
imp... | cwensel/arcaneum | src/arcaneum/cli/interaction_logger.py | .py | 26d61c98184ab3ef | 7.45 | 7 |
"""Log inspection commands for Arcaneum."""
from __future__ import annotations
import sys
import time
from collections.abc import Callable
from datetime import datetime, timezone
from pathlib import Path
from typing import TextIO
from arcaneum.cli.interaction_logger import InteractionLogger
def current_interaction... | cwensel/arcaneum | src/arcaneum/cli/logs.py | .py | 7e3fb90e5eaeb581 | 7.45 | 7 |
"""Model listing CLI command (RDR-003 with RDR-006 enhancements)."""
from rich.console import Console
from rich.table import Table
from arcaneum.cli.corpus_defaults import DEFAULT_MODELS_BY_CORPUS_TYPE
from arcaneum.cli.output import print_json
from arcaneum.embeddings.client import EMBEDDING_MODELS
from arcaneum.uti... | cwensel/arcaneum | src/arcaneum/cli/models.py | .py | e18e3d9a764b1036 | 7.45 | 7 |
"""Streaming backends: what actually differs between sunshine and moonshine.
podstage streams a sandboxed Steam Big Picture to a moonlight client. *How*
that picture is composited, captured and encoded is the backend's job, and
there are two:
``sunshine``
The original chain: labwc (headless) → gamescope (nested) ... | slooock-dev/podstage | src/podstage/core/backends.py | .py | 2095a3076856e52e | 7.64 | 18 |
"""Graphical privilege elevation via pkexec.
The GUI must never ask the user to copy sudo commands into a terminal. Every
root-gated setup step (udev rules, CDI spec, firewalld) runs through
:func:`run_root`, which shows the desktop polkit password dialog. polkit's
default for pkexec is ``auth_admin_keep`` — consecuti... | slooock-dev/podstage | src/podstage/core/elevate.py | .py | 94096e5c0c84d1a9 | 7.64 | 18 |
"""Provision an isolated streaming Steam instance with shared game files.
Strategy (see CONTRIBUTING.md): the streaming Steam runs under its own ``$HOME``
so it can run concurrently with the desktop Steam and keep separate settings.
For each streamable app we:
* symlink ``steamapps/common/<installdir>`` to the main... | slooock-dev/podstage | src/podstage/core/provisioner.py | .py | 0b15bdb062664341 | 7.64 | 18 |
"""Sandbox HOME inspection and lifecycle (``<homes root>/<client>``).
A sandbox holds a logged-in Steam and grows to gigabytes — everything here is
deliberately conservative: deletion refuses paths outside SESSIONS_HOME_ROOT
and falls back to an elevated ``rm -rf`` only when user-level deletion hits
foreign-owned file... | slooock-dev/podstage | src/podstage/core/sandbox.py | .py | c5192075f49d4525 | 7.64 | 18 |
"""Locate the desktop Steam install and enumerate its library folders.
Used by ``doctor`` (validation) and later by the provisioner (to symlink shared
game files into an isolated streaming library).
"""
import re
from dataclasses import dataclass
from pathlib import Path
HOME = Path.home()
# Candidate locations for... | slooock-dev/podstage | src/podstage/core/steam.py | .py | 56b7c05434b789ef | 7.64 | 18 |
"""Host udev rules — the one root-gated setup step of podstage.
The rootless runtime container needs two udev rules on the host:
* ``99-podstage-virtual-inputs.rules`` (static, shipped in ``host/``) — pins
the streaming input devices to seat9 with MODE=0600 so they never reach
the desktop seat.
* ``71-pod... | slooock-dev/podstage | src/podstage/core/udev.py | .py | 28978cfb753fe926 | 7.64 | 18 |
"""Release update check against the GitHub releases API.
On demand only (Setup-page button): one anonymous GET, no telemetry.
"""
import json
import re
import urllib.error
import urllib.request
from dataclasses import dataclass
from .. import __version__
REPO = "slooock-dev/podstage"
RELEASES_API = f"https://api.gi... | slooock-dev/podstage | src/podstage/core/update.py | .py | 609d8620a86ae777 | 7.64 | 18 |
"""Lightweight translation layer for the management GUI.
English is the source language: every user-facing string in ``ui.*`` is written
in English and wrapped in :func:`tr`. Translations live in ``ui/translations/``
as plain ``{english: translated}`` dicts — no build step, no binary catalogs,
no external tooling. A m... | slooock-dev/podstage | src/podstage/ui/i18n.py | .py | 81d5dc8479be1a35 | 7.64 | 18 |
"""Small shared building blocks: cards, meters, key-value rows."""
from PyQt6.QtCore import QRect, QSize, Qt
from PyQt6.QtGui import QPainter, QPixmap
from PyQt6.QtWidgets import (
QFrame,
QHBoxLayout,
QLabel,
QProgressBar,
QVBoxLayout,
QWidget,
)
class AspectPixmapLabel(QLabel):
"""Label... | slooock-dev/podstage | src/podstage/ui/widgets.py | .py | ffdbd15286ea06c8 | 7.64 | 18 |
"""Worker threads shared by the UI pages.
Every blocking call (telemetry sampling, podman, du, pkexec dialogs, doctor
checks) runs on a QThread so the window never freezes. Pages keep their
workers in a list (``start_action``) so Qt does not garbage-collect a running
thread.
"""
from collections.abc import Callable
... | slooock-dev/podstage | src/podstage/ui/workers.py | .py | 9d5bb9da6798f025 | 7.64 | 18 |
"""Shared fixtures: keep tests away from the real per-install state."""
import pytest
from podstage import config
from podstage.core import desktop
@pytest.fixture(autouse=True)
def _tmp_desktop_files(tmp_path, monkeypatch):
"""Point the XDG integration files at tmp paths. Uninstall removes them,
so without... | slooock-dev/podstage | tests/conftest.py | .py | 1ee1b4b2143ae4ee | 8.14 | 18 |
"""Tests for the streaming-backend registry."""
import pytest
from podstage.core import backends
def test_default_is_sunshine():
assert backends.DEFAULT == "sunshine"
assert backends.get() is backends.SUNSHINE
assert backends.get("") is backends.SUNSHINE
def test_lookup_and_names():
assert backend... | slooock-dev/podstage | tests/test_backends.py | .py | 1a2e3b4e62e3d26c | 8.14 | 18 |
"""Tests for the host udev rule generation (the one root-gated setup step)."""
from podstage.core import udev
def test_owner_rule_grants_exactly_the_user():
text = udev.owner_rule_text(user="alice")
assert text.count('OWNER="alice"') == 5 # input x3 + uinput + uhid
# DAC is purely owner-based — groups d... | slooock-dev/podstage | tests/test_udev.py | .py | 8370b844205bf78b | 8.14 | 18 |
#!/usr/bin/env python3
"""Format currency amounts to Israeli Shekel (ILS) standard.
Converts numeric values to properly formatted Israeli Shekel strings
with thousands separators and the standard ILS notation.
Usage:
python scripts/shekel-formatter.py 15000
python scripts/shekel-formatter.py 15000 --vat
python ... | skills-il/communication | gws-hebrew-email-automation/scripts/shekel-formatter.py | .py | d1f45d97a96ee144 | 7.45 | 7 |
#!/usr/bin/env python3
"""
Israeli Hebrew Support Ticket Classifier
Classifies Hebrew support tickets by category and priority based on keyword
analysis. Supports single ticket classification and batch processing from CSV.
Usage:
python ticket-classifier.py --text "הכרטיס שלי חויב פעמיים" --lang he
python tic... | skills-il/communication | israeli-customer-support-automator/scripts/ticket-classifier.py | .py | 6345a23c20838510 | 7.45 | 7 |
#!/usr/bin/env python3
"""
Israeli Job Description Generator
Draft Hebrew job descriptions and check them against the published
requirements of the Equal Employment Opportunities Law 1988. Flags wording
that matches known discriminatory patterns and outputs formatted markdown.
A clean run is NOT a compliance result.
... | skills-il/communication | israeli-hr-recruitment-automator/scripts/job-description-generator.py | .py | 077a52bd1f8513c8 | 7.45 | 7 |
#!/usr/bin/env python3
"""
morning-brief.py
Generates a structured morning brief template for Israeli workdays.
- Fetches the Hebrew date for today (or a given date) from the HebCal API
- Lists upcoming Jewish holidays in the next 30 days
- Checks if today is a short day (Friday or Erev Chag)
- Prints a formatted bri... | skills-il/communication | israeli-personal-assistant/scripts/morning-brief.py | .py | 746aec9cf9a26507 | 7.45 | 7 |
#!/usr/bin/env python3
"""Validate and normalize Israeli phone numbers.
Usage:
python validate_phone.py <phone_number>
python validate_phone.py 054-1234567
python validate_phone.py +972541234567
python validate_phone.py "054 123 4567"
Returns the normalized international format (+972XXXXXXXXX) if vali... | skills-il/communication | israeli-sms-gateway/scripts/validate_phone.py | .py | 7380a276aa30b6b9 | 7.45 | 7 |
"""
FastAPI application for AKS configuration exercise.
This API demonstrates AKS configuration patterns including:
- ConfigMaps for non-sensitive configuration
- Secrets for sensitive data
- Persistent volumes for log storage
Endpoints:
- GET /healthz - Liveness probe
- GET /readyz - Readiness probe
- GET /secrets -... | MicrosoftLearning/mslearn-azure-ai | finished/aks/configure-aks/python/api/main.py | .py | 6bc0ffc31a9b0102 | 7.52 | 10 |
"""
Console application client for interacting with the AKS Configuration API.
This client provides a menu-driven interface for students to:
1. Check the health and readiness of the deployed API
2. View mock secrets loaded from Kubernetes Secrets
3. Retrieve a single product by ID
4. List all available products
5. Vie... | MicrosoftLearning/mslearn-azure-ai | finished/aks/configure-aks/python/client/main.py | .py | 6152311b863137fe | 7.52 | 10 |
"""
FastAPI application for AKS deployment with Foundry model integration.
This API acts as a gateway between clients and the gpt-5-mini model hosted in Microsoft Foundry.
Endpoints:
- GET /healthz - Liveness probe
- GET /readyz - Readiness probe (checks Foundry connectivity)
- POST /v1/inference - Synchronous infere... | MicrosoftLearning/mslearn-azure-ai | finished/aks/deploy-aks/python/api/main.py | .py | c64986620c78e67a | 7.52 | 10 |
import os
import sys
import redis
from redis_entraid.cred_provider import create_from_default_azure_credential
def clear_screen():
"""Clear console screen (cross-platform)"""
os.system('cls' if os.name == 'nt' else 'clear')
clear_screen()
def connect_to_redis() -> redis.Redis:
"""Establish connection to ... | MicrosoftLearning/mslearn-azure-ai | finished/amr/data-operations/python/main.py | .py | 77217793209ac169 | 7.52 | 10 |
"""
Flask application demonstrating publish/subscribe messaging with Azure Managed Redis.
A single page lets you publish event messages to Redis channels and subscribe to
channels or patterns. Received messages are displayed live by polling the
/messages endpoint.
"""
import logging
import os
import threading
from fl... | MicrosoftLearning/mslearn-azure-ai | finished/amr/pub-sub/python/client/app.py | .py | 34cf79b90289fb17 | 7.52 | 10 |
"""
Pub/sub functions for Azure Managed Redis. These functions serve as the
interface between the Flask app and Azure Managed Redis, handling the
connection, publishing events, subscribing to channels, and listening for
incoming messages on a background thread.
"""
import json
import os
import threading
import time
fro... | MicrosoftLearning/mslearn-azure-ai | finished/amr/pub-sub/python/client/pubsub_functions.py | .py | 8fe233315f0365fa | 7.52 | 10 |
"""Flask app for vector storage and similarity search with Azure Managed Redis."""
import logging
import os
import threading
from flask import Flask, flash, redirect, render_template, request, url_for
from vector_functions import VectorManager
app = Flask(__name__)
app.secret_key = os.urandom(24)
_manager = None
_m... | MicrosoftLearning/mslearn-azure-ai | finished/amr/vector-query/python/client/app.py | .py | fa7bccf5ed2a9c75 | 7.52 | 10 |
"""
Vector storage and search helpers for Azure Managed Redis.
This module contains the student-editable sections used by the Flask app:
- connect to Redis with Microsoft Entra ID
- create the RediSearch vector index
- store product embeddings and metadata
- execute vector similarity searches
"""
import json
import o... | MicrosoftLearning/mslearn-azure-ai | finished/amr/vector-query/python/client/vector_functions.py | .py | 3f6b97c2d2c3f0cb | 7.52 | 10 |
"""
Flask application demonstrating configuration management with Azure App Configuration.
Provides routes for loading, listing, and dynamically refreshing settings.
"""
import logging
import os
from flask import Flask, render_template, redirect, url_for, flash
from appconfig_functions import (
load_settings,
... | MicrosoftLearning/mslearn-azure-ai | finished/app-sec-config/app-config/python/client/app.py | .py | 71e53c238988ee1b | 7.52 | 10 |
"""
App Configuration management functions for loading, listing,
and refreshing configuration settings.
These functions serve as the interface between the Flask app and Azure App Configuration.
"""
import os
import time
from azure.identity import DefaultAzureCredential
from azure.appconfiguration import AzureAppConfigu... | MicrosoftLearning/mslearn-azure-ai | finished/app-sec-config/app-config/python/client/appconfig_functions.py | .py | 150a2d3e600b3443 | 7.52 | 10 |
"""
Flask application demonstrating secret management with Azure Key Vault.
"""
import logging
import os
import uuid
from flask import Flask, render_template, redirect, url_for, flash
from keyvault_functions import (
retrieve_secrets,
list_secret_properties,
create_secret_version,
cached_retrieval
)
a... | MicrosoftLearning/mslearn-azure-ai | finished/app-sec-config/key-vault/python/client/app.py | .py | 7fc8f24bd02149f4 | 7.52 | 10 |
"""
Key Vault secret management functions for storing, retrieving, and caching secrets.
These functions serve as the interface between the Flask app and Azure Key Vault.
"""
import os
import time
from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
from azure.core.exceptions... | MicrosoftLearning/mslearn-azure-ai | finished/app-sec-config/key-vault/python/client/keyvault_functions.py | .py | 1f8bea2cb3a49066 | 7.52 | 10 |
"""Document Processing API - Mock service for Azure App Service exercise."""
import json
import logging
import os
import uuid
from datetime import datetime
from flask import Flask, jsonify, request
app = Flask(__name__)
# Configuration from environment variables
ENVIRONMENT = os.getenv("ENVIRONMENT", "development")... | MicrosoftLearning/mslearn-azure-ai | finished/container-hosting/app-service/python/api/main.py | .py | 3862761bad658344 | 7.52 | 10 |
"""
Flask application demonstrating RAG document storage with Azure Cosmos DB for NoSQL.
"""
import json
import logging
import os
from flask import Flask, render_template, request, redirect, url_for, flash
from rag_functions import (
store_document_chunk,
get_chunks_by_document,
search_chunks_by_metadata,
... | MicrosoftLearning/mslearn-azure-ai | finished/cosmosdb/build-query/python/client/app.py | .py | 6a4e30ef21006365 | 7.52 | 10 |
"""
RAG document functions for storing and retrieving document chunks from Cosmos DB.
These functions serve as the interface between the Flask app and Cosmos DB.
"""
import os
from datetime import datetime
from azure.cosmos import CosmosClient, exceptions
from azure.identity import DefaultAzureCredential
def get_cont... | MicrosoftLearning/mslearn-azure-ai | finished/cosmosdb/build-query/python/client/rag_functions.py | .py | f16c14ad8fac438e | 7.52 | 10 |
"""Benchmark base protocol."""
from dataclasses import dataclass, field
from typing import Protocol
@dataclass
class Task:
id: str
prompt: str
metadata: dict = field(default_factory=dict)
class Benchmark(Protocol):
name: str
def load_tasks(self) -> list[Task]: ...
def build_prompt(self, ta... | DogukanUrker/BenchKit | src/benchkit/benchmarks/base.py | .py | 34cdf5b77e11be9c | 7.13 | 17 |
"""IFEval benchmark - verifiable instruction following.
541 prompts, each carrying one or more instructions that can be checked with
code ("write at least 300 words", "no commas", "wrap the title in <<>>").
A task counts as passed only when every instruction attached to it is
followed, which is the strict prompt-level... | DogukanUrker/BenchKit | src/benchkit/benchmarks/ifeval.py | .py | 1bab261fcfe0dfff | 7.63 | 17 |
"""Helpers for messy multiple-choice model outputs."""
import re
DEFAULT_LETTERS = "ABCD"
# Letters that are also ordinary English words. Once the option list runs past
# D a bare "I" or "A" in prose is far more likely to be a pronoun or an article
# than an answer, so they only count when punctuation marks them as ... | DogukanUrker/BenchKit | src/benchkit/benchmarks/mcq.py | .py | 6833777a2c5fc083 | 7.63 | 17 |
"""MMLU-Pro benchmark - reasoning-heavy academic QA with ten options."""
import json
from pathlib import Path
from benchkit.benchmarks.base import Task
from benchkit.benchmarks.mcq import extract_choice
from benchkit.benchmarks.utils import strip_think_tags
DATASET = Path(__file__).parent.parent / "datasets" / "mmlu... | DogukanUrker/BenchKit | src/benchkit/benchmarks/mmlu_pro.py | .py | 9dbf5daf63478551 | 7.63 | 17 |
"""XSTest exaggerated-safety benchmark with its offline string matcher.
The canonical string matcher is intentionally simple: it detects common refusal
openings but cannot recognize partial refusals or refusals phrased in novel ways.
"""
import csv
from pathlib import Path
from benchkit.benchmarks.base import Task
f... | DogukanUrker/BenchKit | src/benchkit/benchmarks/xstest.py | .py | af97fc04405163db | 8.13 | 17 |
"""Sandboxed code execution via subprocess."""
import subprocess
import sys
import tempfile
from dataclasses import dataclass
from pathlib import Path
BLOCKED_MODULES = {
"subprocess",
"shutil",
"socket",
"http",
"urllib",
"requests",
"signal",
"ctypes",
"multiprocessing",
}
SANDB... | DogukanUrker/BenchKit | src/benchkit/executor.py | .py | 31b78fc05d34e00e | 7.63 | 17 |
"""Shared deterministic guards against structurally leaked benchmark answers."""
from __future__ import annotations
from collections import Counter
from itertools import pairwise
from os.path import commonprefix
class PromptLeakageError(ValueError):
"""Raised when task construction makes an answer structurally ... | DogukanUrker/BenchKit | src/benchkit/leakage.py | .py | 9f99627fa6574b84 | 7.63 | 17 |
"""Throughput metrics shared by execution, front-ends and reports."""
from __future__ import annotations
from collections.abc import Mapping
def throughput_metrics(
*,
output_tokens: int,
generation_time_s: float,
request_time_s: float,
wall_time_s: float,
) -> dict[str, float]:
"""Calculate... | DogukanUrker/BenchKit | src/benchkit/metrics.py | .py | e26ab6d5ddb2dedc | 7.63 | 17 |
"""Deterministic, benchmark-aware input perturbations."""
from __future__ import annotations
import hashlib
import random
from dataclasses import dataclass, replace
from benchkit.benchmarks.base import Task
CHOICE_ORDER = "choice-order"
PERTURBATIONS = (CHOICE_ORDER,)
# Every benchmark here stores visible options ... | DogukanUrker/BenchKit | src/benchkit/perturbations.py | .py | eff87931bffbaa72 | 7.63 | 17 |
"""Retry policy for transient inference-server failures.
Inference servers behind proxies or model swappers routinely answer with
``502``/``503`` while a model loads or a worker restarts, and busy servers such
as ``llama-server`` answer with ``429`` when their slots are full. Those
failures are short-lived, so BenchKi... | DogukanUrker/BenchKit | src/benchkit/retry.py | .py | f4ef36fcda932b6f | 7.63 | 17 |
"""Render the Fast-Mimi v2 AgentKernel result table from committed evidence."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
ROOT = Path(__file__).resolve().parent
def load_results() -> dict[str, Any]:
"""Load the immutable v2 summary."""
return json.loads(... | kadirnar/fast-mimi | benchmarks/agentkernel_v2/render_table.py | .py | a32698b8704e5922 | 7.42 | 6 |
"""Optional exact-float32 CUDA backend for the profiled Q32 RVQ decode path.
The source is compiled lazily into an external cache. The Python package keeps
no generated binary and callers automatically fall back to PyTorch when the
compiler, shape, device, or launch contract is unavailable.
"""
from __future__ import... | kadirnar/fast-mimi | src/fast_mimi/_cuda_rvq.py | .py | bcdfff6b400c0715 | 7.42 | 6 |
"""Optional bearer token authentication middleware.
If MCP_AUTH_TOKEN is set in the environment, all incoming HTTP requests
must include a matching Authorization: Bearer <token> header. If the
env var is not set, all requests are allowed (backwards compatible).
Uses a pure ASGI middleware instead of BaseHTTPMiddlewar... | pete-builds/strava-mcp-vault | src/strava_mcp_vault/auth.py | .py | 463cf900399c3b4c | 7.52 | 10 |
"""Optional Fernet encryption for tokens at rest.
If TOKEN_ENCRYPTION_KEY is set in the environment, tokens are encrypted
before writing to SQLite and decrypted on read. If not set, tokens are
stored and returned as plaintext (backwards compatible).
"""
import logging
import os
logger = logging.getLogger(__name__)
... | pete-builds/strava-mcp-vault | src/strava_mcp_vault/cache/encryption.py | .py | 60bafdf2831ce025 | 7.52 | 10 |
"""Nominatim geocoding helpers (forward + reverse, no API key required)."""
import asyncio
import json
import logging
import time
import urllib.parse
import urllib.request
logger = logging.getLogger(__name__)
_USER_AGENT = "strava-mcp-vault/1.0"
_BASE = "https://nominatim.openstreetmap.org"
_last_request_time: float... | pete-builds/strava-mcp-vault | src/strava_mcp_vault/cache/geocode.py | .py | 795d57f890bbc6f9 | 7.52 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.