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 |
|---|---|---|---|---|---|---|
"""Unauthenticated commit provenance for issue-origin PR recovery.
This is deliberately a conventional Git trailer, not a durable protocol
marker. It helps avoid adopting an unrelated open PR after an interrupted
issue implementation, but contributors can copy it, so it is not an
authentication boundary.
"""
from __... | wwind123/coding-review-agent-loop | src/coding_review_agent_loop/issue_pr_provenance.py | .py | 6e9ef1390caa05da | 7.54 | 11 |
"""Lightweight transient/non-retryable agent-output classification.
Extracted from ``orchestrator`` so callers that must stay dependency-light
(e.g. the skill's ``helpers.run_external`` subprocess launcher) can decide
whether to retry an agent invocation without importing the full orchestrator.
"""
from __future__ im... | wwind123/coding-review-agent-loop | src/coding_review_agent_loop/transient.py | .py | b86221b0c3cb6ca0 | 7.54 | 11 |
"""
Fix for Issue #731 — Bleichenbacher Oracle in RSA-OAEP Decryption
Vulnerability
-------------
The RSA decryption endpoint returns different error messages (or timing
signatures) for different PKCS#1 padding validation failures during OAEP
decryption. An attacker can exploit this as a Bleichenbacher-style padding
o... | zhangjiayang6835-cyber/ai-research | FIXES/bleichenbacher_oracle_fix.py | .py | 7f3157a1ad83f6dd | 7.57 | 13 |
"""
Fix for Issue #40 — HTTP Parameter Pollution
Agent: lushan888 (via dev-nana27)
Bounty: $10 USD
Fix: Validate and deduplicate HTTP parameters by keeping only the first value,
and reject requests with duplicate parameters to prevent HPP attacks.
"""
from flask import request, jsonify
from urllib.parse import parse_... | zhangjiayang6835-cyber/ai-research | FIXES/fix_http_param_pollution_40.py | .py | 75bc96b19f5dd97c | 7.57 | 13 |
"""
Fix for Issue #722 — Hardcoded AWS Keys in Public Artifact → Cloud Takeover
Vulnerability
-------------
CI/CD build artifacts (Docker images, npm packages) contain hardcoded
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY. Attackers who obtain these
artifacts can extract the credentials and access cloud resources.
Fix
... | zhangjiayang6835-cyber/ai-research | FIXES/hardcoded_aws_keys_fix.py | .py | 8ebd9badcefcc33a | 7.57 | 13 |
"""
Fix for Issue #743 — CL.TE HTTP Request Smuggling
Vulnerability
-------------
Frontend nginx uses Content-Length while backend uses Transfer-Encoding: chunked.
Attacker crafts ambiguous requests, causing request smuggling and cache poisoning.
Fix
---
- Reject requests with both Content-Length and Transfer-Encodin... | zhangjiayang6835-cyber/ai-research | FIXES/http_smuggling_fix_743.py | .py | 1b714b5a8d58af42 | 7.57 | 13 |
"""
Fix for Issue #735 — JWT Algorithm Confusion (RS256→HS256 Downgrade)
Vulnerability
-------------
The JWT library is configured to accept tokens signed with RS256 (asymmetric,
using a public/private key pair). However, the server does not validate the
`alg` header before verification. An attacker can change the alg... | zhangjiayang6835-cyber/ai-research | FIXES/jwt_algorithm_confusion_fix.py | .py | 8adde18778a4ba00 | 7.57 | 13 |
"""
Fix for Issue #951 — Log Injection → Log Forging → SIEM Poisoning
Vulnerability
-------------
User-controlled input (username, user-agent, etc.) is directly interpolated
into log messages using f-strings or string formatting. An attacker can inject
newline characters (\r\n) to forge fake log entries, pollute SIEM ... | zhangjiayang6835-cyber/ai-research | FIXES/log_injection_fix.py | .py | cee7b38d97c0e69f | 7.57 | 13 |
"""
Fix for Issue #719 — Predictable OAuth State Token → CSRF + Account Takeover
Vulnerability
-------------
The OAuth state parameter was generated using predictable values (auto-increment
integers or timestamps). An attacker could predict the next state value, craft a
malicious OAuth authorization URL, and trick a v... | zhangjiayang6835-cyber/ai-research | FIXES/predictable_oauth_state_fix.py | .py | f4700fc39877823c | 7.57 | 13 |
"""
Fix for Issue #737 — Server-Side Prototype Pollution to RCE
Vulnerability
-------------
Express application uses lodash.merge to merge user-supplied JSON input.
An attacker can set __proto__ or constructor.prototype keys to pollute
the global Object prototype, achieving Remote Code Execution.
Fix
---
- Reject __p... | zhangjiayang6835-cyber/ai-research | FIXES/prototype_pollution_fix.py | .py | 17478d8a2efd15e7 | 7.57 | 13 |
"""
Fix for Issue #732 — Reentrancy via ERC-777 Callback in Withdraw Function
Vulnerability
-------------
The withdraw function uses the Checks-Effects-Interactions pattern partially:
it checks the balance, sends ETH (which triggers the ERC-777 tokensReceived
callback on the recipient), and only then updates the balan... | zhangjiayang6835-cyber/ai-research | FIXES/reentrancy_erc777_fix.py | .py | 938a98e0cef3381d | 7.57 | 13 |
"""
Fix for Issue #747 — Java RMI Deserialization to RCE
Vulnerability
-------------
Java RMI endpoint exposed on public network. Attacker uses ysoserial to send
crafted deserialization payloads triggering Runtime.exec().
Fix
---
- Enable JEP 290 deserialization filter
- Restrict RMI to localhost binding
- Whitelist ... | zhangjiayang6835-cyber/ai-research | FIXES/rmi_deserialization_fix.py | .py | 3dc08436bd14e830 | 7.57 | 13 |
"""
Fix for Issue #959 — Session Fixation + Session ID in URL
Vulnerability
-------------
The application accepts a session ID from the URL query parameter (e.g.,
?session_id=abc123). An attacker can craft a URL with a known session ID,
send it to the victim, and after the victim logs in, the attacker uses the
same se... | zhangjiayang6835-cyber/ai-research | FIXES/session_fixation_fix.py | .py | 86d3c71b3e0202ac | 7.57 | 13 |
"""
Fix for Issue #967 — Timing Attack on Password Verification → User Enumeration
Vulnerability
-------------
The password verification function returns early when the username is not found,
then performs a string comparison on the password hash. This creates a measurable
timing difference between:
1. Valid username ... | zhangjiayang6835-cyber/ai-research | FIXES/timing_attack_password_fix.py | .py | 899bc6baf2e46d77 | 7.57 | 13 |
"""
Fix for Issue #734 — Race Condition in /tmp File Handling (TOCTOU)
Vulnerability
-------------
The script first checks whether `/tmp/lock` exists, then creates and writes to it.
An attacker can replace the file with a symlink pointing to `/etc/passwd` between
the check and create operations (TOCTOU race condition)... | zhangjiayang6835-cyber/ai-research | FIXES/toctou_fix.py | .py | 5351a6fa2beff813 | 7.57 | 13 |
"""
Fix for Issue #726 — TOTP Secret Leaked via QR Code in Logs
Vulnerability
-------------
TOTP setup QR codes contain the TOTP secret (otpauth:// URL). The application
logs the QR code generation path, including the full URL with the secret.
Attackers with log access can extract TOTP secrets and bypass 2FA.
Fix
---... | zhangjiayang6835-cyber/ai-research | FIXES/totp_secret_leak_fix.py | .py | 23de100ed400fa67 | 7.57 | 13 |
"""
Fix for Issue #730 — WebSocket CSRF → Cross-Origin Data Exfiltration
Vulnerability
-------------
WebSocket connections do not enforce same-origin policy. Browsers allow any
origin to open a WebSocket connection. An attacker's website can open a
WebSocket to the target application and read data if the application d... | zhangjiayang6835-cyber/ai-research | FIXES/websocket_csrf_fix.py | .py | 919f90923c98fd9f | 7.57 | 13 |
"""Audit script to identify documentation gaps for builtins and stdlib modules."""
import builtins
import inspect
import json
import sys
from pathlib import Path
from typing import Any
def get_all_builtins() -> dict[str, list[str]]:
"""Get all built-in functions, types, and exceptions."""
builtin_items: dict... | heikkitoivonen/python-time-space-complexity | scripts/audit_documentation.py | .py | 7d7e48e6cf31f403 | 7.57 | 13 |
#!/usr/bin/env python3
"""Build one self-contained site per locale.
The i18n plugin's own multi-locale build puts every language in one tree that
shares a single search index. That makes search cross-language: because module
and method names are kept verbatim in every translation, an English search for
``bisect`` or `... | heikkitoivonen/python-time-space-complexity | scripts/build_site.py | .py | 3025cb86377eb8df | 7.57 | 13 |
#!/usr/bin/env python3
"""
Complexity Estimator CLI
This script estimates the time complexity (Big-O) of a Python function by running
it with increasing input sizes and curve-fitting the execution times.
Usage:
python scripts/estimate_complexity.py <module_path> <function_name>
Example:
python scripts/estima... | heikkitoivonen/python-time-space-complexity | scripts/estimate_complexity.py | .py | 5237fba3f25eb7e6 | 7.57 | 13 |
#!/usr/bin/env python3
"""Introspection script to enumerate Python builtins and stdlib for documentation coverage."""
import argparse
import builtins
import contextlib
import importlib
import io
import sys
from types import ModuleType
@contextlib.contextmanager
def suppress_stdout():
"""Suppress stdout (some mod... | heikkitoivonen/python-time-space-complexity | scripts/introspect.py | .py | efc5bcc9c2d14746 | 8.07 | 13 |
#!/usr/bin/env python3
"""Validate localized documentation against its English source.
Translations live in ``docs/<locale>/`` and mirror the English tree at
``docs/``. This script checks that each translated page:
* has an English counterpart,
* carries ``source_sha`` front matter matching that counterpart (stalenes... | heikkitoivonen/python-time-space-complexity | scripts/validate_translations.py | .py | 8bf0843486dc756d | 7.57 | 13 |
"""Tests to verify documented time complexity of collections module types.
These tests use timing measurements to verify that operations scale
according to their documented complexity.
"""
import time
from collections import (
ChainMap,
Counter,
OrderedDict,
UserDict,
UserList,
UserString,
... | heikkitoivonen/python-time-space-complexity | tests/test_collections_complexity.py | .py | e62133982155e2a5 | 7.07 | 13 |
import math
import sys
from pathlib import Path
from unittest.mock import MagicMock
import pytest
# Add scripts directory to path to import the estimator module
scripts_dir = Path(__file__).parent.parent / "scripts"
sys.path.append(str(scripts_dir))
try:
import estimate_complexity # type: ignore[reportMissingIm... | heikkitoivonen/python-time-space-complexity | tests/test_complexity_estimator_feature.py | .py | 6c7e23b7f3df8e3f | 8.07 | 13 |
"""Tests for the render-blocking requests we remove from the critical path.
Five requests blocked first render on every page. Three of them are the
theme's and stay; two were ours, and both are handled by
``scripts/mkdocs_hooks.py`` plus the ``extrahead`` and ``scripts`` blocks in
``docs/overrides/main.html``:
* ``do... | heikkitoivonen/python-time-space-complexity | tests/test_critical_path.py | .py | f6fa28e7a9d8d62d | 8.07 | 13 |
"""Unit tests for difflib module operations documented in docs/stdlib/difflib.md."""
from difflib import (
Differ,
HtmlDiff,
SequenceMatcher,
context_diff,
get_close_matches,
ndiff,
unified_diff,
)
class TestSequenceMatcher:
"""Test SequenceMatcher operations."""
def test_init(se... | heikkitoivonen/python-time-space-complexity | tests/test_difflib_complexity.py | .py | af46bbd405192af0 | 8.07 | 13 |
"""Tests for documentation content and structure."""
import json
import os
import shutil
import subprocess
from pathlib import Path
import pytest
def test_documentation_files_exist():
"""Test that required documentation files exist."""
docs_dir = Path(__file__).parent.parent / "docs"
# Check main pages... | heikkitoivonen/python-time-space-complexity | tests/test_documentation.py | .py | de4b124689297343 | 8.07 | 13 |
"""Tests to verify documented time complexity of heapq module operations.
These tests use timing measurements to verify that operations scale
according to their documented complexity.
"""
import heapq
import math
import time
from collections.abc import Callable
from typing import Any
def trimmed_mean(samples: list[... | heikkitoivonen/python-time-space-complexity | tests/test_heapq_complexity.py | .py | f0c8e5666433bdd2 | 8.07 | 13 |
"""Tests for how a per-locale build resolves translated pages.
The hreflang assertions at the bottom are explained in SEO.md.
Production builds one locale at a time (``scripts/build_site.py``), and that
mode has bitten us twice: ``build_only_locale`` makes the locale being built
the *default* one, so mkdocs-static-i1... | heikkitoivonen/python-time-space-complexity | tests/test_i18n_build.py | .py | 8506f7981dc3bf1b | 8.07 | 13 |
#!/usr/bin/env python3
"""
Infisical API helper for provisioning-db skill.
Handles JWT extraction from macOS Keychain, project listing,
environment listing/creation, and secrets management.
Usage:
python infisical_api.py auth-check
python infisical_api.py list-orgs
python infisical_api.py list-projects --... | tonehq/tone | .claude/skills/provisioning-db/scripts/infisical_api.py | .py | 39cdc5a8b7a3708c | 7.56 | 12 |
#!/usr/bin/env python3
"""
Neon CLI wrapper for provisioning-db skill.
Wraps neonctl commands with --org-id to skip interactive prompts.
All output is JSON for easy parsing.
Usage:
python neon_api.py check # Check if neonctl is installed
python neon_api.py list-orgs # List organizations
... | tonehq/tone | .claude/skills/provisioning-db/scripts/neon_api.py | .py | 1828ca32d6cb9674 | 7.56 | 12 |
"""
Test script to simulate a Twilio incoming call via WebSocket.
Connects to the local /ws endpoint and sends Twilio-format messages
to trigger the incoming call flow.
Usage:
python _archive/root/test_incoming_call.py
# Send a WAV file as speech input (triggers the bot to respond):
python _archive/root/... | tonehq/tone | _archive/root/test_incoming_call.py | .py | 15df4ab174fa758e | 8.06 | 12 |
"""
Generate Voice_Test_Matrix.xlsx from dev-data.json for the 14 target TTS providers.
1:1 model-voice pairing logic:
- Most providers: all voices work with all models → pair sequentially
- Groq: language-specific models → match English/Arabic model to matching voice
- Rime: voices are model-specific (mist=English, m... | tonehq/tone | _archive/scripts/generate_voice_test_matrix.py | .py | 7b5f27c828bf91fb | 8.06 | 12 |
#!/usr/bin/env python
"""Standalone RAG diagnostic for the Tone Hotel Assistant Agent — NO STT / NO TTS.
Text question in -> retrieved chunks + grounded LLM answer out. It exercises the
REAL Tone RAG pipeline exactly as the voice agent does at call time
(``document_tool_service`` -> OpenAI query embedding -> pgvector ... | tonehq/tone | _archive/scripts/hotel_rag_test.py | .py | 53eca788d713c1cf | 8.06 | 12 |
"""Standalone smoke test for the tone RAG pipeline.
Ingests a PDF and runs a set of retrieval queries against it, using the real
OpenAIEmbedder together with the InMemoryVectorStore -- so it exercises the true
chunk -> embed -> retrieve path WITHOUT needing Postgres/pgvector.
Two ingestion modes:
(default) producti... | tonehq/tone | _archive/scripts/rag_pipeline_smoketest.py | .py | 8cd72938b7f43512 | 8.06 | 12 |
"""
Test all LLM x STT x TTS combinations:
1. Query DB for active providers and their models.
2. Generate all combinations in memory.
3. Create one agent per combination.
4. Trigger test calls via the test-runs API.
5. Poll call_logs until completed calls are found.
6. Repeat in batches until all combinatio... | tonehq/tone | _archive/scripts/run_call_combinations.py | .py | c66b3bc4afa36263 | 7.56 | 12 |
"""merge contacts-directories + tool-executions heads
Revision ID: 0cf24b3d86dc
Revises: a4e9b1c7d3f5, 6ab783e9080f
Create Date: 2026-07-18 13:12:49.364456
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0cf24b3d86dc'
down_revision = ('a4e9b1c7d3f5', '6ab783e9... | tonehq/tone | alembic/versions/0cf24b3d86dc_merge_contacts_directories_tool_.py | .py | 8331de9961ecc258 | 7.06 | 12 |
"""add is_template and name to agent_configs
Revision ID: 1b30e7c3d05f
Revises: c4e1f7a9b3d2
Create Date: 2026-07-09 10:24:00.140019
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1b30e7c3d05f'
down_revision = 'd9e4b8c1a2f3'
branch_labels = None
depends_on = ... | tonehq/tone | alembic/versions/1b30e7c3d05f_add_is_template_and_name_to_agent_.py | .py | b59f15dafefc2a3b | 7.56 | 12 |
"""merge heads
Revision ID: 1b567efe78d3
Revises: d5f2c8a91e73, b7c3f1a9d2e4
Create Date: 2026-07-01 16:02:51.206120
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1b567efe78d3'
down_revision = ('d5f2c8a91e73', 'b7c3f1a9d2e4')
branch_labels = None
depends_on ... | tonehq/tone | alembic/versions/1b567efe78d3_merge_heads.py | .py | a903a0203c32569b | 7.06 | 12 |
"""add generated_api_keys table
Introduces the customer-facing programmatic-access API keys (distinct from the
provider-credential ``api_keys`` table, which stores encrypted LLM/STT/TTS keys).
We store only a SHA-256 hash of the full key so a database dump does not leak
usable credentials. A partial unique index enfo... | tonehq/tone | alembic/versions/2178f950024d_add_generated_api_keys.py | .py | 344a3748f9d4ce81 | 7.56 | 12 |
"""Added mcp and tool idfor tool executions
Revision ID: 4e4fc977b458
Revises: 62ed186f77e5
Create Date: 2026-06-23 17:49:19.418992
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '4e4fc977b458'
down_revision = '62ed186... | tonehq/tone | alembic/versions/4e4fc977b458_added_mcp_and_tool_idfor_tool_executions.py | .py | 01f75711f8580558 | 7.56 | 12 |
"""add sip_trunks
Revision ID: 550f0ed26622
Revises: b71c3e5a9f42
Create Date: 2026-08-24 10:14:44.176391
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '550f0ed26622'
down_revision = 'b71c3e5a9f42'
branch_labels = Non... | tonehq/tone | alembic/versions/550f0ed26622_add_sip_trunks.py | .py | ed6119332f84ecaf | 7.56 | 12 |
"""add node capacity columns
Revision ID: 5818d16712be
Revises: a425f95775d9
Create Date: 2026-07-06 19:39:07.580820
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5818d16712be'
down_revision = 'a425f95775d9'
branch_labels = None
depends_on = None
def upgra... | tonehq/tone | alembic/versions/5818d16712be_add_node_capacity_columns.py | .py | 1b70fb3942f56e98 | 7.56 | 12 |
"""Added sessions table
Revision ID: 62ed186f77e5
Revises: d4f7a1c9e2b8
Create Date: 2026-06-15 12:51:45.296308
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '62ed186f77e5'
down_revision = 'd4f7a1c9e2b8'
branch_labels... | tonehq/tone | alembic/versions/62ed186f77e5_added_sessions_table.py | .py | b830802aa508c368 | 7.56 | 12 |
"""Added base_url to models
Revision ID: 667f05ffd49b
Revises: 56e0fb796b3e
Create Date: 2026-06-09 09:53:08.972846
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '667f05ffd49b'
down_revision = '56e0fb796b3e'
branch_labels = None
depends_on = None
def upgrad... | tonehq/tone | alembic/versions/667f05ffd49b_added_base_url_to_models.py | .py | c4c0da2b6650282b | 7.56 | 12 |
"""add agent_channels
Revision ID: 6696b9e0556b
Revises: 62ed186f77e5
Create Date: 2026-06-23 15:40:05.355489
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6696b9e0556b'
down_revision = '62ed186f77e5'
branch_labels = None
depends_on = None
def upgrade() ->... | tonehq/tone | alembic/versions/6696b9e0556b_add_agent_channels.py | .py | d2f222ead9464624 | 7.56 | 12 |
"""add procrastinate_job_id, doc_type, ingestion_stats to knowledge_bases
Revision ID: 6bd88c8ee3dc
Revises: b2e9f47a1c30
Create Date: 2026-06-05 15:52:40.116022
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '6bd88c8e... | tonehq/tone | alembic/versions/6bd88c8ee3dc_add_procrastinate_job_id_doc_type_.py | .py | 39c39ba9fdb38e4c | 7.56 | 12 |
"""add pod live resource columns
Revision ID: 733a3ca12fdb
Revises: 5818d16712be
Create Date: 2026-07-07 16:39:53.401380
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '733a3ca12fdb'
down_revision = '5818d16712be'
branch_labels = None
depends_on = None
def u... | tonehq/tone | alembic/versions/733a3ca12fdb_add_pod_live_resource_columns.py | .py | 73f4b736621045cb | 7.56 | 12 |
"""add overlapped_calls to calls
Adds a JSONB column ``overlapped_calls`` to ``calls`` that stores the ids of
other calls whose active time window overlapped with this call on the same
infrastructure (pod today, node/other scopes later). Populated by the
``detect_call_overlaps`` background job that runs when a call en... | tonehq/tone | alembic/versions/a1b2c3d4e5f6_add_overlapped_calls_to_calls.py | .py | 65623495392873f1 | 7.56 | 12 |
"""add pipeline_logs (per-call Loki log read-back)
New ``pipeline_logs`` table storing a finished call's log lines read back from
Grafana Loki, to power an in-product per-call log viewer. Identity columns are
stamped from the ``calls`` row; ``fingerprint`` is UNIQUE so re-syncs are
idempotent (``on_conflict_do_nothing... | tonehq/tone | alembic/versions/a1c9f4e7b2d5_add_pipeline_logs.py | .py | d3c0e20bc210e3a9 | 7.56 | 12 |
"""add nodes pods and call pod_id fk
Revision ID: a425f95775d9
Revises: f3a1c7e5d9b2
Create Date: 2026-07-06 18:33:56.241703
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a425f95775d9'
down_revision = 'f3a1c7e5d9b2'
branch_labels = None
depends_on = None
d... | tonehq/tone | alembic/versions/a425f95775d9_add_nodes_pods_and_call_pod_id_fk.py | .py | 776d99972903d0fa | 7.56 | 12 |
"""Add ``app_integrations.userinfo_url``.
The catalog OAuth flow used to call a provider's ``userinfo`` endpoint after
the token exchange to capture the connecting user's email. The hardcoded
catalog dict supplied that URL per provider (e.g. Google's
``/oauth2/v2/userinfo``). When the catalog moved to the DB we droppe... | tonehq/tone | alembic/versions/a4c8e1f7b2d6_app_integrations_add_userinfo_url.py | .py | 8ebc82c716fcc8ad | 7.56 | 12 |
"""Add turn_metrics to call_metrics
Revision ID: a4e21c9b3d7f
Revises: 667f05ffd49b
Create Date: 2026-06-11 10:50:00.000000
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import JSONB
# revision identifiers, used by Alembic.
revision = 'a4e21c9b3d7f'
down_revision = '667f05ff... | tonehq/tone | alembic/versions/a4e21c9b3d7f_add_turn_metrics_to_call_metrics.py | .py | ee269dc918af1b51 | 7.56 | 12 |
#!/usr/bin/env python3
"""
Convert SURE Benchmark CSV files to JSONL format for evaluation.
This script:
1. Reads CSV annotation files
2. Fixes audio paths to match actual directory structure
3. Generates JSONL with fields: key, path, target, task, language, dataset
Usage:
python scripts/convert_sure_to_jsonl.py ... | PigeonDan1/sure-evaluation | scripts/convert_sure_to_jsonl.py | .py | f1ef25c88145b409 | 7.59 | 14 |
#!/usr/bin/env python3
"""
SURE Benchmark Dataset Downloader
Downloads and extracts SURE benchmark datasets from ModelScope:
- SURE_Test_csv: Annotation files (CSV format)
- SURE_Test_Suites: Audio files
Usage:
python scripts/download_sure_data.py # Download both
python scripts/download_sure_data.py ... | PigeonDan1/sure-evaluation | scripts/download_sure_data.py | .py | 36a5814d1729e9ba | 7.59 | 14 |
#!/usr/bin/env python3
"""
从 SURE Benchmark 中提取标准化测试样本。
用法:
python scripts/extract_test_samples.py [--samples N] [--output-dir DIR]
示例:
# 提取默认数量样本 (每个任务3个)
python scripts/extract_test_samples.py
# 提取5个样本
python scripts/extract_test_samples.py --samples 5
"""
import json
import random
import ... | PigeonDan1/sure-evaluation | scripts/extract_test_samples.py | .py | a10833a543a02a93 | 8.09 | 14 |
#!/usr/bin/env python3
"""
Run SURE Benchmark evaluation.
This script:
1. Loads ground truth from JSONL files
2. Loads predictions from text files
3. Runs evaluation for each task
4. Outputs results in a standardized format
Usage:
# Evaluate single dataset
python scripts/run_sure_evaluation.py \
--gt ... | PigeonDan1/sure-evaluation | scripts/run_sure_evaluation.py | .py | 0cbdb48cadeafa53 | 7.59 | 14 |
"""Install a minimal DeepSpeed stub for metric-only inference.
Some metric images contain a partial DeepSpeed install that raises at import
time when CUDA_HOME is not set. The TTS/VC metric runners do not use DeepSpeed,
but Transformers and PyTorch Lightning import it opportunistically.
"""
from __future__ import ann... | PigeonDan1/sure-evaluation | src/sure_eval/compat/deepspeed_stub.py | .py | ab56864fe0d19814 | 7.59 | 14 |
"""Configuration management for SURE-EVAL."""
from __future__ import annotations
import os
from pathlib import Path
from typing import Any, Literal
import yaml
from pydantic import BaseModel, Field
class DataConfig(BaseModel):
"""Data directory configuration."""
root: str = "./data"
cache: str = "./dat... | PigeonDan1/sure-evaluation | src/sure_eval/core/config.py | .py | 70b50ebfd94e20f0 | 7.59 | 14 |
"""Shared evaluation metric types."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Protocol
@dataclass
class MetricResult:
"""Result of metric calculation."""
metric_name: str
score: float
details: dict[str, Any] = field(default_factory=dict)
... | PigeonDan1/sure-evaluation | src/sure_eval/evaluation/base.py | .py | 6310b6af706d35c7 | 7.59 | 14 |
"""Shared cache path helpers for SURE-EVAL.
Public code must not default to a user-specific HPC path. Runtime assets can
still live on large local storage by setting ``SURE_EVAL_CACHE_DIR``.
"""
from __future__ import annotations
import os
from pathlib import Path
CACHE_ENV_VAR = "SURE_EVAL_CACHE_DIR"
def get_cac... | PigeonDan1/sure-evaluation | src/sure_eval/evaluation/cache.py | .py | 385a9e83fbdec77f | 7.59 | 14 |
#!/usr/bin/env python3
"""
Extract all user-facing extension URLs for link checking.
This script reads the snapcraft.json schema and urls.json (single source
of truth) and generates all documentation URLs that users encounter through:
- Hover tooltips (plugin docs, base docs)
- Command palette (snapcraft documentation... | nooreldeenmansour/snapcraft-intellisense | scripts/extract_urls.py | .py | 41121d9dc2680251 | 7.6 | 15 |
"""Pre-Write hook: auto-prepend Apache 2.0 license header to napt/**/*.py.
Reads the Claude Code PreToolUse JSON payload from stdin. If the tool is
`Write` to a file under `napt/` (excluding `tests/`) and the content lacks
the Apache 2.0 marker, rewrite `tool_input.content` with the header
inserted before the module d... | RogerCibrian/notapkgtool | .claude/hooks/check_license_header.py | .py | 24340d4d66804976 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/build/_ps_templates.py | .py | 237e44d09ea74180 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/build/packager.py | .py | c2794a6222487380 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/build/template.py | .py | c9da5d72c1591832 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/cli/build.py | .py | db855b2953b246c9 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/cli/discover.py | .py | a72274af217c01b0 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/cli/init.py | .py | bbf6bbb9a54dcfcd | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/cli/package.py | .py | 9905045face97a9c | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/cli/status.py | .py | 204a62324c67b3eb | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/cli/upload.py | .py | 68c4b8d3a1335fd6 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/cli/validate.py | .py | 32c33cb44af4fb55 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/config/loader.py | .py | e615281ee383716a | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/discovery/api_github.py | .py | 07389c9fbb513a63 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/discovery/base.py | .py | 3f2c917dbc20f0ad | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/discovery/manager.py | .py | 9ac5be153bd905df | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/discovery/url_download.py | .py | 6f5d1e4a419cdcd0 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/discovery/web_scrape.py | .py | 5a5893844145396f | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/download/download.py | .py | 32edbc0327ec0cef | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/graph/client.py | .py | 2ff6316338f3b359 | 7.64 | 18 |
# Copyright 2025 Roger Cibrian
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | RogerCibrian/notapkgtool | napt/promote/planner.py | .py | 6498884f5d8e9248 | 7.64 | 18 |
"""
Language switching routes
"""
import logging
from flask import Blueprint, Response, request, jsonify
from werkzeug.exceptions import HTTPException
from utils.api_errors import json_http_error
from utils.i18n import set_language
logger = logging.getLogger(__name__)
language_bp = Blueprint("language", __name__)
... | sergi039/idealista-tracker-ai | routes/language_routes.py | .py | 28da11eeae03e44b | 7.42 | 6 |
"""The curated agency table behind ``/agencies`` (owner request, 2026-08-22).
The page answers one question -- *which agencies hold the most detached houses
up to 300 000 EUR in Asturias and Cantabria* -- and its source of truth is
``data/top_agencies.json``, a committed, hand-reviewed file in the same family
as ``dat... | sergi039/idealista-tracker-ai | services/agency_directory.py | .py | efd94bccb1f0a77c | 7.42 | 6 |
"""Documents and photos attached to a listing (#430).
The worked example is the one the ticket opens with: the agency sent the *ficha
catastral* by WhatsApp, and the PDF had nowhere to go. A cadastral plan, a
photo of the frontage, a scan of the condiciones -- evidence that is not a
measurement and cannot be recompute... | sergi039/idealista-tracker-ai | services/attachments.py | .py | 05770e62fc56d035 | 7.42 | 6 |
"""What may be said about building rules, and which of it is local.
The single owner of the policy (the shape `PlaceRules` set): every topic the
/construccion page can render is declared here, and only here. A topic marked
`requires_local_confirmation=True` may show a per-concejo value ONLY when a
record with `state:... | sergi039/idealista-tracker-ai | services/buildability_catalog.py | .py | adbc806ff54d09a7 | 7.42 | 6 |
"""What a stored coordinate is good enough to answer.
`Property.location_accuracy` records what Google said about the point it
returned (#321): `precise` means it matched an address, anything else means it
matched a locality and handed back its centroid. Four listings on four
different streets of Santa María del Mar s... | sergi039/idealista-tracker-ai | services/coordinate_quality.py | .py | 0bfdf7713615c4b0 | 7.42 | 6 |
"""The link from a listing to the dossier written about it.
Some of what is known about a listing is not a measurement and never will be:
the cadastral archaeology that identified the parcel, the reading of the
municipal plan, the two agencies' contradictions, the photographs somebody
looked through. That work goes in... | sergi039/idealista-tracker-ai | services/dossier.py | .py | 536c763b3ede7568 | 7.42 | 6 |
"""What one Enrich press may take, derived once and read by both ends.
`static/js/main.js` used to carry the client's own guess at it -- 300 000 ms,
with the comment *"Several Google calls plus Overpass behind the 5 s gate"*.
That number predated the Overpass fallback list added on 2026-08-19, which
raised the server'... | sergi039/idealista-tracker-ai | services/enrich_budget.py | .py | ae363582f397115b | 7.42 | 6 |
"""Origin provenance shared by every enrichment block that records the
coordinate it was measured from (issue #346).
`services/sea_view_service.py` solved this first for
`enrichment["environment"]["sea_view_detail"]`: capture `{lat, lon}` at
computation time, and compare a stored origin against a fresh one at a
tolera... | sergi039/idealista-tracker-ai | services/enrichment_origin.py | .py | 6ab57a77346b6a47 | 7.42 | 6 |
"""Writing one block of `Property.enrichment` without losing the others.
`enrichment` is a single JSON column, so every writer of a block inside it
performs a read-modify-write over the whole column, and every one of them
spends seconds on external calls before the read. A guard that compares the
new value against `pr... | sergi039/idealista-tracker-ai | services/enrichment_write.py | .py | d5a83c30283bd300 | 7.42 | 6 |
"""Turning a list of fotocasa links into rows, in two halves that cannot be
confused: read the pages, then -- only on a second, explicit press -- write.
The split is not ceremony. **This application cannot delete a property.** A
tree-wide search for a delete route or a `db.session.delete` on `Property`
finds none, so ... | sergi039/idealista-tracker-ai | services/fotocasa_import.py | .py | 017f88b195876a13 | 7.42 | 6 |
"""What a fotocasa.es listing page hands us, in one place.
Every listing in this database used to arrive as an Idealista alert email.
Fotocasa listings are here too -- 56 of 730 rows on 2026-08-17 -- but nothing
in the application could produce one: `utils/idealista_extractors.py` only
matches `idealista.com` URLs, so... | sergi039/idealista-tracker-ai | services/fotocasa_source.py | .py | 4d36c758e9cfe7a4 | 7.42 | 6 |
"""Which machine may pull the mailbox.
`AUTO_START_SCHEDULER` decides whether a machine ingests on a cron tick, and
#376 made it fail-closed everywhere that decides a default: two machines polling
one Gmail label is not the same work done twice but two divergent databases plus
a second Google bill per listing (measure... | sergi039/idealista-tracker-ai | services/ingest_policy.py | .py | 2febb2cb3418a09d | 7.42 | 6 |
"""What may be presented as a listing's status, and what may not.
`listing_status` defaults to `'active'` on ingestion. Nothing verified that
default -- it is what a row is born with -- and until this module existed every
surface rendered it exactly like a status a check had confirmed. Measured
2026-08-15: across `pro... | sergi039/idealista-tracker-ai | services/listing_verification.py | .py | 565fd8c976c60438 | 7.42 | 6 |
"""Nearest preset places from OpenStreetMap instead of a billed Places search.
Step 2 of the cost plan agreed after the EUR 190 invoice of 1-18 August 2026.
Five of the seven Places calls a listing costs are the presets below; the
hospital left for the national register in step 1, and the beaches are still
Google's.
... | sergi039/idealista-tracker-ai | services/osm_places.py | .py | cd1f2f5f79c401ec | 7.42 | 6 |
"""Drive times from a routing engine on this machine instead of Distance Matrix.
Step 3 of the cost plan. With the presets and the beaches on OpenStreetMap,
the Distance Matrix leg is the only billed call an enrichment still makes --
~26 elements, about $0.13 a listing -- and OSRM answers the same question from
the sa... | sergi039/idealista-tracker-ai | services/osrm_routing.py | .py | 16c3134e41f08f4b | 7.42 | 6 |
"""What a derived answer was computed over, said out loud (UNIVERSE-001, #265).
Five surfaces in this repository answer questions derived from `properties`,
and each answers about a different set of rows:
* `GET /api/properties` — a **selected set**: one subscription, a page of it;
* `/municipalities` — the stored **... | sergi039/idealista-tracker-ai | services/population.py | .py | d68f8dcd25363dfc | 7.42 | 6 |
"""Which subscriptions the properties views are showing (issue #104).
The owner wants to see every subscription at once *or* tick several of them
in one dropdown, without the filter bar growing a second control. That turns
`profile_id` from a single value into a repeated query parameter, and the
three answers it can e... | sergi039/idealista-tracker-ai | services/profile_selection.py | .py | 83ecac246b9f0d05 | 7.42 | 6 |
import re
from typing import Any, Dict, List, Optional, Tuple
from models import Property, SearchProfile
from services.search_profile_service import SearchProfileService
# Idealista titles read "<what it is> in <where it is>": "Land plot in
# Caserio Casa de Anes, 267, Siero", "Casa o chalet en venta en Siero". Only
... | sergi039/idealista-tracker-ai | services/property_classification_service.py | .py | c7a2cd3d31053ce4 | 7.42 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.