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 { cleanup } from "@testing-library/react";
import { afterEach } from "vitest";
// jsdom ships neither API, and both are reached for on mount by code the console
// renders on every run: @base-ui's Dialog (the decision sheet) and motion's
// AnimatePresence (the approval bar).
if (typeof window.matchMedia !== "f... | HamzaAlayed/laravel-claude-agents | console-ui/src/test/setup.ts | .ts | 38621327c5324d6f | 7.07 | 13 |
#!/usr/bin/env python3
"""Generate the Codex CLI 'Core' target under codex/ from the canonical pack.
Codex has no one-command extension install — config is spread across AGENTS.md,
.agents/skills/, and .codex/. This produces a self-contained codex/ tree plus an
install script that copies it into a target project. Rege... | HamzaAlayed/laravel-claude-agents | scripts/build-codex-extension.py | .py | 91c90a7ded73a25c | 7.57 | 13 |
#!/usr/bin/env python3
"""Generate the Gemini CLI extension under gemini/ from the canonical pack.
The Claude-format agents/commands are the source of truth. This regenerates the
Gemini extension so the two never drift — run it after editing any agent, command,
skill, or guard script, and commit the result.
pytho... | HamzaAlayed/laravel-claude-agents | scripts/build-gemini-extension.py | .py | 90e2feae31cf781c | 7.57 | 13 |
#!/usr/bin/env python3
"""Fail when the guardrail hook list drifts between its three homes.
The same hook set is declared in three places that history shows get edited
independently: the plugin manifest (hooks/hooks.json), the installer merge
list (install.sh), and the README's Guardrail scripts section. This check
ma... | HamzaAlayed/laravel-claude-agents | scripts/check-hook-sync.py | .py | a2616b4576948705 | 7.57 | 13 |
"""Parses the Guild pack into the catalog the console needs.
Single source of truth is the pack itself: agent slug, human name, model, tools
and colour all come from `agents/*.md` frontmatter. Deliberately introduces no
new registry — a sixth place to register an agent would fight
scripts/check_inventory_sync.py. Stdl... | HamzaAlayed/laravel-claude-agents | scripts/console/catalog.py | .py | c5733813f172a3a7 | 7.57 | 13 |
"""Normalizes raw Claude Agent SDK messages into the flat event stream the
console UI consumes.
Deliberately operates on plain dicts, not SDK objects, so the whole reducer is
testable from recorded fixtures at zero API spend. The engine adapts SDK
objects to dicts before calling in.
The subagent tree is rebuilt from ... | HamzaAlayed/laravel-claude-agents | scripts/console/events.py | .py | 52db67039f937762 | 7.57 | 13 |
"""Unit tests for the coordinator content hash in scripts/check_inventory_sync.py.
The hash pins the surfaces that steer delegation — the coordinator body and the
commands' shared Interface block — to the last billed run of the `feature` eval
case. CI cannot run billed evals; it CAN refuse to let those surfaces ship
c... | HamzaAlayed/laravel-claude-agents | tests/eval/test_coordinator_hash.py | .py | 2cebdd13da3d7332 | 8.07 | 13 |
"""Unit tests for scripts/eval-cost.py.
The synthetic transcripts here mirror the key paths recorded in
tests/eval/fixtures/README.md, captured from a real
`claude -p --output-format stream-json --verbose` run. If the CLI format
changes, re-capture the fixtures, update that README, and update these
builders -- do not ... | HamzaAlayed/laravel-claude-agents | tests/eval/test_eval_cost.py | .py | 6fc7faabf89049a0 | 7.07 | 13 |
"""
Shared helper for index data download scripts.
Why this file exists:
- Your project already had one NIFTY-only script.
- You now wanted BankNifty and FINNIFTY versions with the same behavior.
- Instead of copy-pasting the full fetch logic many times, this file keeps the
common flow in one place and lets the thin... | DoRmAmMu1997/My-Algo-Trading-Code | Data Extractors/index_1m_5y_data_fetch_dhan_common.py | .py | 0b87a0539e7d0451 | 7.52 | 10 |
"""Read-only Dhan index-option diagnostic with an opt-in REAL test order.
Examples from the repository root::
python "Dependencies/Dhan API/diagnose_dhan_symbol.py" CE 24150
python "Dependencies/Dhan API/diagnose_dhan_symbol.py" PE 24000 14JUL26
python "Dependencies/Dhan API/diagnose_dhan_symbol.py" --und... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/Dhan API/diagnose_dhan_symbol.py | .py | 5439be2a305d96e2 | 7.52 | 10 |
"""Read-only Flattrade NIFTY option diagnostic with an opt-in REAL test order.
Examples from the repository root::
python "Dependencies/Flattrade API/diagnose_flattrade_symbol.py" CE 24150
python "Dependencies/Flattrade API/diagnose_flattrade_symbol.py" PE 24000 14JUL26
The script logs in, downloads the same... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/Flattrade API/diagnose_flattrade_symbol.py | .py | faa7a79b29b483b2 | 7.52 | 10 |
"""
Diagnostic for Kotak option symbol resolution (and an optional REAL test order).
Run during a LIVE Kotak session (it prompts for a TOTP at login):
python "Dependencies/Kotak API/diagnose_kotak_symbol.py" [OPT] [STRIKE]
# e.g. python "Dependencies/Kotak API/diagnose_kotak_symbol.py" CE 23950
It downloads ... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/Kotak API/diagnose_kotak_symbol.py | .py | 92f45cd544e27e11 | 7.52 | 10 |
"""One-bar lifetime and price rebasing for ``NEXT_OPEN`` strategy signals.
Some strategies (Goldmine, Money Machine) generate a setup on a COMPLETED
candle but are only allowed to enter at the OPEN of the candle that follows.
This module holds the two rules that make that safe:
1. **Exactly one bar of life.** Candl... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/next_open_entry.py | .py | f7d92b62fbec3e35 | 7.52 | 10 |
"""Split an oversized options order into exchange-legal chunks.
NSE caps how much of a contract may be sent in ONE order -- the "freeze
quantity". An order at or above it is rejected by the exchange, and in this
runner a rejected live ENTRY with zero fill is deliberately treated as a paper
fallback, so an oversized o... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/order_splitting.py | .py | ca5383196786eb00 | 7.52 | 10 |
"""Fail-closed position sizing for strategies with rupee risk budgets.
The old strategy-specific helpers used ``ceil`` and always forced at least one
lot. Both behaviours can exceed the configured budget. ``SizingDecision``
is the single authority used by the master runner and the standalone SL
Hunting executor: inv... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/risk_sizing.py | .py | 506c0911b11ac3da | 7.52 | 10 |
"""Shared fail-safe redaction for broker, OAuth, and notifier diagnostics.
Broker replies, login errors, and Telegram failures are exactly the payloads
an operator most wants to see in a log -- and exactly the payloads most likely
to carry a session token, password, TOTP, or personal identifier. This module
gives eve... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/secret_redaction.py | .py | 50a48e74d2944ca6 | 7.52 | 10 |
"""Read-only startup audit for broker orders and index-option positions.
Live workers must not start until both broker books prove there is no exposure
that this process could collide with. This module deliberately performs only
two reads: it never adopts, cancels, recovers, or flattens broker state.
"""
from __futu... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/startup_exposure.py | .py | 2584a4bfa9180120 | 7.52 | 10 |
"""Pure tick-to-bar helpers for the websocket (Dhan marketfeed) data producer.
The multithreaded runner can source its market data from a Dhan websocket feed
instead of REST polling (``MARKET_DATA_SOURCE=WEBSOCKET``). In that mode a
"pump" thread receives raw marketfeed packets and a supervisor thread turns
them into... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/tick_bar_builder.py | .py | fadf348849e78714 | 7.52 | 10 |
"""Thread-safe state for a coordinated flatten-then-stop shutdown.
Stopping a worker thread is not the same as safely stopping a live trading
process. Once shutdown begins, new entries must stay blocked while the runner
closes every tracked leg and reconciles its own execution ledger to confirmed
flat. A failed clos... | DoRmAmMu1997/My-Algo-Trading-Code | Dependencies/trading_lifecycle.py | .py | f17b376779e9b9a8 | 7.52 | 10 |
"""
Backtest the Nifty EMA trend strategy using backtesting.py.
Flow:
1. Read 1-minute OHLC CSV.
2. Detect start/end date from the CSV itself.
3. Build EMA/ATR/ADX indicator columns using the shared EMA logic file.
4. Ask the shared signal engine for entry/exit decisions.
5. Restrict fresh entries to the allowed intra... | DoRmAmMu1997/My-Algo-Trading-Code | My Backtest Files (For Reference)/Nifty EMA Trend Strategy Backtest.py | .py | ab08678b406fc6f2 | 7.02 | 10 |
"""
Backtest Nifty Heikin Ashi + Bollinger strategy (mirrors front-test logic)
using backtesting.py.
Flow:
1. Read 1-minute OHLC CSV.
2. Detect start/end date from the CSV itself.
3. Restrict entries to intraday window (09:15 to before 15:15).
4. Force square-off any open position at/after 15:15 each day.
5. Enforce d... | DoRmAmMu1997/My-Algo-Trading-Code | My Backtest Files (For Reference)/Nifty Heiken Ashi Futures 5Y Backtest.py | .py | 9c8ddd96eef6b3be | 7.02 | 10 |
"""
Backtest a Nifty Renko strategy using backtesting.py.
Flow:
1. Read 1-minute OHLC CSV.
2. Detect start/end date from the CSV itself.
3. Build Renko candles + EMA indicators using shared logic file.
4. Ask shared signal engine for entry/exit decisions.
5. Restrict fresh entries to the allowed intraday window (09:15... | DoRmAmMu1997/My-Algo-Trading-Code | My Backtest Files (For Reference)/Nifty Renko Strategy Backtest.py | .py | 2571e4371ba35b30 | 7.02 | 10 |
"""
Backtest the NIFTY Goldmine strategy using backtesting.py.
Beginner flow:
1. Load an already-prepared 5-minute OHLC CSV.
2. Validate that the file really is 5-minute data. No resampling happens here.
3. Precompute Goldmine indicators and setup candles.
4. Submit market entries after a completed setup candle.
5. Sy... | DoRmAmMu1997/My-Algo-Trading-Code | My Backtest Files (For Reference)/Subhamoy Strategies/Nifty Goldmine Strategy Backtest.py | .py | 66e1caaebda09bc2 | 8.02 | 10 |
"""
Backtest the NIFTY Money Machine strategy using backtesting.py.
Beginner flow:
1. Load an already-prepared 5-minute OHLC CSV.
2. Validate that the file really is 5-minute data. No resampling happens here.
3. Precompute Money Machine indicators and setup candles.
4. Submit market entries after a completed Hulk/Maru... | DoRmAmMu1997/My-Algo-Trading-Code | My Backtest Files (For Reference)/Subhamoy Strategies/Nifty Money Machine Strategy Backtest.py | .py | c86de0936cea64bc | 8.02 | 10 |
"""
Shared backtest utilities for Subhamoy strategy backtests.
These helpers keep Goldmine and Money Machine backtests consistent:
- same 5-minute CSV validation
- same output file naming
- same brokerage-adjusted artifacts
- same risk/margin defaults
"""
from __future__ import annotations
import logging
import os
i... | DoRmAmMu1997/My-Algo-Trading-Code | My Backtest Files (For Reference)/Subhamoy Strategies/subhamoy_backtest_common.py | .py | ba498bb62757698b | 8.02 | 10 |
"""
Backtest the Profit Shooter strategy using backtesting.py.
High-level flow:
1. Read 1-minute OHLC CSV.
2. Build SMA / EMA / ATR and pin-bar columns using the shared strategy file.
3. Detect setup candles from the latest completed candle.
4. Place a one-bar stop-entry order so only the *next* candle can trigger ent... | DoRmAmMu1997/My-Algo-Trading-Code | My Backtest Files (For Reference)/profit_shooter_backtest.py | .py | ebc5bd0dc21ebf6a | 7.02 | 10 |
"""Prepare the deliberately narrow child process used for one Codex turn.
This parent-side adapter creates two layers of temporary isolation. A single
process-lifetime ``CODEX_HOME`` contains only a copy of subscription
``auth.json`` so SDK token refreshes survive between serialized turns. Each
turn then receives a ... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR AI Agent/cpr_ai_codex_runner.py | .py | 4e87c73abf058718 | 7.52 | 10 |
"""Execute one optional Codex SDK turn inside the temporary child boundary.
The parent gives this process a frozen public snapshot, not the trading
workspace, mutable market-data store, broker session, or credentials. The
child's only useful capability is a required MCP server with four no-argument
read tools. It ca... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR AI Agent/cpr_ai_codex_subprocess.py | .py | a8ec763aa07612b1 | 7.52 | 10 |
"""Append sanitized CPR Codex decisions as machine-readable JSONL audit rows.
Each line joins the exact frozen evidence, Codex proposal, host validation,
authoritative geometry, actual execution provenance, latency, token totals,
and MCP-call evidence for one decision. That makes later paper/live review
possible with... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR AI Agent/cpr_ai_decision_log.py | .py | 1154cbeb5dbce10f | 7.52 | 10 |
"""Serve one frozen CPR snapshot through four local, read-only MCP tools.
Model Context Protocol (MCP) is used only as a structured transport between
the isolated Codex process and facts already calculated by the trading host.
The server has no market-data, filesystem-write, broker, or order capability.
Each no-argume... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR AI Agent/cpr_ai_mcp_server.py | .py | 7411e65765446438 | 7.52 | 10 |
"""Assemble the versioned system prompt from small, auditable sections.
The prompt teaches Codex how to interpret host-calculated facts; it does not
grant execution authority. Keeping role, tool, judgment, and output rules in
separate constants makes future operator-approved knowledge easy to add
without burying safe... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR AI Agent/cpr_ai_prompt.py | .py | edc3230d8cfd0206 | 7.52 | 10 |
"""Order-free smoke runner for the isolated CPR Codex host boundary.
Fake mode proves the full host-policy path without an SDK. The optional
authenticated mode uses the normal isolated SDK/MCP boundary, but both modes
remain structurally unable to create an order because this module imports no
broker or execution sur... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR AI Agent/cpr_ai_runner.py | .py | cee2ce5329728466 | 7.52 | 10 |
"""Define the narrow data contract between Codex and the CPR host worker.
The model receives read-only market facts and returns only an advisory action,
regime, setup, confidence score, and explanation. It cannot choose an option
contract, quantity, entry price, stop, target, broker, venue, or order field;
the determ... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR AI Agent/cpr_ai_schema.py | .py | 4a1458b411bfaf16 | 7.52 | 10 |
"""Freeze one completed-bar context behind four read-only MCP tool payloads.
The host builds all market evidence before inference begins. This module then
serializes that evidence once and exposes four named views: session levels,
momentum/VWAP, market structure, and position state. Tool reads never fetch
new data o... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR AI Agent/cpr_ai_tools.py | .py | 67810ea2d2727fae | 7.52 | 10 |
"""
NIFTY CPR Algo 1 Signal Generator.
Algo 1 is the trending-market part of the CPR PDF:
- Condition 1: break out of the CPR neutral zone with EMA/VWAP/RSI support.
- Condition 2: after a 0.5% move or swing break, retrace to EMA20 and continue.
This wrapper keeps Algo 1 separate for front-tests/backtests that only w... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR Strategy/Nifty CPR Algo 1 Signal Generator.py | .py | e6e5d39e3e4d900f | 7.52 | 10 |
"""
NIFTY CPR Algo 2 Signal Generator.
Algo 2 is the sideways/reversal part of the CPR PDF:
- trade from support/resistance zones that have been touched at least twice
- trade RSI divergence reversals between confirmed swing points
The rules are intentionally coded as explicit defaults in `CPRStrategyConfig`
so the b... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR Strategy/Nifty CPR Algo 2 Signal Generator.py | .py | 7a0247de0820bdea | 7.52 | 10 |
"""
NIFTY CPR Combined Signal Generator.
Use this file when you want the full PDF strategy in one decision stream:
1. Algo 1 condition 1
2. Algo 1 condition 2
3. Algo 2 sideways zone trades
4. RSI divergence reversals
If opposite-direction setups appear on the same candle, the shared engine
returns HOLD with a confli... | DoRmAmMu1997/My-Algo-Trading-Code | Signal Generators/CPR Strategy/Nifty CPR Combined Signal Generator.py | .py | f96e0e7a9eef454d | 7.52 | 10 |
"""
Models Library widget with real-time searching and pricing DataTable.
"""
from __future__ import annotations
import contextlib
from typing import List
from textual.app import ComposeResult
from textual.containers import Vertical, Horizontal
from textual.widgets import Static, Input, DataTable, Label
from ..core ... | fariello/ocman | ocman_tui/widgets/models.py | .py | 3637d83efba7020d | 7.5 | 9 |
"""
Sidebar widget for projects and sessions navigation.
"""
from __future__ import annotations
from typing import Dict, Any, List, Optional
from pathlib import Path
from textual.widgets import Tree
from textual.widgets.tree import TreeNode
from rich.text import Text
from ..core import db_list_projects, db_list_sess... | fariello/ocman | ocman_tui/widgets/sidebar.py | .py | 75ef71b12826f2e6 | 7.5 | 9 |
#!/usr/bin/env python3
"""One-shot migration: normalize legacy ocman recovery filenames to the canonical scheme.
Newer ocman writes recovery artifacts as ``YYYYMMDD-HHMM-<session_id>.<kind>.md`` (local time),
where ``<kind>`` is one of transcript/restart/prompt/compacted. Older versions used
``opencode-YYYYMMDD-HHMMSS... | fariello/ocman | scripts/migrate_recovery_names.py | .py | c0143ffaf3467cbc | 7.5 | 9 |
"""Shared pytest fixtures for the ocman test suite."""
import os
import sys
from pathlib import Path
import pytest
import ocman
_IS_LINUX = sys.platform.startswith("linux")
_IS_WINDOWS = os.name == "nt"
# Drive letter used to anchor POSIX-looking test paths on Windows so that
# Path(...).is_absolute() is True (ocma... | fariello/ocman | tests/conftest.py | .py | 20d6d347dcdafa78 | 8 | 9 |
import os
import sqlite3
import pytest
import zipfile
import contextlib
from pathlib import Path
import ocman
from ocman import (
load_ocman_config,
save_ocman_config,
cli_create_config,
cli_backup,
cli_restore,
cli_clean_backups,
DEFAULT_CONFIG,
RecoveryError,
)
@pytest.fixture
def tem... | fariello/ocman | tests/test_config_backup_restore.py | .py | 583d979058133252 | 8 | 9 |
import os
import pytest
from pathlib import Path
from ocman_tui.core import (
expand_config_refs,
extract_models_from_config,
resolve_model,
consolidate_turns,
truncate_turns_by_interactions,
truncate_turns_by_lines,
Turn,
ModelInfo,
)
def test_expand_config_refs(tmp_path):
# Test f... | fariello/ocman | tests/test_core.py | .py | 6e88091280f8f5ff | 7 | 9 |
"""Tests for scripts/migrate_recovery_names.py (legacy filename normalization)."""
import importlib.util
import os
from pathlib import Path
import pytest
from conftest import make_symlink
_SCRIPT = Path(__file__).resolve().parent.parent / "scripts" / "migrate_recovery_names.py"
def _load_module():
spec = impo... | fariello/ocman | tests/test_migrate_recovery_names.py | .py | 695b6ee84d24606d | 8 | 9 |
import os
import shutil
import sqlite3
import pytest
from pathlib import Path
import ocman
from ocman import (
db_create_rollback_backup,
db_restore_rollback_backup,
move_directory_structure,
db_find_project,
db_find_session,
db_move_project_metadata,
db_move_session_metadata,
db_rebase_... | fariello/ocman | tests/test_move.py | .py | 1a34ae53c30fb036 | 7 | 9 |
#!/usr/bin/env python3
# Copyright 2026 Google LLC.
#
# 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... | datacommonsorg/datacommons | deploy/scripts/apply_version_bump.py | .py | b70f64464e27b8a2 | 7.45 | 7 |
#!/usr/bin/env python3
# Copyright 2026 Google LLC.
#
# 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... | datacommonsorg/datacommons | deploy/scripts/tag_release_artifacts.py | .py | b137cc284671d2c9 | 7.45 | 7 |
#!/usr/bin/env python3
# Copyright 2026 Google LLC.
#
# 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... | datacommonsorg/datacommons | deploy/scripts/validate_release_version.py | .py | 97d80bafe6d2b264 | 7.45 | 7 |
# Copyright 2026 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-admin/datacommons_admin/core/clients/ingestion_helper_client.py | .py | 2220f4e0fda764e6 | 7.45 | 7 |
# Copyright 2026 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-admin/datacommons_admin/core/clients/ingestion_job_client.py | .py | c8a827584c8cd335 | 7.45 | 7 |
# Copyright 2026 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-admin/datacommons_admin/core/utils/tf_utils.py | .py | 3b3aad7717c9a653 | 7.45 | 7 |
# Copyright 2026 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-admin/datacommons_admin/core/utils/ui_utils.py | .py | 0f742461a28183c6 | 7.45 | 7 |
# Copyright 2026 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-admin/datacommons_admin/db/db_cli.py | .py | 289684fb449cec34 | 7.45 | 7 |
# Copyright 2026 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-admin/datacommons_admin/db/utils/migration_utils.py | .py | bdae319b2dc9b712 | 7.45 | 7 |
# Copyright 2026 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-admin/datacommons_admin/ingest/ingest_cli.py | .py | fd4ce557d0438e1b | 7.45 | 7 |
# Copyright 2026 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-admin/datacommons_admin/init/utils/gcs_utils.py | .py | 5623f6c83fe41e94 | 7.45 | 7 |
# Copyright 2026 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-admin/datacommons_admin/init/utils/scaffold_utils.py | .py | 3d73089ae271ea52 | 7.45 | 7 |
# Copyright 2025 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-api/datacommons_api/api_cli.py | .py | 329ac044af0fd30e | 7.45 | 7 |
# Copyright 2025 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-api/datacommons_api/core/config.py | .py | b320e3deab562f79 | 7.45 | 7 |
# Copyright 2025 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-api/datacommons_api/core/logging.py | .py | 1749ed95e01f1db7 | 7.45 | 7 |
# Copyright 2025 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-api/datacommons_api/endpoints/routers/node_router.py | .py | 2c6a8ea95cf64de1 | 7.45 | 7 |
# Copyright 2025 Google LLC.
#
# 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, ... | datacommonsorg/datacommons | packages/datacommons-api/tests/services/test_graph_service.py | .py | f86c11b5240f6580 | 7.95 | 7 |
"""
SQLite database engine for Bengal Download Manager.
Handles high-performance WAL-mode persistence for download records, queues,
and full-text search indexing.
"""
import json
import logging
import os
import sqlite3
import threading
import time
from typing import Any, Dict, List, Optional
from . import utils
logg... | tazihad/bengal-download-manager | src/core/database.py | .py | 7d34ed198e5561fd | 7.6 | 15 |
import os
import shutil
import subprocess
import threading
import time
from typing import Optional
def _is_running_in_flatpak() -> bool:
"""Returns True if running inside a Flatpak container sandbox."""
return os.path.exists("/.flatpak-info")
def _send_portal_notification(title: str, message: str, icon_name: ... | tazihad/bengal-download-manager | src/core/notifications.py | .py | 7ad30320718a5ea2 | 7.6 | 15 |
"""
IPC & Single-Instance Services
==============================
Manages local TCP listener for browser extensions and QLocalServer
single-instance inter-process communication for Bengal Download Manager.
"""
import os
import sys
import json
import threading
import getpass
from http.server import HTTPServer, BaseHTTP... | tazihad/bengal-download-manager | src/core/services/ipc_service.py | .py | e48a5b678c5d3f4d | 7.6 | 15 |
import os
from urllib.parse import urlparse, unquote
import urllib.request
import urllib.error
import http.cookiejar
import ssl
from PyQt6.QtCore import QThread, pyqtSignal
from core.utils import load_extension_config, resolve_filename
class FileInfoFetcherWorker(QThread):
finished_signal = pyqtSignal(dict)
... | tazihad/bengal-download-manager | src/core/workers/fetcher.py | .py | 3b7b285c7fa6f002 | 7.6 | 15 |
"""
Unit and integration tests for SQLite Database persistence in Bengal Download Manager.
Tests table creation, WAL mode, CRUD operations, transactions, legacy JSON migration, and search.
"""
import json
import os
import sqlite3
import threading
import time
import pytest
from core.database import (
init_db,
... | tazihad/bengal-download-manager | tests/test_database.py | .py | 95703a2a089c09ad | 8.1 | 15 |
"""Retroactively import historical Claude sessions into the lemonaid archive.
Sessions created before lemonaid was installed (or before hooks were configured)
are invisible to lemonaid's history view. This module scans Claude's
sessions-index.json files and imports them as archived notifications.
"""
import json
impo... | petergaultney/lemonaid | src/lemonaid/claude/bootstrap.py | .py | 770eeec3ca91eafb | 7.52 | 10 |
"""CLI commands for Claude Code integration."""
import argparse
from .bootstrap import run_bootstrap
from .install_hooks import install_session_start, uninstall_session_start
from .notify import (
dismiss_session,
handle_dismiss,
handle_notification,
handle_session_start,
handle_submit,
)
from .pa... | petergaultney/lemonaid | src/lemonaid/claude/cli.py | .py | f9ee8d5371e91ea7 | 7.52 | 10 |
"""Add lemonaid's hooks to Claude Code's settings, without disturbing yours.
SessionStart is opt-in because it changes what the inbox contains: every session
registers itself at birth, so the inbox stops being "sessions that spoke to you"
and becomes "sessions that exist". That is the point - a session nobody has
talk... | petergaultney/lemonaid | src/lemonaid/claude/install_hooks.py | .py | 8676d85d8702b791 | 7.52 | 10 |
"""Claude Code notification hook handler.
This module handles notifications from Claude Code hooks, adding them to the
lemonaid inbox for attention tracking.
Usage in Claude Code settings.json:
{
"hooks": {
"Notification": [
{
"matcher": "idle_prompt",
"hooks": [
... | petergaultney/lemonaid | src/lemonaid/claude/notify.py | .py | 2a1f0f6717273b1b | 7.52 | 10 |
"""Patch Claude Code binary to reduce notification polling delay.
Claude Code has a hardcoded 6-second polling interval for notifications,
causing ~10 second delays before notification hooks fire. This module
patches the binary to reduce that to 500ms.
See: https://github.com/anthropics/claude-code/issues/5186
"""
i... | petergaultney/lemonaid | src/lemonaid/claude/patcher.py | .py | b133eba7df3ecc8a | 7.52 | 10 |
"""Claude Code project directory resolution.
Claude stores sessions under ~/.claude/projects/<encoded-path>/, where
the path is derived from the working directory at launch time. This module
handles the encoding, lookup, and history-based resolution.
"""
import json
from pathlib import Path
from ..log import get_log... | petergaultney/lemonaid | src/lemonaid/claude/projects.py | .py | ba342b79f564aef7 | 7.52 | 10 |
"""Claude Code session resumption with project directory resolution.
Claude's --resume only searches the project dir matching the current cwd.
This module looks up the correct project directory from ~/.claude/history.jsonl
so resume works from any directory.
"""
import os
import sys
from .projects import find_sessio... | petergaultney/lemonaid | src/lemonaid/claude/resume.py | .py | 1fad83b2f95d3b59 | 7.52 | 10 |
#!/usr/bin/env python3
"""Claude Code statusline command - displays contextual info in the terminal.
This is an optional addon that provides a colorful statusline showing:
- Current time with elapsed time since last message
- Working directory (basename)
- Git branch with dirty indicator (*)
- Context window usage per... | petergaultney/lemonaid | src/lemonaid/claude/statusline.py | .py | 82279bdc33527872 | 7.52 | 10 |
"""Claude Code session watcher backend.
Provides Claude-specific functions for the unified watcher:
- get_session_path: Find transcript files
- describe_activity: Describe what Claude is doing
- should_dismiss: Detect when to auto-dismiss notifications
"""
from pathlib import Path
from ..lemon_watchers import short_... | petergaultney/lemonaid | src/lemonaid/claude/watcher.py | .py | 395827d92c5cb5ec | 7.52 | 10 |
"""CLI entry point for lemonaid.
Lemonaid is a toolkit for working with lemons (LLMs). Current features:
- inbox: Attention management / notification inbox for tracking which lemons need you
"""
import argparse
import sys
from . import claude, codex, for_lemons, inbox, openclaw, opencode, places, tmux, wezterm
from ... | petergaultney/lemonaid | src/lemonaid/cli.py | .py | a8dfa238a865743b | 7.52 | 10 |
"""Codex session utilities."""
import json
import re
from pathlib import Path
def get_sessions_root() -> Path:
"""Return the Codex sessions root directory."""
return Path.home() / ".codex" / "sessions"
def extract_session_id_from_filename(name: str) -> str | None:
"""Extract a session UUID from a Codex... | petergaultney/lemonaid | src/lemonaid/codex/utils.py | .py | 6191f36e5ebe092c | 7.52 | 10 |
"""Configuration management for lemonaid."""
import tomllib
from dataclasses import dataclass, field
from fnmatch import fnmatch
from pathlib import Path
from typing import Any
def get_config_path() -> Path:
"""Get the path to the lemonaid config file."""
xdg_config = Path.home() / ".config"
return xdg_c... | petergaultney/lemonaid | src/lemonaid/config.py | .py | 0faf55fc4cfadf9c | 7.52 | 10 |
"""`lemonaid for-lemons`: print the guide for automated callers.
An agent reaches lemonaid through the CLI and has no reason to know where a
markdown file lives in a checkout it may not be sitting in. The same guide humans
read in `docs/` is installed alongside the package, so one command gets it
whatever the install ... | petergaultney/lemonaid | src/lemonaid/for_lemons.py | .py | 424d8dcb4ae9a01f | 7.52 | 10 |
"""Notification handlers for lemonaid."""
import json
import subprocess
from pathlib import Path
from typing import Any
from . import tmux, wezterm
from .config import Config, load_config
from .log import get_logger
_log = get_logger("handlers")
def check_pane_exists_by_tty(
tty: str, switch_source: str, socke... | petergaultney/lemonaid | src/lemonaid/handlers.py | .py | 6857b98ae20d93ad | 7.52 | 10 |
"""Channel ID construction for lemonaid notifications."""
class UnidentifiedSession(Exception):
"""Raised when a notification carries no session to attribute it to."""
def channel_id(backend: str, session_id: str | None) -> str:
"""Build a channel identifier from a backend name and session ID.
Returns ... | petergaultney/lemonaid | src/lemonaid/inbox/channel.py | .py | 14c39f3ca0daa6fb | 7.52 | 10 |
"""CLI commands for the inbox."""
import argparse
import json
import sys
from dataclasses import asdict
from datetime import datetime
from . import db
def _notification_to_json(n: db.Notification) -> dict:
"""Convert notification to JSON-serializable dict."""
return asdict(n)
def cmd_list(args: argparse.N... | petergaultney/lemonaid | src/lemonaid/inbox/cli.py | .py | d896a3751bdc68bc | 7.52 | 10 |
"""What lemonaid knows about your running sessions, and what it could restore.
Most of what restore depends on is invisible until you need it - a location
recorded weeks ago, a hook that either fired or didn't. This reports the state
of that before a crash rather than after, which is the only time it is useful
to find... | petergaultney/lemonaid | src/lemonaid/inbox/doctor.py | .py | 138dc2c8ef470eb0 | 7.52 | 10 |
"""Database migrations for lemonaid inbox.
Uses SQLite's PRAGMA user_version to track schema version.
Each migration module should have:
- VERSION: int - the version this migration brings us to
- DESCRIPTION: str - what this migration does
- migrate(conn) - function that performs the migration
"""
import importlib
im... | petergaultney/lemonaid | src/lemonaid/inbox/migrations/__init__.py | .py | 4a311d8729b779eb | 7.52 | 10 |
"""The inbox's table, which switches to a session on the first click."""
from textual import events
from textual.coordinate import Coordinate
from textual.widgets import DataTable
class ClickToActTable(DataTable):
"""A DataTable whose rows act on one click rather than two.
Since Textual 7.5.0 the base widge... | petergaultney/lemonaid | src/lemonaid/inbox/tui/table.py | .py | 06e15cda4507daa4 | 7.52 | 10 |
"""TUI utilities and helpers."""
import sys
from rich.text import Text
def set_terminal_title(title: str) -> None:
"""Set the terminal/pane title via OSC escape sequence."""
# OSC 0 sets both icon name and window title
sys.stdout.write(f"\033]0;{title}\007")
sys.stdout.flush()
# What each field is... | petergaultney/lemonaid | src/lemonaid/inbox/tui/utils.py | .py | cc3bedff6fcbd9cc | 7.52 | 10 |
"""Undo stack for inbox state changes.
Only mutations confined to the inbox are undoable: archive, mark-read, snooze,
rename. Actions with effects outside the database (switching to a session,
spawning a resume) are not, because reversing the row would not reverse what
already happened in the terminal.
An entry snaps... | petergaultney/lemonaid | src/lemonaid/inbox/undo.py | .py | 4052b3cceec83cb6 | 7.52 | 10 |
"""Shared utilities for LLM integrations."""
import os
import subprocess
import sys
from pathlib import Path
from ..log import get_logger
_log = get_logger("lemon_watchers.common")
_ANCESTOR_DEPTH = 10
_PROBE_TIMEOUT_SECONDS = 5
def get_tty() -> str | None:
"""Get the TTY name for this process or an ancestor ... | petergaultney/lemonaid | src/lemonaid/lemon_watchers/common.py | .py | 34c46db28de7dcda | 7.52 | 10 |
"""OpenClaw notification hook handler.
OpenClaw may not have explicit notification hooks like Claude Code, but
this module provides the handler infrastructure in case hooks are added
or for manual triggering.
"""
import json
import os
import sys
from pathlib import Path
from ..config import load_config
from ..inbox ... | petergaultney/lemonaid | src/lemonaid/openclaw/notify.py | .py | e32e4f0e867d8a81 | 7.52 | 10 |
"""SSH utilities for remote OpenClaw session discovery.
These functions are used at registration time to find and inspect
sessions on a remote host. They are NOT called in the hot polling
loop — the watcher uses _read_jsonl_tail_ssh in watcher.py instead.
"""
import json
import re
import shlex
import subprocess
from... | petergaultney/lemonaid | src/lemonaid/openclaw/ssh.py | .py | c4b4f925c58314ab | 7.52 | 10 |
"""OpenClaw session watcher backend.
Provides OpenClaw-specific functions for the unified watcher:
- get_session_path: Find session files (local or remote via DB lookup)
- read_lines: Read session lines (local or remote via SSH)
- describe_activity: Describe what OpenClaw is doing
- should_dismiss: Detect when to auto... | petergaultney/lemonaid | src/lemonaid/openclaw/watcher.py | .py | f71ef7c4f8b72018 | 7.52 | 10 |
"""CLI commands for OpenCode integration."""
import argparse
from .notify import _dismiss_session, handle_dismiss, handle_notification
def cmd_notify(args: argparse.Namespace) -> None:
"""Handle OpenCode notification hook."""
handle_notification(
stdin_data=args.payload,
session_id=args.sess... | petergaultney/lemonaid | src/lemonaid/opencode/cli.py | .py | ce8d5c97925db348 | 7.52 | 10 |
"""
diff_results.py — compares an actual results.csv against an expected one.
Usage:
python .github/scripts/diff_results.py <expected.csv> <actual.csv> <case_label>
Exit codes:
0 — results match
1 — results differ (failure)
2 — error
"""
import csv
import sys
from collections import Counter
from ... | cdisc-org/cdisc-open-rules | .github/scripts/diff_results.py | .py | 47ac9df5cb738acc | 7.42 | 6 |
#!/usr/bin/env python3
"""
sort_results.py — sorts every results.csv in the Published/, Unpublished/,
and Deprecated/ trees in-place.
Uses a numeric-aware sort key: integer fields are sorted numerically
(so record 2 < 10) and string fields are sorted lexicographically.
This mirrors the CORE engine's column-order sort ... | cdisc-org/cdisc-open-rules | scripts/sort_results.py | .py | c639d3d7dcb6bf4f | 7.42 | 6 |
"""Configuration loading for the extractor.
Layered configuration (later sources override earlier ones):
1. Built-in defaults (``DEFAULTS`` in this module).
2. Optional YAML config file. Search order, first match wins:
- Path passed via ``ConversationExtractorV2(config_path=...)`` /
``--config <path>`` CLI ar... | slyubarskiy/chatgpt-conversation-extractor | src/chatgpt_extractor/config.py | .py | 19ec9a50dd9e92fd | 7.65 | 19 |
"""GPT / Custom GPT / plugin metadata extraction from ChatGPT exports.
ChatGPT's export records three signals the offline extractor previously
dropped: the Custom GPT identity (`gizmo_id`, `gizmo_type`), the per-turn
model used (`metadata.model_slug` — often diverges from the conversation-
level `default_model_slug`),... | slyubarskiy/chatgpt-conversation-extractor | src/chatgpt_extractor/gpt_metadata.py | .py | 8e0c3552b1d6f87e | 7.65 | 19 |
"""
Production-ready logging configuration for ChatGPT Conversation Extractor.
This module provides structured logging with multiple handlers for different
severity levels, progress bar compatibility, and containerization support.
"""
import logging
import logging.handlers
import os
import sys
import json
import trac... | slyubarskiy/chatgpt-conversation-extractor | src/chatgpt_extractor/logging_config.py | .py | a8bac277d1268a9a | 7.65 | 19 |
"""
Tracking components for schema evolution and progress monitoring.
"""
import time
from dataclasses import dataclass, field
from typing import Dict, List, Set, Any
from collections import defaultdict
from datetime import datetime
try:
from tqdm import tqdm
TQDM_AVAILABLE = True
except ImportError:
TQD... | slyubarskiy/chatgpt-conversation-extractor | src/chatgpt_extractor/trackers.py | .py | 305840b69c6a0c27 | 7.65 | 19 |
#!/usr/bin/env python3
"""
Check performance metrics from extraction logs.
"""
import re
import sys
import argparse
from pathlib import Path
def parse_performance_log(log_file: str) -> dict:
"""Parse performance metrics from extraction log."""
if not Path(log_file).exists():
print(f"Log file not fou... | slyubarskiy/chatgpt-conversation-extractor | tests/check_performance.py | .py | c100b1004c84639d | 8.15 | 19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.