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
import datetime import importlib.resources from datetime import datetime from typing import TYPE_CHECKING, List, Optional from langchain_core.messages import HumanMessage, SystemMessage if TYPE_CHECKING: from browser_use.agent.views import ActionResult, AgentStepInfo from browser_use.browser.views import BrowserSta...
SalesforceAIResearch/SCUBA
browser_use/agent/prompts.py
.py
236b2b694c30de2a
7.54
11
from __future__ import annotations import json import traceback import uuid from dataclasses import dataclass from pathlib import Path from typing import Any, Dict, List, Literal, Optional, Type from langchain_core.language_models.chat_models import BaseChatModel from openai import RateLimitError from pydantic import...
SalesforceAIResearch/SCUBA
browser_use/agent/views.py
.py
bb060d7cd1ae8be7
7.54
11
""" Playwright browser on steroids. """ import asyncio import gc import logging from dataclasses import dataclass, field from playwright._impl._api_structures import ProxySettings from playwright.async_api import Browser as PlaywrightBrowser from playwright.async_api import ( Playwright, async_playwright, ) from b...
SalesforceAIResearch/SCUBA
browser_use/browser/browser.py
.py
a40378c96113146c
7.54
11
import base64 import pytest from browser_use.browser.browser import Browser, BrowserConfig @pytest.fixture async def browser(): browser_service = Browser(config=BrowserConfig(headless=True)) yield browser_service await browser_service.close() # @pytest.mark.skip(reason='takes too long') def test_take_full_pag...
SalesforceAIResearch/SCUBA
browser_use/browser/tests/screenshot_test.py
.py
6b56b3ba2a23c3f4
7.04
11
import asyncio import json import pytest from browser_use.browser.browser import Browser, BrowserConfig from browser_use.dom.views import DOMBaseNode, DOMElementNode, DOMTextNode from browser_use.utils import time_execution_sync class ElementTreeSerializer: @staticmethod def dom_element_node_to_json(element_tree:...
SalesforceAIResearch/SCUBA
browser_use/browser/tests/test_clicks.py
.py
de257cd46354db15
7.04
11
from dataclasses import dataclass, field from typing import Any, Optional from pydantic import BaseModel from browser_use.dom.history_tree_processor.service import DOMHistoryElement from browser_use.dom.views import DOMState # Pydantic class TabInfo(BaseModel): """Represents information about a browser tab""" pa...
SalesforceAIResearch/SCUBA
browser_use/browser/views.py
.py
522e05a18f91d1dd
7.54
11
import asyncio from inspect import iscoroutinefunction, signature from typing import Any, Callable, Dict, Generic, Optional, Type, TypeVar from langchain_core.language_models.chat_models import BaseChatModel from pydantic import BaseModel, Field, create_model from browser_use.browser.context import BrowserContext fro...
SalesforceAIResearch/SCUBA
browser_use/controller/registry/service.py
.py
f8b8be324b784dec
7.54
11
from typing import Callable, Dict, Type from pydantic import BaseModel, ConfigDict class RegisteredAction(BaseModel): """Model for a registered action""" name: str description: str function: Callable param_model: Type[BaseModel] model_config = ConfigDict(arbitrary_types_allowed=True) def prompt_description...
SalesforceAIResearch/SCUBA
browser_use/controller/registry/views.py
.py
6af8ae480e1aab6a
7.54
11
import re import unicodedata from collections.abc import Mapping from typing import Any, List from pydantic import BaseModel, Field from cogdoc.agents.conversation_memory import ( CHAT_HISTORY_MESSAGE_LIMIT, format_recent_chat_history, ) from cogdoc.agents.qa_generator import Generator from cogdoc.agents.stru...
jikongabc/CogDoc
src/cogdoc/agents/query_rewriter.py
.py
b503ed9db203fdbf
7.6
15
# python/svy_io/factor.py from __future__ import annotations from typing import Any, Dict, Optional import polars as pl def ordered_categories(mapping: Dict[Any, str], *, levels: str) -> list[str]: """ Category list for an ordered factor, in the order the codes imply. Sorted by the numeric value of the...
samplics-org/svy
packages/svy-io/python/svy_io/factor.py
.py
5dbc28727f09ed97
7.66
20
# python/svy_io/helpers.py import contextlib import os import tempfile from typing import Any # ---------------- n_max normalization ---------------- def _normalize_n_max(n_max: Any) -> int | None: """ Normalize/validate `n_max`: - None -> None (unlimited) - list/tuple -> must have length 1 ...
samplics-org/svy
packages/svy-io/python/svy_io/helpers.py
.py
f9145cb9f5d7ef7a
7.66
20
from __future__ import annotations from typing import Any, Dict, List def _maybe_float(v: Any) -> Any: """Parse numeric strings from the native layer; keep everything else.""" if isinstance(v, str): try: return float(v) except ValueError: return v return v def no...
samplics-org/svy
packages/svy-io/python/svy_io/metadata.py
.py
5f243f3302e5234d
7.66
20
# python/svy_io/spss.py from __future__ import annotations import io import json import os from pathlib import Path from typing import Any, Dict, List, Optional, Tuple import polars as pl from polars.exceptions import ComputeError import svy_io.svyreadstat_rs as native from .helpers import _as_path, _normalize_n_...
samplics-org/svy
packages/svy-io/python/svy_io/spss.py
.py
66a82fcff0d6635f
7.66
20
# python/svy_io/tagged_na.py from __future__ import annotations from dataclasses import dataclass from typing import Any, List, Optional, Sequence, Union Scalar = Union[int, float, str, None] @dataclass(frozen=True, slots=True) class TaggedNA: """ Lightweight representation of haven's tagged NA. OPTIM...
samplics-org/svy
packages/svy-io/python/svy_io/tagged_na.py
.py
4e3b45d9018def94
7.66
20
# python/svy_io/temporals.py from __future__ import annotations import datetime as _dt import polars as pl # Epochs _SAS_EPOCH_DATE = _dt.date(1960, 1, 1) _SAS_EPOCH_DT = _dt.datetime(1960, 1, 1) _STATA_TD_EPOCH = _dt.date(1960, 1, 1) _STATA_TC_EPOCH = _dt.datetime(1960, 1, 1) _SPSS_EPOCH_DATE = _dt.date(1582, 10, ...
samplics-org/svy
packages/svy-io/python/svy_io/temporals.py
.py
f3f50058ec21eb2f
7.66
20
from __future__ import annotations import pytest from svy_io.labelled import Labelled, labelled # ---- constructors / validation ---- def test_labelled_zero_length_vector(): x = labelled() assert isinstance(x, Labelled) assert len(x) == 0 def test_x_must_be_numeric_or_character(): with pytest.ra...
samplics-org/svy
packages/svy-io/tests/test_labelled.py
.py
48310bacaff0c973
7.16
20
"""The public surface is what callers import; pin it. This exists because the failure it guards against has already happened. svy's `test_io_roundtrip.py` records that `_write_spss` called `svy_io.write_spss` and `_write_sas` called `svy_io.write_sas`, and that "neither name has ever existed" -- both calls shipped wit...
samplics-org/svy
packages/svy-io/tests/test_public_api.py
.py
63e76fa56dff6276
8.16
20
# tests/test_sas.py from __future__ import annotations from datetime import date, datetime, timedelta, timezone from pathlib import Path import polars as pl import pytest from svy_io import read_sas, read_sas_arrow, read_xpt, write_xpt from svy_io.tagged_na import na_tag HERE = Path(__file__).resolve().parent DATA...
samplics-org/svy
packages/svy-io/tests/test_sas.py
.py
8dee9fdca62b9fc8
8.16
20
# tests/test_sas_arrow_extras.py from pathlib import Path import pyarrow as pa from svy_io import read_sas_arrow HERE = Path(__file__).resolve().parent DATA = HERE / "data/sas" def tpath(rel: str) -> str: """Return absolute path inside tests/sas/.""" return str((DATA / rel).resolve()) def test_arrow_zer...
samplics-org/svy
packages/svy-io/tests/test_sas_arrow_extras.py
.py
60388f373c0b0d8c
7.66
20
# tests/test_sas_flags.py from datetime import date, datetime, timedelta from pathlib import Path import polars as pl from svy_io import read_sas HERE = Path(__file__).resolve().parent DATA = HERE / "data/sas" def tpath(r): return str((DATA / r).resolve()) def test_factorize_gender_from_catalog(): df, m...
samplics-org/svy
packages/svy-io/tests/test_sas_flags.py
.py
166ba1795481ec3c
8.16
20
# tests/test_tagged_na.py from svy_io.tagged_na import ( TaggedNA, format_tagged_na, is_tagged_na, na_tag, print_tagged_na, tagged_na, ) def test_tagged_na_is_missing_not_nan(): x = tagged_na("a") # “Missing” in our world = TaggedNA instance (distinct from None/NaN semantics) asser...
samplics-org/svy
packages/svy-io/tests/test_tagged_na.py
.py
9e9b7a76fc5390e8
7.16
20
# tests/test_temporals.py """Unit tests for svy_io.temporals (no native reader required).""" from datetime import date, datetime, timedelta import polars as pl from svy_io.temporals import coerce_sas_temporals, coerce_spss_temporals # ─────────────────────────── SAS ─────────────────────────── def test_sas_datet...
samplics-org/svy
packages/svy-io/tests/test_temporals.py
.py
4fc2f1c387214a18
8.16
20
# tests/test_xpt_write.py import polars as pl import pytest from svy_io import write_xpt def test_write_xpt_basic(tmp_path): """Test basic XPT writing""" df = pl.DataFrame( {"id": [1, 2, 3], "name": ["Alice", "Bob", "Charlie"], "score": [95.5, 87.3, 91.2]} ) path = tmp_path / "test.xpt" ...
samplics-org/svy
packages/svy-io/tests/test_xpt_write.py
.py
2a12b0408fbe8ba1
7.16
20
# tests/test_zap.py from __future__ import annotations import copy from pathlib import Path import polars as pl import polars.testing as plt import pytest from svy_io.tagged_na import tagged_na # Assuming you exposed zap helpers from svy_io.zap (or svy_io) # If you placed them elsewhere, just tweak the imports acc...
samplics-org/svy
packages/svy-io/tests/test_zap.py
.py
8968896118da2b1e
8.16
20
""" Shopify App Home Parent Redirect This module provides a helper function to generate redirect responses that break out of the app home iframe. """ from __future__ import annotations from typing import Optional from urllib.parse import parse_qs, urlencode, urlparse from ..types import AppConfig, LogWithReq, Reque...
Shopify/shopify-app-python
shopify_app/helpers/app_home_parent_redirect.py
.py
b7b5c2fb5cee49b4
7.59
14
""" Shopify App Home Redirect This module provides a helper function to generate redirect responses that stay within the app home iFrame. """ from __future__ import annotations from urllib.parse import parse_qs, urlencode, urlparse from ..types import AppConfig, LogWithReq, RequestInput, Res, ResultForReq from ..ut...
Shopify/shopify-app-python
shopify_app/helpers/app_home_redirect.py
.py
0955218ead83cd34
7.59
14
""" Input conversion utilities for handling Union[DataClass, dict] inputs. These helpers allow SDK functions to accept both dataclass instances and plain dicts, providing flexibility for consumers while maintaining type safety internally. Pattern: - _get_attr(): Extract a single field from dataclass or dict (for spec...
Shopify/shopify-app-python
shopify_app/utils/input_converters.py
.py
146444b8b4b88b63
7.59
14
"""HTTP log redaction utilities.""" from __future__ import annotations import json import re from typing import cast from ..types import RequestInput _REDACTED = "[REDACTED]" _SENSITIVE_BODY_FIELDS = { "client_secret", "subject_token", "refresh_token", "access_token", } # Fields an OAuth token endpo...
Shopify/shopify-app-python
shopify_app/utils/redact.py
.py
077efc336a895a97
7.59
14
""" Shopify App Proxy Verification This module provides functions to verify Shopify App Proxy requests. """ from __future__ import annotations import hashlib import hmac import time from typing import Any, Dict, List, Optional, Union from urllib.parse import parse_qs, urlparse from ..types import ( AppConfig, ...
Shopify/shopify-app-python
shopify_app/verify/app_proxy.py
.py
d29ba5865f17c2c0
7.59
14
"""Google OAuth 2.0 routes — Gmail and Google Drive integration.""" import hashlib import hmac import json import logging from urllib.parse import urlencode, urlparse import httpx from fastapi import APIRouter, Depends, HTTPException, Request from fastapi.responses import RedirectResponse from sqlalchemy import selec...
datar-gaurav/sutra-os
backend/app/api/routes/auth_google.py
.py
1c2a5857bd92883f
7.48
8
"""System settings API — runtime configuration management.""" from fastapi import APIRouter, Depends from pydantic import BaseModel from sqlalchemy.ext.asyncio import AsyncSession from app.core.system_settings import sys_settings from app.db.session import get_db router = APIRouter(prefix="/settings/system", tags=["...
datar-gaurav/sutra-os
backend/app/api/routes/system_settings.py
.py
e387c32ae51c7480
7.48
8
"""Execution traces API — retrieve agent invocation history.""" from fastapi import APIRouter, Depends, HTTPException, Query from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession from app.db.session import get_db from app.models.trace import ExecutionTrace router = APIRouter(prefix="/traces",...
datar-gaurav/sutra-os
backend/app/api/routes/traces.py
.py
02102f4593e3009f
7.48
8
"""Voice API — STT transcription, TTS synthesis, voice catalog. These endpoints are used by the frontend voice mode (Phase 2 push-to-talk first, Phase 3 streaming) and by internal services that need to synthesise/transcribe outside the chat hot-path. """ import logging from fastapi import APIRouter, File, Form, HTTP...
datar-gaurav/sutra-os
backend/app/api/routes/voice.py
.py
428328558e1c7e1a
7.48
8
"""LLM router with fallback — tries Ollama first, falls back to Anthropic.""" import logging from typing import Optional from core.config import settings from .providers import OllamaProvider, AnthropicProvider from .types import ChatResult logger = logging.getLogger(__name__) class LLMRouter: def __init__( ...
SL-Mar/chat-with-fundamentals
backend/agents/llm/router.py
.py
d283e95de3263977
7.65
19
"""Code agent pipeline — intent → code → sandbox → result.""" import json import logging import re from typing import Optional from agents.llm.router import llm_router from agents.llm.types import ChatResult from agents.prompts.intent_classifier import INTENT_CLASSIFIER_PROMPT from agents.prompts.ml_training import M...
SL-Mar/chat-with-fundamentals
backend/agents/pipeline.py
.py
fe60458e9b9f50db
7.65
19
"""Per-universe database models — OHLCV hypertable + fundamentals.""" from datetime import datetime, date from sqlalchemy import ( Column, String, Integer, Float, DateTime, Date, Text, BigInteger, UniqueConstraint, ) from sqlalchemy.dialects.postgresql import JSONB from sqlalchemy.orm import DeclarativeBase ...
SL-Mar/chat-with-fundamentals
backend/database/models/universe_data.py
.py
7a4281fd5089e468
7.65
19
"""Dynamic database manager — one database per universe.""" import logging from contextlib import asynccontextmanager from typing import AsyncGenerator from sqlalchemy import text from sqlalchemy.ext.asyncio import ( AsyncSession, AsyncEngine, create_async_engine, async_sessionmaker, ) from core.conf...
SL-Mar/chat-with-fundamentals
backend/database/universe_db_manager.py
.py
39fab3115e7beadf
7.65
19
"""Universe data populator — screens tickers, fetches OHLCV + fundamentals.""" import asyncio import logging import time import json import urllib.request import urllib.parse from datetime import datetime from typing import Optional from sqlalchemy import select, text, update from sqlalchemy.dialects.postgresql impor...
SL-Mar/chat-with-fundamentals
backend/ingestion/universe_populator.py
.py
9aa5ccd1ec8af36e
7.65
19
"""Chat router — code agent endpoint + WebSocket for logs.""" import asyncio import logging import json from typing import Optional from fastapi import APIRouter, HTTPException, WebSocket, WebSocketDisconnect from pydantic import BaseModel from services import universe_service from services.chat_agent_service import ...
SL-Mar/chat-with-fundamentals
backend/routers/chat.py
.py
dcc0ec574000901e
7.65
19
""" Comprehensive EODHD API Client Supports 50+ endpoints across all EODHD API categories """ from .base_client import EODHDBaseClient from .historical_data import HistoricalDataClient from .fundamental_data import FundamentalDataClient from .exchange_data import ExchangeDataClient from .corporate_actions import Corpo...
SL-Mar/chat-with-fundamentals
backend/tools/eodhd_client/__init__.py
.py
5622d1c6c97fb652
7.65
19
""" Base EODHD API Client Provides core functionality for all EODHD API endpoints """ import os import requests from typing import Optional, Dict, Any, List from datetime import datetime, date from functools import lru_cache import logging logger = logging.getLogger(__name__) class EODHDBaseClient: """Base clie...
SL-Mar/chat-with-fundamentals
backend/tools/eodhd_client/base_client.py
.py
44a2ddbc88ea626e
7.65
19
""" Macro & Economic Data API Client Covers: Macro Indicators, Economic Calendar """ from typing import Optional, Dict, Any, List from datetime import date from .base_client import EODHDBaseClient class MacroEconomicClient(EODHDBaseClient): """Client for macro and economic data endpoints""" def get_macro_in...
SL-Mar/chat-with-fundamentals
backend/tools/eodhd_client/macro_economic.py
.py
e3fa7282e106a3a0
7.65
19
""" Special Data API Client Covers: ETF Holdings, Index Constituents, ESG Data, Logos, Market Cap History """ from typing import Optional, Dict, Any, List from datetime import date from .base_client import EODHDBaseClient class SpecialDataClient(EODHDBaseClient): """Client for special data endpoints""" def ...
SL-Mar/chat-with-fundamentals
backend/tools/eodhd_client/special_data.py
.py
65744dd812ad69bb
7.15
19
""" Technical Analysis & Screener API Client Covers: Technical Indicators, Stock Screener """ from typing import Optional, Dict, Any, List from datetime import date from .base_client import EODHDBaseClient class TechnicalAnalysisClient(EODHDBaseClient): """Client for technical analysis and screening endpoints"""...
SL-Mar/chat-with-fundamentals
backend/tools/eodhd_client/technical_analysis.py
.py
3717833a9f2393b9
7.65
19
""" User & Account API Client Covers: API Usage, Limits, Account Info """ from typing import Dict, Any from .base_client import EODHDBaseClient class UserAPIClient(EODHDBaseClient): """Client for user account and API usage endpoints""" def get_user_info(self) -> Dict[str, Any]: """ Get user ...
SL-Mar/chat-with-fundamentals
backend/tools/eodhd_client/user_api.py
.py
35bb98530f751ebf
7.65
19
"""Binary sensor platform for Warema WMS integration. Exposes a "Moving" binary sensor per blind that reflects the moving flag from the WMS position payload (True = blind is moving). """ from __future__ import annotations import logging from homeassistant.components.binary_sensor import ( BinarySensorDeviceClas...
mike-goldfinger/ha-warema-wms
custom_components/warema_wms/binary_sensor.py
.py
9a4049af5a48cfa6
7.5
9
"""Button platform for Warema WMS integration. Exposes a per-blind "Identify" button that sends a wave (beckon) request, making the blind briefly move so the user can tell which physical device a given entity controls. """ from __future__ import annotations import logging from homeassistant.components.button import...
mike-goldfinger/ha-warema-wms
custom_components/warema_wms/button.py
.py
c043e9bca3f3b487
7.5
9
"""Light platform for the Warema WMS integration. Exposes WMS dimming actuators as light entities. A WMS light is always a stand-alone actuator with its own serial number - it is never a sub-channel of a motor - and it answers the same broadcast scan as any other device. Its brightness is carried in the same state by...
mike-goldfinger/ha-warema-wms
custom_components/warema_wms/light.py
.py
aff67aaa19bcc4b5
7.5
9
"""Frame-encoding tests for valance support. Stdlib only and no Home Assistant import: ``pywarema.protocol`` is pure Python, so this runs anywhere with ``python -m unittest discover tests``. The point of these tests is the backwards-compatibility guarantee. Valance support widens an existing frame, so the first test ...
mike-goldfinger/ha-warema-wms
tests/test_valance_encoding.py
.py
c0df5b9aa422be72
8
9
"""Windows-only support for concealer. This module is imported ONLY on win32 (see `_age_pw` in the `concealer` script). It never runs on macOS/Linux, so importing `winpty` at call time (not module top) keeps the module harmless to import anywhere. Why it exists: `age -p` reads the passphrase from the controlling term...
fxerkan/concealer
concealer_win.py
.py
452b264c63032cf3
7.59
14
"""Render captured terminal output to PNG (platform-independent). Used by win_capture.py: the CAPTURE happens on the Windows CI runner, but turning that captured text / ANSI stream into a terminal-style screenshot is pure Pillow + pyte and runs anywhere, so it's unit-testable locally (see demo() at the bottom). Two r...
fxerkan/concealer
packaging/ci/render.py
.py
e6eb6de5fbf840c5
7.59
14
import re from PyQt6.QtGui import QColor, QIcon, QPixmap def extract_bg(style): m = re.search(r"background-color:\s*(#[0-9a-fA-F]+)", style) return m.group(1) if m else None def extract_color(style): # Require start-of-string, space, or semicol before "color:" to avoid matching "background-color:" m...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/config.py
.py
886806487a4c2b25
7.5
9
"""Ctrl+W (Smart Line) — the text half, with no Qt in it. The settings dialog used to draw its examples from a hand-written table of strings. Those strings were fixed, so they went on claiming ``\\n\\n---`` after the user had set "before" to 0, and nothing in the code could notice. The template is built here now, by o...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/ctrlw.py
.py
a6884fe5062424af
7.5
9
"""Human duration and clock-time parsing. Accepts what people actually type when they want to be reminded: "4 days 11 hours" "4d 11h" "90m" "1h30" "2 недели 3 дня" "45 мин" "1.5h" "0:45" "18:30" "tomorrow 9:00" "завтра 09:00" Returns either a timedelta (a delay from...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/duration.py
.py
d518e785301d3ce0
7.5
9
"""Hashtags — tags that live inside the text, not beside it. Deliberately small. There is no tag store, no rename, no tag manager: a tag exists exactly because it is written somewhere, so nothing can fall out of sync and nothing has to be cleaned up. Silos already give hierarchy; this covers the other axis — marking a...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/hashtags.py
.py
ca7e34be17727f3f
7.5
9
"""Ctrl+E (header) — the text half, with no Qt in it. Same shape as core/ctrlw.py and for the same reason: the settings page and the editor must build the header from one function, or the preview goes on promising a layout the editor stopped producing. What Ctrl+E used to hardcode, and now reads from settings: the ...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/header.py
.py
e3019717c3523570
7.5
9
"""Global hotkey event filter for FastPrompter. Intercepts WM_HOTKEY (0x0312) and WM_SYSCOMMAND (0x0112 / SC_KEYMENU) messages to trigger window actions from registered global hotkeys. """ import ctypes import ctypes.wintypes from PyQt6 import sip from PyQt6.QtCore import QAbstractNativeEventFilter from fastprompte...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/hotkey_filter.py
.py
3f04c693f373c621
7.5
9
import ctypes import ctypes.wintypes MOD_ALT = 0x0001 MOD_CONTROL = 0x0002 MOD_SHIFT = 0x0004 MOD_WIN = 0x0008 # Cache the user32.VkKeyScanW function pointer for layout-aware VK resolution. # VkKeyScanW converts a character to its virtual-key code and shift state # based on the current keyboard layout, so hotkeys wor...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/hotkeys.py
.py
1edc5277bc84ea50
7.5
9
"""i18n — secured multi-language translation system. The full translation pack. `translations.py` delegates here (see its module docstring), so importing that name anywhere in the app is served by this engine; call `ensure_initialized()` once at startup to populate the registry. Usage: from fastprompter.core.i18n...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/i18n/__init__.py
.py
0b81458302921662
7.5
9
"""Backward-compatibility shim. Mirrors old `translations.py` API so existing imports keep working. Used by `__init__.py` to re-export. """ from __future__ import annotations from typing import Any from . import _engine def tr(text: str, lang: str | None = None) -> str: target = lang or _engine.get_language()...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/i18n/_compat.py
.py
b56fe8fa03551cbb
7.5
9
"""Secured translation container. Validates integrity, tracks coverage, freezes on load. Supports external slot for user-provided translation files. """ from __future__ import annotations import importlib import json import logging import os from pathlib import Path from typing import Final from . import _engine l...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/i18n/_container.py
.py
fb74a96063460120
7.5
9
"""Context-based container for "all other" languages. Provides scaffold for languages not in built-in set. Each language gets a secured slot tracked in registry — zero keys, 100% coverage is 0% until user/translator fills them via external slot. """ from __future__ import annotations import logging from . import _c...
vacterro/FastPrompter
.saipen/extensions/subs/saiui/kitchen/pen/src/fastprompter/core/i18n/_context.py
.py
36e5b652f3196d45
7.5
9
""" GSM8K benchmark that bypasses server-side tokenization. Instead of sending raw `text` (which the server tokenizes serially in its single asyncio event loop), we tokenize the prompt on the client side and send `input_ids` directly. This lets all requests land in the scheduler's waiting queue nearly simultaneously, ...
Sys-KU/FastPP
benchmark/gsm8k/bench_sglang_ids.py
.py
c0d538c77e425498
7.56
12
""" Move existing camera tags onto their sites, then clear them off the cameras. Tags were assigned to cameras back when a camera *was* the location. After the site refactor, place-describing tags ("transect-a", "river", "control-plot") belong on the Site, not the hardware. Camera tags stay a supported feature, but on...
PetervanLunteren/AddaxAI-Connect
scripts/backfill_camera_tags_to_sites.py
.py
49d7f43f47520654
7.6
15
""" Backfill camera deployment periods from historical image data. This script analyzes existing images with GPS data and creates deployment period records, detecting camera relocations (GPS change beyond SITE_THRESHOLD_METERS). Run once after adding deployments table. Usage: python backfill_deployment_periods.p...
PetervanLunteren/AddaxAI-Connect
scripts/backfill_deployment_periods.py
.py
d6f902d5011be06b
7.6
15
""" Delete empty deployment rows (debris). A deployment is one camera at one site for a time range, built from photos. GPS settling on a camera's first day, and (before the ingestion fix) daily reports that carry GPS but no photo, could open a deployment that gets closed before any image lands in it. The result is a c...
PetervanLunteren/AddaxAI-Connect
scripts/cleanup_empty_deployments.py
.py
68dd6bc52e2aede5
7.6
15
#!/usr/bin/env python3 """ Create admin invitation with token. Usage: python create_admin_invitation.py Environment variables required: ADMIN_EMAIL - Email address for server admin DATABASE_URL - PostgreSQL connection string DOMAIN_NAME - Domain name for registration URL """ import os import sys from ...
PetervanLunteren/AddaxAI-Connect
scripts/create_admin_invitation.py
.py
db0c7e3699ed95da
7.6
15
""" Put stranded images back on the pipeline queue. An update rebuilds the containers (step 3) before it migrates the database (step 4), so for the minute or two in between, new code is running against the old schema. Every ORM read of Image selects the new columns, so on a server with cameras uploading, anything that...
PetervanLunteren/AddaxAI-Connect
scripts/requeue_pending_images.py
.py
46ea582985f163bc
7.6
15
""" Alembic environment configuration This file is used by Alembic to configure database migrations. It imports our SQLAlchemy models from the shared library. """ from logging.config import fileConfig from sqlalchemy import engine_from_config, pool from alembic import context import sys from pathlib import Path # Add...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/env.py
.py
f58a4cf2ce6f255d
7.6
15
"""Add project_id and role to user_invitations Revision ID: 20250114_add_project_and_role_to_invitations Revises: 20250114_add_user_invitations Create Date: 2025-01-14 18:00:00.000000 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'e257ff9406199' down_revision ...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20250114_add_project_and_role_to_invitations.py
.py
3ad15aa001534d18
7.6
15
"""Add user_invitations table for pre-registration project assignments Revision ID: 20250114_add_user_invitations Revises: 20250114_rename_is_server_admin Create Date: 2025-01-14 16:00:00.000000 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'c40ddac257ff' down...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20250114_add_user_invitations.py
.py
927c481c1099ca48
7.6
15
"""Initial schema with role-based access control Revision ID: 20250114_initial_schema Revises: Create Date: 2025-01-14 00:00:00.000000 """ from alembic import op import sqlalchemy as sa import geoalchemy2 # revision identifiers, used by Alembic. revision = '20250114_initial_schema' down_revision = None branch_labels...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20250114_initial_schema.py
.py
42272e23cf3a5170
7.6
15
"""Add SIM fields to cameras table Revision ID: 20250115_add_sim_fields Revises: 20250114_add_project_and_role_to_invitations Create Date: 2025-01-15 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic revision = '20250115_add_sim_fields' down_revision = 'e257ff9406199' branch...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20250115_add_sim_fields_to_cameras.py
.py
661ec6ab621bf5cf
7.6
15
"""Add token, expires_at, and used fields to user_invitations Revision ID: 20250124_add_invitation_tokens Revises: 20250115_add_sim_fields Create Date: 2025-01-24 00:00:00.000000 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic revision = '20250124_add_invitation_tokens' do...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20250124_add_invitation_tokens.py
.py
86516abe74d036f5
7.6
15
"""Drop email_allowlist table (replaced by invitation tokens) Revision ID: 20250125_drop_email_allowlist Revises: 20250124_add_invitation_tokens Create Date: 2025-01-25 00:00:00.000000 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic revision = '20250125_drop_email_allowlis...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20250125_drop_email_allowlist.py
.py
d48985ab8d1d97d7
7.6
15
"""Add detection_threshold to projects table Revision ID: 20250127_add_detection_threshold Revises: 20250125_drop_email_allowlist Create Date: 2026-01-27 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic revision = '20250127_add_detection_threshold' down_revision = '20250125...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20250127_add_detection_threshold.py
.py
546f3ca3e047687d
7.6
15
"""Add camera_deployment_periods table Revision ID: 20260129_add_deployment_periods Revises: 20250127_add_detection_threshold Create Date: 2026-01-29 """ from alembic import op import sqlalchemy as sa from geoalchemy2 import Geography # revision identifiers, used by Alembic revision = '20260129_add_deployment_perio...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260129_add_deployment_periods.py
.py
44a6f0cefb34d168
7.6
15
"""Add camera_health_reports table for historical health tracking Revision ID: 20260202_camera_health_reports Revises: 20260129_add_deployment_periods Create Date: 2026-02-02 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic revision = '20260202_camera_health_reports' down_r...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260202_add_camera_health_reports.py
.py
79e5fe3d09590ca4
7.6
15
"""Add report_email to project_notification_preferences table Revision ID: 20260202_add_report_email Revises: 20260202_camera_health_reports Create Date: 2026-02-02 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic revision = '20260202_add_report_email' down_revision = '2026...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260202_add_report_email.py
.py
68c85f792a5e1ace
7.6
15
"""Add human verification for images Revision ID: 20260204_add_human_verification Revises: 20260202_add_report_email Create Date: 2026-02-04 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic revision = '20260204_add_human_verification' down_revision = '20260202_add_report_em...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260204_add_human_verification.py
.py
e51bc19a743631d1
7.6
15
"""Add species_taxonomy table Maps common species names from classification models to scientific names for CamTrap DP export and other biodiversity standards. Revision ID: 20260206_add_species_taxonomy Revises: 20260204_add_human_verification Create Date: 2026-02-06 """ from alembic import op import sqlalchemy as sa...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260206_add_species_taxonomy.py
.py
48d89e7c1942df51
8.1
15
"""Add timezone to projects table Stores IANA timezone name per project for export timestamps and activity charts. Defaults to UTC for existing projects. Revision ID: 20260213_add_project_timezone Revises: 20260206_add_species_taxonomy Create Date: 2026-02-13 """ from alembic import op import sqlalchemy as sa # re...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260213_add_project_timezone.py
.py
efb23b97b85895a5
7.6
15
"""Add blur_people_vehicles to projects table Per-project privacy setting to automatically blur detected people and vehicles in all images. Enabled by default for privacy protection. Revision ID: 20260214_add_blur_ppl_vehicles Revises: 20260213_add_project_timezone Create Date: 2026-02-14 """ from alembic import op ...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260214_add_blur_people_vehicles.py
.py
0aeb0b18bb4b6aaf
7.6
15
"""Add independence_interval_minutes to projects Adds a per-project independence interval setting for grouping detections of the same species at the same camera within N minutes as a single event. Default 0 = disabled (existing behavior). Revision ID: 20260214_add_indep_interval Revises: 20260214_tz_to_server_setting...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260214_add_independence_interval.py
.py
12eb27b19063817c
7.6
15
"""Move timezone from projects to server_settings Creates server_settings table (single-row, server-wide settings), migrates timezone from the first project, and drops the column from projects. Revision ID: 20260214_tz_to_server_settings Revises: 20260214_add_blur_ppl_vehicles Create Date: 2026-02-14 """ from alembi...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260214_move_timezone_to_server_settings.py
.py
66bac6a17273de35
7.6
15
"""Add project_documents table Per-project file storage for permits, field notes, config files, etc. Admins upload/delete, all members can view and download. Revision ID: 20260217_add_project_docs Revises: 20260214_add_indep_interval Create Date: 2026-02-17 """ from alembic import op import sqlalchemy as sa # revi...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260217_add_project_documents.py
.py
c02d8c7147fe3727
7.6
15
"""Migrate camera fixed metadata columns to JSON Simplifies camera registration to IMEI + name + flexible custom fields. Migrates 9 fixed columns (serial_number, box, order, scanned_date, firmware, remark, has_sim, imsi, iccid) into a single custom_fields JSON column. Revision ID: 20260217_camera_metadata Revises: 20...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260217_migrate_camera_metadata.py
.py
213ebed099ed6225
7.6
15
"""Add camera groups table Adds camera_groups table for grouping cameras that share a field of view. Cameras in the same group share an independence interval, merging detections of the same species across all cameras in the group. Revision ID: 20260306_add_camera_groups Revises: 20260217_camera_metadata Create Date: ...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260306_add_camera_groups.py
.py
f00362c99d66b272
7.6
15
"""Add is_hidden column to images table Allow project admins to hide images from analysis views without permanently deleting them. Revision ID: 20260309_add_image_is_hidden Revises: 20260309_rename_imei Create Date: 2026-03-09 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembi...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260309_add_image_is_hidden.py
.py
f5af7a85052b9601
7.6
15
"""Rename cameras.imei to cameras.device_id Generalize the unique camera identifier from IMEI-specific to support any device ID (IMEI, serial number, or custom identifier). Revision ID: 20260309_rename_imei Revises: 20260306_add_camera_groups Create Date: 2026-03-09 """ from alembic import op # revision identifiers...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260309_rename_imei_to_device_id.py
.py
7f7cc305b0e38c12
7.6
15
"""Add raw_prediction and raw_confidence columns to classifications table Store full SpeciesNet labels and raw confidence scores for future taxonomy mapping. DeepFaune classifications leave these columns null. Revision ID: 20260312_add_raw_prediction Revises: 20260309_add_image_is_hidden Create Date: 2026-03-12 """ ...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260312_add_raw_prediction_to_classifications.py
.py
6837a82d9bb2b1af
7.6
15
"""Add taxonomy_mapping table for SpeciesNet walk-up algorithm Stores latin-to-common-name mappings uploaded via CSV. Used by the classification worker to map raw predictions to human-readable species labels. Revision ID: 20260314_add_taxonomy_mapping Revises: 20260312_add_raw_prediction Create Date: 2026-03-14 """ ...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260314_add_taxonomy_mapping.py
.py
3a887e6b66a62f10
7.6
15
"""Add geofencing columns to server_settings Stores SpeciesNet country code and admin1 region for ensemble geofencing. Configured via the admin UI instead of env vars. Revision ID: 20260316_add_geofencing Revises: 20260314_add_taxonomy_mapping Create Date: 2026-03-16 """ from alembic import op import sqlalchemy as s...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260316_add_geofencing_to_server_settings.py
.py
fc6f3222ddb68ecb
7.6
15
"""Drop report_email from project_notification_preferences The report_email field was never exposed in the UI and all email notifications should always go to the user's account email. Revision ID: 20260319_drop_report_email Revises: 20260316_add_geofencing Create Date: 2026-03-19 """ from alembic import op import sq...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260319_drop_report_email.py
.py
bcd208f8f32b87a0
7.6
15
"""Add classification_thresholds to projects Adds an optional JSON column for per-species classification confidence thresholds. Shape: {"default": float, "overrides": {species: float}}. Null = no classification filtering applied (the same as default 0.0), which preserves existing behaviour for every project on day one...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260409_add_classification_thresholds.py
.py
f57d434bbc5cdea4
7.6
15
"""Add behavior to human_observations Standard camera trap annotation field for recording observed animal behaviour (foraging, traveling, resting, etc.). Matches the CamTrap DP 'behavior' column. American spelling for consistency with the standard. Revision ID: 20260410_add_behavior Revises: 20260410_add_sex_life_sta...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260410_add_behavior.py
.py
60428a6013a67a00
7.6
15
"""Add sex and life_stage to human_observations Ecologists need to record sex (male, female, unknown) and life stage (adult, subadult, juvenile, unknown) per observation. Values match the CamTrap DP standard. server_default='unknown' backfills existing rows automatically. Revision ID: 20260410_add_sex_life_stage Revi...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260410_add_sex_and_life_stage.py
.py
11990e4701f185e6
7.6
15
"""Add like fields to images Adds a project-wide "liked" flag so users can curate a best-of gallery for reporting and communication. Mirrors the existing verification fields (boolean + timestamp + user_id) and is shared across the project rather than per-user. Revision ID: 20260413_add_image_like Revises: 20260410_ad...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260413_add_image_like.py
.py
06f92197123b1342
7.6
15
"""Add needs_review fields to images Adds a project-wide "needs review" flag so members can ask a colleague for a second pair of eyes on a specific image (low-confidence species ID, unusual behavior, training scenarios, etc.). Mirrors the like fields and is shared across the project rather than per-user. Revision ID:...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260413_add_image_needs_review.py
.py
bb166823c59ffa7c
7.6
15
"""Add reference image fields to cameras Adds a single reference image per camera so field workers can attach a phone photo of the install site (the tree, the mounting post, a landmark) for later navigation. Mirrors the project image pattern: one original plus a 512px thumbnail, both stored by filename in the local re...
PetervanLunteren/AddaxAI-Connect
services/api/alembic/versions/20260414_add_camera_ref_image.py
.py
c78f806bd3f78c51
7.6
15