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 |
|---|---|---|---|---|---|---|
"""Explanation payload models."""
from __future__ import annotations
from typing import Any
from pydantic import BaseModel, Field
class DetectorExplanation(BaseModel):
"""Per-detector human-readable explanation."""
detector: str
summary: str
rules: list[str] = Field(default_factory=list)
contr... | idris404/AnomX | packages/anomx/anomx/explain/models.py | .py | 3efdd00345e8283f | 7 | 0 |
import os
from google import genai
from google.genai import types
from tenacity import retry, wait_exponential, stop_after_attempt
class GeminiClient:
"""Client wrapper for persistent chat sessions using the genai SDK."""
def __init__(self, system_instruction: str, api_key: str, model: str):
"""Initia... | r-bharathikannan-2006/FixBug-core | src/ai_client.py | .py | 4c8608441046a04f | 7 | 0 |
import json
import os
from pathlib import Path
# Set configuration directory and file paths
CONFIG_DIR = Path.home() / "FixBug-core"
CONFIG_FILE = CONFIG_DIR / "config.json"
DEFAULT_CONFIG = {
"api_key": "",
"model": "gemini-3.6-flash",
"max_agent_loops": 5,
"output_max_lines": 6,
"truncate_dot_li... | r-bharathikannan-2006/FixBug-core | src/config_manager.py | .py | d58d224d5520179c | 7 | 0 |
import os
import sys
import re
from pathlib import Path
import requests
import traceback
from cmd_handler import CMD_handle
from cmd_display import Display
from prefixer import Prefixer
from tools import AIActionExecutor
from ai_client import GeminiClient
from config_manager import load_config, open_settings_menu
de... | r-bharathikannan-2006/FixBug-core | src/main.py | .py | 45e767efe42d8780 | 7 | 0 |
from pathlib import Path
import sys
import importlib
from tree_sitter import Language, Parser
class Prefixer:
"""Analyzes directory structures and generates abstract syntax tree representations.
Provides utilities to traverse directory trees while ignoring specified
environments and generates XML-formatte... | r-bharathikannan-2006/FixBug-core | src/prefixer.py | .py | b829faffa6eca431 | 7 | 0 |
"""Config flow for AviationWeather and TAF integration."""
from __future__ import annotations
import logging
from typing import Any
import aiohttp
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowRes... | ianpleasance/home-assistant-aviation-weather | custom_components/aviation_weather/config_flow.py | .py | d211ef486f351975 | 7 | 0 |
"""Atomic output helpers for generated CSV and Markdown workpapers.
The command deliberately lets its interactive caller choose the files it
reads and the name of the CSV it writes. Generated outputs still must not
follow an existing destination symlink: a stale link can otherwise overwrite
its target rather than the... | ryanduguid/payday-super-checker | paydaysuper/atomic_io.py | .py | 8ea29cbc3cdd67a7 | 7 | 0 |
"""National business-day calendar for SGAA 1992 s 6(1).
"business day means a day other than: (a) a Saturday or a Sunday; or
(b) a day which is a public holiday for the whole of: (i) any State; or
(ii) the Australian Capital Territory; or (iii) the Northern Territory."
One national calendar for every employer, regard... | ryanduguid/payday-super-checker | paydaysuper/calendar.py | .py | 8cd64fb11c76f3fc | 7 | 0 |
"""Deadline engine: SGAA 1992 s 18C pathways.
Pathways implemented:
- USUAL_7BD s 6(1) "usual period": ends 7th business day after QE day
- EXTENDED_20BD s 18C(2) item 1: first eligible contribution to a
particular fund (new/recommenced employee or fund switch)
- OUT_OF_CYCLE s 18C(2) item 2 +... | ryanduguid/payday-super-checker | paydaysuper/deadlines.py | .py | 08e08889b49292a2 | 7 | 0 |
"""Vendor export profiles.
A profile is data, not code: adding a payroll system means writing a JSON
file, and correcting a column name someone renamed is a one-line edit.
"""
from __future__ import annotations
import json
import re
import unicodedata
from dataclasses import dataclass
from pathlib import Path
from .... | ryanduguid/payday-super-checker | paydaysuper/profiles.py | .py | 21a689d8694420fe | 7 | 0 |
"""Dated legal rates: GIC quarters and FY super parameters.
Every rate lives in paydaysuper/data/*.json, recording where it came
from and when that was checked. Nothing here is hard-coded because all
of it changes: GIC resets quarterly (TAA 1953 s 8AAD), the SG
parameters change each financial year."""
from __future__... | ryanduguid/payday-super-checker | paydaysuper/rates.py | .py | c8f27a456feeb9f8 | 7 | 0 |
"""SG-charge exposure estimates for late contributions.
Components (SGAA s 16B(2)) modelled here:
- final SG shortfall (input: the unpaid individual SG amount)
- notional earnings component (s 19A): daily compounding at the GIC rate
on the BASE shortfall, starting the day AFTER the last on-time day (final
LCR 2026... | ryanduguid/payday-super-checker | paydaysuper/sgc.py | .py | 695e4ce88f8cc96a | 7 | 0 |
import json
from datetime import date
from pathlib import Path
import pytest
from paydaysuper.calendar import CalendarError, load_calendar
@pytest.fixture(scope="module")
def cal():
return load_calendar()
def test_weekends_are_not_business_days(cal):
assert not cal.is_business_day(date(2026, 8, 8)) # Sat... | ryanduguid/payday-super-checker | tests/test_calendar.py | .py | 8b9a475bfb4e9fc6 | 7.5 | 0 |
"""Regression coverage for the hand-review-only calendar generator."""
from __future__ import annotations
import json
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_raw_generator_is_provisional_until_the_reviewed_table_confirms_dates():
"""Generation ... | ryanduguid/payday-super-checker | tests/test_generate_calendar.py | .py | c8a48f135e0d5a16 | 7.5 | 0 |
from logging.config import dictConfig
from vllm.logger import DEFAULT_LOGGING_CONFIG
def register():
"""Register OpenVINO."""
return "vllm_openvino.platform.OpenVinoPlatform"
def _init_logging():
"""Setup logging, extending from the vLLM logging config"""
config = {**DEFAULT_LOGGING_CONFIG}
# ... | belonghim/vllm-openvino | vllm_openvino/__init__.py | .py | 5ff1c42f215631ad | 7 | 0 |
# SPDX-License-Identifier: Apache-2.0
from vllm.logger import init_logger
logger = init_logger(__name__)
def determine_num_available_blocks(current_platform, cache_config, cache_block_size: int, profile_run_func) -> tuple[int, int]:
"""Determine the number of blocks available for the KV cache.
This determine... | belonghim/vllm-openvino | vllm_openvino/utils.py | .py | 0ad870af7cc76237 | 7 | 0 |
"""Shared MCP money parsing. No statutory arithmetic lives here."""
from __future__ import annotations
from decimal import Decimal, InvalidOperation
MAX_MONEY_MAGNITUDE = Decimal("1000000000000.00")
MAX_MONEY_DECIMAL_PLACES = 2
def parse_amount(value: str, field: str) -> Decimal:
"""Parse a required decimal-st... | ryanduguid/au-tax-mcp-server | aus_accounting_mcp/money.py | .py | c9b8dbc56ca83c0f | 7 | 0 |
"""Australian accounting MCP server.
Statutory tools are facades over payday-super-checker and ato-benchmark-compare.
Division 7A is refused until a reviewed engine exists. SBR payloads are synthetic.
"""
from __future__ import annotations
from decimal import Decimal
from importlib.metadata import PackageNotFoundErr... | ryanduguid/au-tax-mcp-server | aus_accounting_mcp/server.py | .py | 2ba518c0f5710906 | 7 | 0 |
"""Centralised access to the local Ollama model.
Every Ollama call in the pipeline goes through this module so that retry
behaviour and error classification live in one place.
The key distinction this module enforces:
* **Infrastructure failure** — Ollama is not running, the model is not pulled,
or the connection ... | wtemmerman/strivee-to-btwb | src/strivee_btwb/core/llm.py | .py | ad2da1e86d772332 | 7 | 0 |
"""Centralized logging configuration for the strivee-btwb pipeline."""
import logging
import sys
_RESET = "\033[0m"
_LEVEL_COLORS = {
logging.DEBUG: "\033[2m", # dim
logging.INFO: "\033[0m", # normal (no color change)
logging.WARNING: "\033[33m", # yellow
logging.ERROR: "\033[31m", # red
loggi... | wtemmerman/strivee-to-btwb | src/strivee_btwb/core/log.py | .py | 4a132973239ab1da | 7 | 0 |
"""Shared data models for the strivee-btwb pipeline.
The models are frozen: every pipeline stage produces a new value rather than
mutating in place (capture → parse → clean → format → post), so immutability
matches how the data actually flows and rules out a stage accidentally editing a
cached object. Use :meth:`Progr... | wtemmerman/strivee-to-btwb | src/strivee_btwb/core/models.py | .py | ed169cc9b51fca96 | 7 | 0 |
"""Turn the audit's per-muscle gap into the accessory block to post.
Entirely deterministic, and deliberately so. The pool already stores BTWB's own
movement names, so the text this builds is in BTWB's vocabulary before it is
written — there is nothing here for the format model to improve and a great deal
for it to br... | wtemmerman/strivee-to-btwb | src/strivee_btwb/processing/accessory.py | .py | 6fce2aa5e24d17f8 | 7 | 0 |
"""LLM-based workout formatting for BTWB.
Replaces the regex approach for the post step: sends each block's raw content to
a local Ollama model, which extracts the Rx-level content and formats it cleanly
for entry into BTWB's workout form.
"""
import logging
import re
from ..core import config
from ..core.llm import... | wtemmerman/strivee-to-btwb | src/strivee_btwb/processing/llm_format.py | .py | f844003d6d4a7e3f | 7 | 0 |
"""Read the sets a programming block prescribes.
The counting rules live in :mod:`.volume`; this module only turns coach
shorthand into the list of movements and set counts those rules operate on.
That split is the point: "6 sets of : 1min ON / 1min OFF" followed by five
movement lines is a language problem the model ... | wtemmerman/strivee-to-btwb | src/strivee_btwb/processing/set_extract.py | .py | 45c9ec175fb09181 | 7 | 0 |
"""Generate the accuracy + timing baseline from saved text-era captures.
Re-parses every week that has .txt captures with the CURRENT analyser, refreshes
the parsed/ cache (the committed cache may be from an older prompt), snapshots the
analyse and format outputs under baselines/, and records per-stage timing.
py... | wtemmerman/strivee-to-btwb | tests/benchmark/run_baseline.py | .py | da206c9cbae5bc82 | 7.5 | 0 |
"""Unit tests for the Strivee → BTWB movement vocabulary."""
from strivee_btwb.processing.btwb_movements import apply_movement_aliases
def test_single_arm_handstand_hold_becomes_weight_shift():
text = "Single arm Wall facing handstand Hold x15 sec / arm"
assert apply_movement_aliases(text) == "Wall Facing Ha... | wtemmerman/strivee-to-btwb | tests/unit/processing/test_btwb_movements.py | .py | 0de7fe4efc903ac0 | 7.5 | 0 |
"""A tap on the guest is a choice, not a sit. They pick. Then they do that sit.
Port of ``web/src/lib/pets/guest-choice.ts`` (and ``desktop/renderer/choice.js``).
"""
from __future__ import annotations
from typing import Iterable
GUEST_CHOICE = (
"rest",
"walk",
"sit",
"talk",
"treat",
"play... | RicheyWorks/computerpets | client/computerpets_client/choice.py | .py | c1a0c3124133eedb | 7 | 0 |
"""User-data and asset locations. No Qt import so license tests stay headless."""
from __future__ import annotations
import os
from pathlib import Path
def package_dir() -> Path:
return Path(__file__).resolve().parent
def default_user_data_dir() -> Path:
override = os.environ.get("COMPUTERPETS_CLIENT_HOME... | RicheyWorks/computerpets | client/computerpets_client/paths.py | .py | a96242c8c6501a8a | 7 | 0 |
"""Shared helpers for the PyInstaller spec files.
Kept next to the specs so the one-directory and the one-file build cannot drift
apart: both take their entry point, icon, excludes and version resource here.
"""
from __future__ import annotations
from pathlib import Path
PACKAGING_DIR = Path(__file__).resolve().par... | robert-rajtar/CurlForge | packaging/build_support.py | .py | c4d3283dc58a1a14 | 7 | 0 |
"""Builds assets/curlforge.ico from the master artwork.
Run from the repository root:
.venv\\Scripts\\python.exe scripts\\make-icon.py
Qt does the decoding, scaling and PNG encoding; the ICO container itself is
written here, because Qt cannot save that format. Windows Vista and later read
PNG-compressed icon ent... | robert-rajtar/CurlForge | scripts/make-icon.py | .py | 12d1613ffa9c9139 | 7 | 0 |
"""Application bootstrap: builds the QApplication and the main window."""
from __future__ import annotations
import sys
from pathlib import Path
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QApplication
from curlforge import APP_NAME, APP_ORGANIZATION, __version__
from curlforge.ui.main_window impo... | robert-rajtar/CurlForge | src/curlforge/app.py | .py | beaeec771ee74e91 | 7 | 0 |
"""Exception types raised by the CurlForge core.
Error messages must stay free of secret values: they may name a field, never
quote its content.
"""
from __future__ import annotations
class CurlForgeError(Exception):
"""Base class for all CurlForge errors."""
class CurlGenerationError(CurlForgeError):
"""... | robert-rajtar/CurlForge | src/curlforge/core/errors.py | .py | 0a182c9d295c4e9e | 7 | 0 |
"""Pure cURL command generation.
The generator is deterministic: identical input always produces byte-identical
output. It has no Qt, filesystem or network dependency, so the whole command
surface can be tested without starting the application.
Argument order is fixed:
1. ``curl``
2. common flags
3. timeout and outp... | robert-rajtar/CurlForge | src/curlforge/core/generator.py | .py | 980bf882a8dead6b | 7 | 0 |
"""Detection and replacement of sensitive values.
The rules are intentionally over-inclusive. A redacted value that was harmless
costs the user one click on "Show secrets"; a leaked credential cannot be taken
back.
"""
from __future__ import annotations
from curlforge.core.constants import (
API_KEY_PLACEHOLDER,... | robert-rajtar/CurlForge | src/curlforge/core/redaction.py | .py | 13017cfcf052e077 | 7 | 0 |
"""URL assembly from a base URL and the enabled query parameter rows."""
from __future__ import annotations
from collections.abc import Sequence
from urllib.parse import quote, urlsplit, urlunsplit
from curlforge.core.models import KeyValueRow
def encode_query_pair(name: str, value: str) -> str:
"""Percent-enc... | robert-rajtar/CurlForge | src/curlforge/core/urlbuild.py | .py | f25fa036b395915c | 7 | 0 |
"""Writing a generated command to a file.
Shell scripts are written with LF endings so they run unchanged under Git Bash,
WSL and Linux; a CRLF shebang line makes bash fail with a confusing error.
"""
from __future__ import annotations
from pathlib import Path
from curlforge.core.errors import CurlForgeError
SHEBA... | robert-rajtar/CurlForge | src/curlforge/persistence/command_export.py | .py | ef88ffb91154a43f | 7 | 0 |
"""Locations of the local, per-user data files.
Resolved from the environment rather than through Qt, so persistence stays
testable without a running application.
"""
from __future__ import annotations
import os
from pathlib import Path
APP_DIR_NAME = "CurlForge"
PROFILES_DIR_NAME = "profiles"
SETTINGS_FILE_NAME = ... | robert-rajtar/CurlForge | src/curlforge/persistence/paths.py | .py | 67ce57890689688f | 7 | 0 |
"""Versioned profile schema and secret-aware serialization.
A profile file is a small envelope around a request configuration. The envelope
carries the schema version so a future format change can be detected instead of
silently misread.
"""
from __future__ import annotations
from datetime import UTC, datetime
from ... | robert-rajtar/CurlForge | src/curlforge/persistence/profile_schema.py | .py | 15a9c3159f338c24 | 7 | 0 |
"""Persistence for user preferences.
Settings are a convenience, not data the user typed. A missing or damaged file
falls back to defaults instead of interrupting startup.
"""
from __future__ import annotations
import contextlib
import json
from pathlib import Path
from typing import Any, Literal
from pydantic impo... | robert-rajtar/CurlForge | src/curlforge/persistence/settings_store.py | .py | 46adab60042f98f3 | 7 | 0 |
"""Fixtures for the opt-in GUI tests.
Only collected when the ``gui`` marker is selected, so the core suite stays
headless and free of Qt.
"""
from __future__ import annotations
import os
from collections.abc import Iterator
from pathlib import Path
import pytest
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen... | robert-rajtar/CurlForge | tests/gui/conftest.py | .py | 0bd1f18824512e3d | 7.5 | 0 |
"""Safe placeholder data and row factories shared by the tests.
Every value here is a placeholder. Real hosts, users, credentials or internal
endpoints must never appear in tests.
"""
from __future__ import annotations
from curlforge.core.models import HeaderRow, QueryParamRow
EXAMPLE_BASE_URL = "https://api.exampl... | robert-rajtar/CurlForge | tests/helpers.py | .py | f8445f02c25dcf19 | 7.5 | 0 |
"""O identificador que liga uma reclamação ao que aconteceu no Hub.
Quando alguém diz "meu job falhou", a única pista costumava ser o horário
aproximado. Cada requisição passa a carregar um identificador que aparece na
resposta de erro, no cabeçalho e em toda linha da trilha de auditoria daquela
requisição -- é o que ... | ValdemirBSJr/lucien | backend/app/domain/correlation.py | .py | 8d6c4429fc7249b9 | 7 | 0 |
import re
from collections.abc import Callable
from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class SanitizationResult:
"""Resultado da redação sem manter o valor sensível removido."""
text: str
replacements: int
_PRIVATE_KEY_PATTERN = re.compile(
r"-----BEGIN (?P<label>[A-Z0... | ValdemirBSJr/lucien | backend/app/domain/dlp.py | .py | d7d93fad63c20791 | 7 | 0 |
from dataclasses import dataclass
from datetime import datetime
from enum import StrEnum
class JobStatus(StrEnum):
PROCESSING = "PROCESSING"
PENDING = "PENDING"
PUBLISHED = "PUBLISHED"
FAILED = "FAILED"
class RoleLevel(StrEnum):
JUNIOR = "junior"
PLENO = "pleno"
SENIOR = "senior"
ADM... | ValdemirBSJr/lucien | backend/app/domain/models.py | .py | ddc85f04c54adb1a | 7 | 0 |
import json
import re
from collections.abc import Sequence
from dataclasses import dataclass
from datetime import UTC
from enum import StrEnum
from app.domain.models import Job, PublicationIdentity, RoleLevel
from app.domain.ports import ForbiddenError, ValidationError
class Criticality(StrEnum):
LOW = "baixa"
... | ValdemirBSJr/lucien | backend/app/domain/publication.py | .py | 222bd8f702d10986 | 7 | 0 |
import re
# Duas gramáticas de prompt convivem no mesmo log.
#
# A primeira alternativa é a original e permanece byte a byte igual: shells
# POSIX separam o comando do prompt por espaço (`user@host:~$ ls`). Toda sessão
# local ou em servidor Linux continua sendo reconhecida exatamente como antes.
#
# A segunda cobre ... | ValdemirBSJr/lucien | backend/app/domain/transcript.py | .py | a4308d6abb9fa11c | 7 | 0 |
"""Migrações versionadas do PostgreSQL, aplicadas na subida do Hub.
Até aqui o esquema evoluía por doze arquivos `.sql` aplicados à mão, na ordem
de uma lista na documentação, sem nenhum registro do que já tinha rodado. Quem
migrava precisava lembrar onde parou, e não havia como perguntar ao banco.
Duas coisas susten... | ValdemirBSJr/lucien | backend/app/infrastructure/migrations.py | .py | a52c5970d3a48a12 | 7 | 0 |
import httpx
from app.domain.ports import SecretScanner, UpstreamError
class GitleaksSecretScanner(SecretScanner):
"""Adapter HTTP para o scanner isolado, sem registrar o conteúdo analisado."""
def __init__(self, base_url: str, timeout_seconds: float) -> None:
# Cliente compartilhado: um upload disp... | ValdemirBSJr/lucien | backend/app/infrastructure/secret_scanner.py | .py | 6ed26260f0e4db40 | 7 | 0 |
import hmac
from typing import Annotated
from fastapi import Depends, HTTPException, Request
from fastapi.responses import JSONResponse
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
from starlette.responses import Response
from app.config import Settings
from app.domain.correlation... | ValdemirBSJr/lucien | backend/app/infrastructure/security.py | .py | 63466102bf798c8c | 7 | 0 |
import json
import re
import unicodedata
from typing import Literal
import httpx
from app.domain.models import RunbookEnrichment, RunbookSuggestions
from app.domain.ports import CommandExtractor, RunbookEnricher, UpstreamError
from app.domain.transcript import (
observed_command_lines,
prompt_view,
prompt... | ValdemirBSJr/lucien | backend/app/infrastructure/slm.py | .py | 9fe41cec05a95192 | 7 | 0 |
"""A regra de dependência entre camadas, verificada no próprio código.
Domínio e aplicação não podem depender de infraestrutura. A regra é fácil de
enunciar e fácil de quebrar sem querer: um import conveniente resolve o
problema da hora e nada reclama depois -- foi assim que `application.py` passou
a importar o hash d... | ValdemirBSJr/lucien | backend/tests/test_camadas.py | .py | 48e8daa14ee3fa08 | 7.5 | 0 |
"""Golden files do que o Hub produz para os seus consumidores.
O portal e o Hub têm ambos um pacote `app` e não podem ser importados no mesmo
processo. Estes arquivos são o que os obriga a concordar: aqui eles são
regenerados a partir do código real e comparados; em
`runbook-viewer/tests/test_contracts.py` eles são li... | ValdemirBSJr/lucien | backend/tests/test_contracts.py | .py | e6402fffdb8a3084 | 7.5 | 0 |
"""O nome do arquivo de revisão, que é lido por gente.
O esquema anterior era `revision-<uuid-da-raiz>-r2--<uuid-novo>.md`: exato e
ilegível. Quem abria o repositório não conseguia dizer de que runbook aquela
revisão era. O nome passa a ser o da raiz mais `-version-<n>`.
"""
from datetime import datetime, timezone
i... | ValdemirBSJr/lucien | backend/tests/test_nome_de_revisao.py | .py | ddc9c7432d8c7293 | 7.5 | 0 |
"""PROP-RL-LIVE2 scenario 3: REAL promote_gate_run.main() invocation (the actual production
entrypoint promote_gate.sh calls), against the REAL live ledger, with a disposable git clone
supplying the candidate/baseline text, and ONLY the actual `claude` CLI subprocess call mocked
(explicit, documented: a real Opus adver... | Daisuke134/life-manager | .vcsdd/features/self-improve-real-ledger/verification/proof-harnesses/prop_rl_live2_scenario3.py | .py | 35e0a0db1518c852 | 7.48 | 8 |
from __future__ import annotations
import os
from collections.abc import Awaitable, Callable, Iterable
from typing import Any
from ..ats import detect_provider
from ..state import canonical_url
from .contracts import QueueRowReceiptV1
RowProcessor = Callable[[dict[str, Any]], Awaitable[str]]
_STATUSES = frozenset(
... | Daisuke134/life-manager | apps/job-search-loop/job_search_loop/browser_agent/queue.py | .py | 83981c2fb47ed43e | 7.48 | 8 |
'''
This module will serve as the orchestrator for the agents, it will handle calling agents, intializing task reports,
processing agent output, exposing tools, and possibly more.
'''
from ..api import api_client
from .claude_agent import run_workflow as run_claude_agent
from .openai_agent import run_workflow as run_b... | LeeHWilliamson/EHR-processing | mvp/agents/agent_common.py | .py | 49bb047454a90f19 | 7.15 | 1 |
'''
We are going to set our AI agent to the task of assembling patient records by using the OpenAI API
This script will
- Define wrappers for accessing our API endpoints (these wrappers are often called 'tools' for the agent)
- Call our agent with those tool definitions
- Receive tool call requests from the agent, and ... | LeeHWilliamson/EHR-processing | mvp/agents/claude_agent.py | .py | 323d5f5f3ca26971 | 7.15 | 1 |
'''
We are going to set our AI agent to the task of assembling patient records by using the OpenAI API
This script will
- Define wrappers for accessing our API endpoints (these wrappers are often called 'tools' for the agent)
- Call our agent with those tool definitions
- Receive tool call requests from the agent, and ... | LeeHWilliamson/EHR-processing | mvp/agents/openai_agent.py | .py | cc6ea59eaa70b3d9 | 7.15 | 1 |
'''
This script will insert all information for 1 patient into the sqlite DB
input: a DB connection and patient JSON (as dict)
output: none
'''
import sqlite3
import json
import math
#helper function to deal with nans
def clean_fk(value):
if value is None:
return None
if isinstance(value, float) and ma... | LeeHWilliamson/EHR-processing | mvp/databases/db_ops/insert_patient_sqlite3.py | .py | c8d589feac5b6f7f | 7.15 | 1 |
'''
This script will format the output text of the agent, and compare the accuracy of the result to the patient GT
input: patient GT and agent output text
output: accuracy metric as float, list of meds that were missed by agent, list of meds that were hallucinated by agent
'''
def parse_agent_output(agent_output = Non... | LeeHWilliamson/EHR-processing | mvp/evaluation/performance/calc_output_metrics.py | .py | 43a0239d450ffa35 | 7.15 | 1 |
'''
this script loads patient data from synthea csvs and converts each patient to a standard json object
first we load the patients csv file as a pandas dataframe and use it to initialize a json object for each patient
then we load other csvs in sequence and use them to populate the json object of each patient
'''
impo... | LeeHWilliamson/EHR-processing | mvp/generation/load_patient_gt.py | .py | 43e6fe42c503ad5c | 7.15 | 1 |
import json
from pathlib import Path
import csv
from datetime import datetime
def calculate_age(birthdate_str, date_format="%Y-%m-%d"):
"""
convert age str in patient json to datetime and calculate difference from today's date
"""
try:
# Parse the birthdate string into a datetime object
... | LeeHWilliamson/EHR-processing | mvp/tasks/anesthesia_prep_v1/get_anesthesia_prep_gt.py | .py | b49f2257bf48c26e | 7.15 | 1 |
'''
Here we will test the ground truth assembly for our various tasks
'''
from mvp.tasks.medication_retrieval_v1.get_patient_meds import get_meds
import json
from pathlib import Path
'''
The gt should return an empty list if patient is deceased as of current date
Otherwise, it should return an accurate list of current ... | LeeHWilliamson/EHR-processing | mvp/tests/tasks/test_ground_truths.py | .py | b5f05016a77ea3ac | 7.65 | 1 |
'''
This script will pass arguments to Synthea to generate a set of patients with user-selected params
'''
import subprocess
from pathlib import Path
import argparse
from mvp.generation.load_patient_gt import (
run_end_to_end as create_simplified_patient_jsons,
)
WEBAPP_DIR = Path(__file__).resolve().parent.parent... | LeeHWilliamson/EHR-processing | webapp/generate_patients/generate_population.py | .py | 41c35369d5821a6d | 7.15 | 1 |
"""Internal semantic-frame validation and serialization helpers."""
from __future__ import annotations
import math
from collections.abc import Sequence
from dataclasses import dataclass, replace
from datetime import date, datetime
from enum import Enum
from typing import Literal, TypeAlias
import polars as pl
from ... | eyenoticeall/Lacuna | python/lacuna/_frames.py | .py | 01f2aecf7651e8ae | 7.15 | 1 |
"""Optional DuckDB-to-Arrow interoperability without pandas materialization."""
from __future__ import annotations
from collections.abc import Sequence
from numbers import Integral
import polars as pl
from lacuna.adapters.polars import frame_summary, require_columns, to_polars
from lacuna.adapters.types import Adap... | eyenoticeall/Lacuna | python/lacuna/adapters/duckdb.py | .py | c67fdd01b6192779 | 7.15 | 1 |
"""Polars-first normalization at Lacuna's dataframe boundary."""
from __future__ import annotations
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
from typing import Any, TypeAlias
import numpy as np
import polars as pl
from lacuna.exceptions import DataContractError
PolarsFrame: T... | eyenoticeall/Lacuna | python/lacuna/adapters/polars.py | .py | b70e239c196feee0 | 7.15 | 1 |
"""scikit-learn-compatible wrappers for Lacuna temporal splitters."""
from __future__ import annotations
from collections.abc import Iterator, Mapping
from typing import TypeAlias
import numpy as np
import numpy.typing as npt
from lacuna.cv import (
CombinatorialPurgedKFold,
CombinatorialSplitResult,
Pu... | eyenoticeall/Lacuna | python/lacuna/adapters/sklearn.py | .py | 0015df860c9ae940 | 7.15 | 1 |
"""Shared immutable results for optional adapter boundaries."""
from __future__ import annotations
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
import polars as pl
from lacuna.adapters.polars import PolarsFrame, frame_summary, require_columns, to_polars
from lacuna.exceptions impo... | eyenoticeall/Lacuna | python/lacuna/adapters/types.py | .py | 178a15fee31e69c3 | 7.15 | 1 |
"""Explicit global and scoped runtime configuration."""
from __future__ import annotations
import os
from collections.abc import Iterator
from contextlib import contextmanager
from contextvars import ContextVar
from dataclasses import dataclass
from typing import Literal, Self, TypedDict, Unpack
from lacuna.exceptio... | eyenoticeall/Lacuna | python/lacuna/config.py | .py | 170316cb560a205e | 7.15 | 1 |
"""Safe access to the optional compiled extension."""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class NativeStatus:
"""Availability and version information for Lacuna's native core."""
available: bool
version: str | None
error: str | No... | eyenoticeall/Lacuna | python/lacuna/native.py | .py | 812dc4dee1b71b42 | 7.15 | 1 |
"""Agent execution: any CLI is an agent. A profile ({cmd, args, resume_args, timeout, cwd,
cwd_map}) turns Claude Code, Codex, or your own wrapper into a Taskuary teammate: prompt
over STDIN (argv length limits are real on Windows), JSON output parsed when available
(Claude-style {result, session_id} -> resumable sessi... | ldbumble/taskuary | taskuary/agents.py | .py | 31928fd3651dd3bd | 7.64 | 18 |
"""`taskuary` - start the local server and open the app. Everything lives in ~/.taskuary."""
import argparse, socket, threading, time, webbrowser
import uvicorn
from . import __version__, config
def public_url(host, port) -> str:
"""0.0.0.0 / :: are bind addresses, not a place a browser can go."""
shown = '12... | ldbumble/taskuary | taskuary/cli.py | .py | aaf937141382f75f | 7.64 | 18 |
"""Any database by connection string - one card, every engine. Two roads by shape:
a URL ('postgresql://user:pw@host/db', 'mysql+pymysql://...', 'snowflake://...') runs
through SQLAlchemy; anything else ('DRIVER={...};SERVER=...;') is a raw ODBC string via
pyodbc. A {password} placeholder in the string is filled from t... | ldbumble/taskuary | taskuary/db.py | .py | 2a797a28385c70c2 | 7.64 | 18 |
"""Taskuary desktop: the same server + UI in a native window, shipped as one executable.
The FastAPI app runs on a free localhost port in a background thread; pywebview (Edge
WebView2 on Windows) hosts the UI. No pywebview -> graceful fallback to the default
browser, so `taskuary-desktop` is useful even from a bare pi... | ldbumble/taskuary | taskuary/desktop.py | .py | 6feffa5569d5acf5 | 7.64 | 18 |
"""Operator-doc automation: the docs are the agents' constitution, so connector changes
write themselves in. Two mechanisms, both non-destructive to hand-written prose:
- a marker-fenced 'Connected systems' block in SOUL.md, rebuilt on every connector/source
change (only the fenced block is touched);
- the GitHub rep... | ldbumble/taskuary | taskuary/docsync.py | .py | ed27229675da98a4 | 7.64 | 18 |
"""Minimal GitHub helpers (optional): a fine-grained PAT is all the config."""
import requests
GH = 'https://api.github.com'
def _h(tok): return {'Authorization': f'Bearer {tok}', 'Accept': 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28'}
def create_issue(tok, repo, title, bod... | ldbumble/taskuary | taskuary/github.py | .py | d5872485a6c0e87f | 7.64 | 18 |
"""Generate operator guidance from the mailbox's OWN history - the three months of mail
that predate Taskuary. learn.py distills verdicts the funnel has witnessed; this bootstraps
from what it never saw: the Docs tab's "Generate from history" button reads the Graph
mailbox (sent + inbox, paged), pairs what the owner AN... | ldbumble/taskuary | taskuary/histgen.py | .py | 0447b2fbe85d2116 | 7.64 | 18 |
"""Microsoft SQL Server connector - local-first via pyodbc. Structured config (no DSN
strings to hand-craft): {"server", "database", "auth": "windows"|"sql", "username",
"password", "driver", "query"}. Windows auth is the default because local SQL Server is
the primary use case; `driver` auto-picks the newest installed... | ldbumble/taskuary | taskuary/mssql.py | .py | f2574a46ab8ec850 | 7.64 | 18 |
"""Deterministic policy engine: what gets auto-answered, drafted, escalated, or ignored.
Pure - policies and the message come in as dicts, a decision comes out - so every rule is
unit-testable offline and the engine is reusable outside this repo. Fixed precedence
(no confidence score can override it, Basware autonomy-... | ldbumble/taskuary | taskuary/policy.py | .py | ab8e068ba18954e0 | 7.64 | 18 |
"""Proof of work: the evidence behind a task, gathered so approving is a JUDGEMENT and not
an act of faith. Every other agent runner asks you to trust the agent; this one asks you to
approve it - and an approval is only worth the evidence in front of it.
Nothing here is generated prose. Files come from git, tests from... | ldbumble/taskuary | taskuary/proof.py | .py | a9922f8eefac33c3 | 7.64 | 18 |
"""Research connectors: the web as a report source.
Every executor here is plain REST with a key on a card - no browser client, no SDK, nothing new
frozen into the single-exe build. That is deliberate and it is also the boundary: Browserbase and
Stagehand DRIVE a browser (log in, click, fill), which happens over CDP t... | ldbumble/taskuary | taskuary/research.py | .py | 02ae108be680c80f | 7.64 | 18 |
"""Pure routing engine: decide whether an incoming message belongs to an existing task.
No DB, no network - operates on plain dicts so it is unit-testable offline and reusable
outside this repo. Signals (strongest first):
thread - same ConversationId as a message already on the task (near-certain match)
subj... | ldbumble/taskuary | taskuary/routing.py | .py | 166f640707c465c9 | 7.64 | 18 |
"""What still needs doing before Taskuary can actually work, derived from real state.
The app has never said what "set up" means. A fresh install opens on an empty Timeline that
looks exactly like a working install with a quiet morning, and the three things standing between
those two states - who you are, an AI that c... | ldbumble/taskuary | taskuary/setup.py | .py | c720416e0eec27cd | 7.64 | 18 |
"""Point TASKUARY_HOME at a temp dir BEFORE any taskuary import - server.py loads config
and opens the store at import time, so this must run first (pytest imports conftest first).
"""
import os, tempfile
os.environ.setdefault('TASKUARY_HOME', tempfile.mkdtemp(prefix='taskuary_test_'))
import pytest
@pytest.fixture... | ldbumble/taskuary | tests/conftest.py | .py | 379e0b37e71560e9 | 7.14 | 18 |
#!/usr/bin/env python3
"""Fail-closed inspection of a built wheel before publication."""
from __future__ import annotations
import hashlib
import json
import re
import sys
import zipfile
from pathlib import Path
SECRET = re.compile(r"(sk-[A-Za-z0-9_-]{16,}|ghp_[A-Za-z0-9]{20,}|BEGIN (?:RSA |OPENSSH )?PRIVATE KEY)")
... | fuckbigtech-ai/homestead-memory | scripts/verify_artifact.py | .py | aeebd50a2f0a0a83 | 7 | 0 |
"""CrewAI memory adapter.
``HomesteadCrewAIStorage`` targets CrewAI Storage/memory (>=0.70), whose
storage-style integrations expose ``save``, ``search``, and ``reset`` methods.
Framework imports are optional and intentionally deferred.
"""
from __future__ import annotations
import json
from typing import Any
class... | fuckbigtech-ai/homestead-memory | src/homestead_memory/adapters/crewai_memory.py | .py | ea548b374776131a | 7 | 0 |
"""Universal callable tools backed by :class:`homestead_memory.Memory`.
These helpers do not depend on any agent framework. Register the returned
callables directly, or wrap the specs from :func:`tool_specs` in the function
tool shape expected by your runner.
"""
from __future__ import annotations
from typing import ... | fuckbigtech-ai/homestead-memory | src/homestead_memory/adapters/tools.py | .py | afcd016bee47973f | 7 | 0 |
#!/usr/bin/env python3
"""capture.py — turn an agent tool-call event into a record safe to keep forever.
WHY REDACTION IS THE HARD PART
------------------------------
A `PostToolUse` payload carries `tool_response`: the whole file for a Read, the whole
output for a Bash command. Recording it verbatim would build a cre... | fuckbigtech-ai/homestead-memory | src/homestead_memory/core/capture.py | .py | 09217405d3a34a51 | 7 | 0 |
#!/usr/bin/env python3
"""
core.chunking — split a retrieved note into query-relevant windows.
Retrieval finds the right *note* (qmd hybrid gives ~85% recall on LongMemEval),
but the reader was drowning in qmd's ~350-char snippet. The fix is parent-document
retrieval done at read time: resolve the retrieved note, spli... | fuckbigtech-ai/homestead-memory | src/homestead_memory/core/chunking.py | .py | fe4874c788d38158 | 7 | 0 |
#!/usr/bin/env python3
"""Write-provenance helpers for the distilled layer."""
from __future__ import annotations
import os
import re
import secrets
import socket
from datetime import datetime, timezone
_SESSION_ID: str | None = None
PROV_RE = re.compile(
r"\[agent=(?P<agent>[^\s\]]+)\s+session=(?P<session>[^\s\... | fuckbigtech-ai/homestead-memory | src/homestead_memory/core/provenance.py | .py | db30b005c8bd4286 | 7 | 0 |
#!/usr/bin/env python3
"""Crash-safe store primitives shared by mutating memory writers."""
from __future__ import annotations
import contextlib
import os
import tempfile
import time
from pathlib import Path
from . import provenance
def _unlink_lock(path: Path, attempts: int = 50) -> bool:
"""Remove a lock desp... | fuckbigtech-ai/homestead-memory | src/homestead_memory/core/store.py | .py | 34a9924f08abfd20 | 7 | 0 |
#!/usr/bin/env python3
"""
core.telemetry — a local, opt-in usage log.
The frontier-lab move is "your usage telemetry post-trains OUR model." This is the
local-first counterpart: an append-only `.hsm/telemetry.jsonl` recording how retrieval
performed. homestead-memory NEVER sends it anywhere — it's a plain-JSON file y... | fuckbigtech-ai/homestead-memory | src/homestead_memory/core/telemetry.py | .py | a9a8c2e8e6714014 | 7 | 0 |
#!/usr/bin/env python3
"""
core.tuning — the compounding loop, v0. Measured local self-improvement.
`hsm tune` grid-searches k against YOUR golden-recall fixtures (`.hsm/fixtures.json`)
and writes the best to `.hsm/tuning.json`, which `ask` then uses. The metric is FIXTURE
recall (before vs after) — it optimizes for t... | fuckbigtech-ai/homestead-memory | src/homestead_memory/core/tuning.py | .py | 60e8106ae5981b7a | 7 | 0 |
#!/usr/bin/env python3
"""
core.vault — the markdown-vault model: frontmatter parsing, wikilinks, recency.
Two correctness-critical primitives everything else depends on:
1. parse_frontmatter() — reads BOTH flat (`status:`) and nested (` status:`
under a `metadata:` key) frontmatter, flat wins on conflict, a... | fuckbigtech-ai/homestead-memory | src/homestead_memory/core/vault.py | .py | 74060fc8db7461b7 | 7 | 0 |
"""Small stdlib-only Python SDK for homestead-memory."""
from __future__ import annotations
from pathlib import Path
from typing import Any
class Memory:
"""Client wrapper around the core homestead-memory functions."""
def __init__(self, vault: str | Path | None = None, agent: str | None = None) -> None:
... | fuckbigtech-ai/homestead-memory | src/homestead_memory/sdk.py | .py | a5899b96fae30eef | 7 | 0 |
"""
audit.py - 统一审计日志接口
功能:向插件与框架提供线程安全的审计日志写入函数 audit_log
自动填充时间戳(UTC)、IP、用户名
存储格式:JSONL(每行一条独立 JSON),按天切分为
data/logs/audit/audit-YYYYMMDD.log
选用 JSONL 而非单个 JSON 数组,是为了支持「只追加写入」——
崩溃或断电最多损坏最后一行,不会破坏整份文件,也便于外部工具逐行流式处理。
"""
import json
import threading
from contextvars import ContextVar
from datetime import dateti... | test-qq-mail-bot/NetCore_Framework | core/audit.py | .py | b273d68fb92a7e6a | 7 | 0 |
"""
crypto_utils.py - 通用加密工具模块
功能:提供统一的 AES-256-GCM 加解密、PBKDF2 密码哈希
框架内部及所有插件均可直接调用
密文报文格式(encrypt / decrypt 与前端 frontend/aesgcm.js 严格一致):
Base64( nonce[12] || ciphertext[N] || tag[16] )
其中 tag 由 cryptography 的 AESGCM 自动附加在密文尾部,因此拆包时
只需切出前 12 字节 nonce,剩余部分整体交给 aes.decrypt 即可。
未使用 AAD(附加认证数据),三方实现对接时该参数须同样传 None/空... | test-qq-mail-bot/NetCore_Framework | core/crypto_utils.py | .py | 78c0ee9c4ae983bf | 7 | 0 |
"""
gotemplate.py - 轻量 Go template 子集渲染引擎
功能:解析并渲染 notify.yaml 中使用的 Go template 语法
仅支持项目所需的子集:变量 {{.Field}}、{{.Field.Sub}}、
条件判断 {{if eq .A "b"}}...{{else}}...{{end}}、{{if .A}}...{{end}}
"""
import re
class GoTemplate:
"""极简 Go template 渲染器(仅覆盖项目所需语法)"""
def __init__(self, text: str):
self.text = te... | test-qq-mail-bot/NetCore_Framework | core/gotemplate.py | .py | 196bbe99364e3501 | 7 | 0 |
# -*- coding: utf-8 -*-
"""core/https_utils.py - HTTPS 证书管理
设计:
- 配置文件 core.yaml 新增 https 段:enabled(默认 true)/ cert_file / key_file;
- enabled=true 且未配置自定义证书时,首次启动自动生成**自签名证书**
(data/certs/server.crt + server.key,有效期 365 天),保证「默认启用 HTTPS」开箱可用;
- 基础设置页可上传自定义证书(.crt/.pem + .key,类型受限),上传后保存为
data/certs/custom.crt / cu... | test-qq-mail-bot/NetCore_Framework | core/https_utils.py | .py | 30367dbd5659d678 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.