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
"""Session store — persists active session runs to JSON.""" import json import time import threading import logging from pathlib import Path log = logging.getLogger(__name__) class SessionStore: def __init__(self, path: str, templates_dir: str | None = None): self._path = Path(path) self._path.p...
mikey143-kun/agentchattr
session_store.py
.py
5cf8fe2b35283910
7.15
1
"""API agent wrapper — bridges the chat room to an OpenAI-compatible endpoint. Usage: python wrapper_api.py qwen python wrapper_api.py my-local-model For local models (Ollama, llama-server, LM Studio, etc.) that expose an OpenAI-compatible /v1/chat/completions endpoint but have no CLI to inject keystrokes int...
mikey143-kun/agentchattr
wrapper_api.py
.py
65c01c205da872a7
7.15
1
"""Mac/Linux agent injection — uses tmux send-keys to type into the agent CLI. Called by wrapper.py on Mac and Linux. Requires tmux to be installed. - Mac: brew install tmux - Linux: apt install tmux (or yum, pacman, etc.) How it works: 1. Creates a tmux session running the agent CLI 2. Queue watcher sends...
mikey143-kun/agentchattr
wrapper_unix.py
.py
a877c94a9c6009a8
7.15
1
import logging from langchain.agents import create_agent from langchain.agents.middleware import SummarizationMiddleware, TodoListMiddleware from langchain_core.runnables import RunnableConfig from src.agents.lead_agent.prompt import apply_prompt_template from src.agents.middlewares.clarification_middleware import Cl...
fullstack455/deer-flow
backend/src/agents/lead_agent/agent.py
.py
e00a2289994b6c1e
7.24
2
from datetime import datetime from src.config.agents_config import load_agent_soul from src.skills import load_skills def _build_subagent_section(max_concurrent: int) -> str: """Build the subagent system prompt section with dynamic concurrency limit. Args: max_concurrent: Maximum number of concurren...
fullstack455/deer-flow
backend/src/agents/lead_agent/prompt.py
.py
6fccfb52d35385e0
7.24
2
"""Prompt templates for memory update and injection.""" import re from typing import Any try: import tiktoken TIKTOKEN_AVAILABLE = True except ImportError: TIKTOKEN_AVAILABLE = False # Prompt template for updating memory based on conversation MEMORY_UPDATE_PROMPT = """You are a memory management system....
fullstack455/deer-flow
backend/src/agents/memory/prompt.py
.py
bacdbcdf9fd69ddd
7.24
2
"""Memory update queue with debounce mechanism.""" import threading import time from dataclasses import dataclass, field from datetime import datetime from typing import Any from src.config.memory_config import get_memory_config @dataclass class ConversationContext: """Context for a conversation to be processed...
fullstack455/deer-flow
backend/src/agents/memory/queue.py
.py
5ee15d33f42550c2
7.24
2
"""Memory updater for reading, writing, and updating memory data.""" import json import re import uuid from datetime import datetime from pathlib import Path from typing import Any from src.agents.memory.prompt import ( MEMORY_UPDATE_PROMPT, format_conversation_for_update, ) from src.config.memory_config impo...
fullstack455/deer-flow
backend/src/agents/memory/updater.py
.py
05e30affe2a3c306
7.24
2
"""Middleware for intercepting clarification requests and presenting them to the user.""" from collections.abc import Callable from typing import override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langchain_core.messages import ToolMessage from langgraph.grap...
fullstack455/deer-flow
backend/src/agents/middlewares/clarification_middleware.py
.py
9453b48230198227
7.24
2
"""Middleware to fix dangling tool calls in message history. A dangling tool call occurs when an AIMessage contains tool_calls but there are no corresponding ToolMessages in the history (e.g., due to user interruption or request cancellation). This causes LLM errors due to incomplete message format. This middleware i...
fullstack455/deer-flow
backend/src/agents/middlewares/dangling_tool_call_middleware.py
.py
9627e5c32a2301ef
7.24
2
"""Middleware for memory mechanism.""" import re from typing import Any, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langgraph.runtime import Runtime from src.agents.memory.queue import get_memory_queue from src.config.memory_config import get_memory_...
fullstack455/deer-flow
backend/src/agents/middlewares/memory_middleware.py
.py
3191a99e937ebbff
7.24
2
"""Middleware to enforce maximum concurrent subagent tool calls per model response.""" import logging from typing import override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langgraph.runtime import Runtime from src.subagents.executor import MAX_CONCURRENT_SUB...
fullstack455/deer-flow
backend/src/agents/middlewares/subagent_limit_middleware.py
.py
3cfa5b736f976677
7.24
2
from typing import NotRequired, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langgraph.runtime import Runtime from src.agents.thread_state import ThreadDataState from src.config.paths import Paths, get_paths class ThreadDataMiddlewareState(AgentState)...
fullstack455/deer-flow
backend/src/agents/middlewares/thread_data_middleware.py
.py
8e72a487de0c916f
7.24
2
"""Middleware for automatic thread title generation.""" from typing import NotRequired, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langgraph.runtime import Runtime from src.config.title_config import get_title_config from src.models import create_cha...
fullstack455/deer-flow
backend/src/agents/middlewares/title_middleware.py
.py
540ff232e245dd8d
7.24
2
"""Middleware to inject uploaded files information into agent context.""" import logging from pathlib import Path from typing import NotRequired, override from langchain.agents import AgentState from langchain.agents.middleware import AgentMiddleware from langchain_core.messages import HumanMessage from langgraph.run...
fullstack455/deer-flow
backend/src/agents/middlewares/uploads_middleware.py
.py
2c4e4b00ffcd3725
7.24
2
from typing import Annotated, NotRequired, TypedDict from langchain.agents import AgentState class SandboxState(TypedDict): sandbox_id: NotRequired[str | None] class ThreadDataState(TypedDict): workspace_path: NotRequired[str | None] uploads_path: NotRequired[str | None] outputs_path: NotRequired[s...
fullstack455/deer-flow
backend/src/agents/thread_state.py
.py
3beb2ffdeb991cd4
7.24
2
import base64 import logging from agent_sandbox import Sandbox as AioSandboxClient from src.sandbox.sandbox import Sandbox logger = logging.getLogger(__name__) class AioSandbox(Sandbox): """Sandbox implementation using the agent-infra/sandbox Docker container. This sandbox connects to a running AIO sandbo...
fullstack455/deer-flow
backend/src/community/aio_sandbox/aio_sandbox.py
.py
5207ba38d2add545
7.24
2
"""Abstract base class for sandbox provisioning backends.""" from __future__ import annotations import logging import time from abc import ABC, abstractmethod import requests from .sandbox_info import SandboxInfo logger = logging.getLogger(__name__) def wait_for_sandbox_ready(sandbox_url: str, timeout: int = 30)...
fullstack455/deer-flow
backend/src/community/aio_sandbox/backend.py
.py
54c668cbbc72d0a8
7.24
2
"""File-based sandbox state store. Uses JSON files for persistence and fcntl file locking for cross-process mutual exclusion. Works across processes on the same machine or across K8s pods with a shared PVC mount. """ from __future__ import annotations import fcntl import json import logging import os from collection...
fullstack455/deer-flow
backend/src/community/aio_sandbox/file_state_store.py
.py
4106d0bf0d79342d
7.24
2
"""Sandbox metadata for cross-process discovery and state persistence.""" from __future__ import annotations import time from dataclasses import dataclass, field @dataclass class SandboxInfo: """Persisted sandbox metadata that enables cross-process discovery. This dataclass holds all the information needed...
fullstack455/deer-flow
backend/src/community/aio_sandbox/sandbox_info.py
.py
f84309e64516e85b
7.24
2
import json from firecrawl import FirecrawlApp from langchain.tools import tool from src.config import get_app_config def _get_firecrawl_client() -> FirecrawlApp: config = get_app_config().get_tool_config("web_search") api_key = None if config is not None: api_key = config.model_extra.get("api_k...
fullstack455/deer-flow
backend/src/community/firecrawl/tools.py
.py
352edc3d69d6c67b
7.24
2
""" Image Search Tool - Search images using DuckDuckGo for reference in image generation. """ import json import logging from langchain.tools import tool from src.config import get_app_config logger = logging.getLogger(__name__) def _search_images( query: str, max_results: int = 5, region: str = "wt-w...
fullstack455/deer-flow
backend/src/community/image_search/tools.py
.py
7c1224cfac8aec22
7.24
2
from langchain.tools import tool from src.config import get_app_config from src.utils.readability import ReadabilityExtractor from .infoquest_client import InfoQuestClient readability_extractor = ReadabilityExtractor() def _get_infoquest_client() -> InfoQuestClient: search_config = get_app_config().get_tool_co...
fullstack455/deer-flow
backend/src/community/infoquest/tools.py
.py
1682cdd8c9da8b23
7.24
2
import json from langchain.tools import tool from tavily import TavilyClient from src.config import get_app_config def _get_tavily_client() -> TavilyClient: config = get_app_config().get_tool_config("web_search") api_key = None if config is not None and "api_key" in config.model_extra: api_key =...
fullstack455/deer-flow
backend/src/community/tavily/tools.py
.py
210df4450e46a7e9
7.24
2
# !/usr/bin/python # coding=utf-8 """Creates in-between (tween) target meshes for sculpting a custom morph curve — mirror of mayatk's ``anim_utils.blendshape_animator.creator.Creator``. A tween is a plain, history-free duplicate mesh object frozen at the base+target mix for a given weight (or frame) — the Blender anal...
m3trik/blendertk
blendertk/anim_utils/blendshape_animator/creator.py
.py
0628fcaf8ae46b2b
7
0
# !/usr/bin/python # coding=utf-8 """Master shape-key value keyframe animation — mirror of mayatk's ``anim_utils.blendshape_animator.keyframes.Keyframes``. Maya keyframes the ``blendShape.weight[0]`` attribute; the direct Blender analogue is the master shape key's own ``value`` — already a first-class keyable float (n...
m3trik/blendertk
blendertk/anim_utils/blendshape_animator/keyframes.py
.py
0143fc9ea01ab55f
7
0
# !/usr/bin/python # coding=utf-8 """Tween mesh wrappers and registry — mirror of mayatk's ``anim_utils.blendshape_animator.target`` (``Target`` / ``Targets``). Divergence from mayatk (by design): Maya tags a tween mesh with plain node attributes (``addAttr``/``setAttr``); Blender custom properties (``obj["key"] = val...
m3trik/blendertk
blendertk/anim_utils/blendshape_animator/target.py
.py
b271753a10f15d94
7
0
# !/usr/bin/python # coding=utf-8 """Mesh + shape-key setup validation — mirror of mayatk's ``anim_utils.blendshape_animator.validator.Validator``. """ import pythontk as ptk class Validator(ptk.LoggingMixin): """Handles validation of meshes and shape-key setups.""" @classmethod def validate_meshes(cls,...
m3trik/blendertk
blendertk/anim_utils/blendshape_animator/validator.py
.py
d5a782885275789c
7
0
# !/usr/bin/python # coding=utf-8 """Dedicated scale-keys module to keep AnimUtils lean and testable (mirror of mayatk's ``anim_utils.scale_keys`` / ``ScaleKeys``). Mirrors mayatk's ``scale_keys`` at the *name + behavior* level (uniform vs. speed-normalized retiming, single/per-object/overlap-group pivots, absolute vs...
m3trik/blendertk
blendertk/anim_utils/scale_keys.py
.py
2aa09da94eb25116
7
0
# !/usr/bin/python # coding=utf-8 """Shot-region detection — Blender scene acquisition over the pure engine math. Mirror of mayatk's ``anim_utils.shots._detection`` (name + behavior, not signatures): the Blender-side acquisition (discovering animated objects, resolving an fcurve owner to its object, gathering selected...
m3trik/blendertk
blendertk/anim_utils/shots/_detection.py
.py
ecc55d74cbd0e8fa
7
0
# !/usr/bin/python # coding=utf-8 """Constants, column layout, and pure helper functions for the Shot Manifest UI. Blender mirror of mayatk's ``shot_manifest.manifest_data``. Everything here is pure Qt/data with two DCC swaps versus the Maya original: - the status palette is imported from the shared ``pythontk`` eng...
m3trik/blendertk
blendertk/anim_utils/shots/shot_manifest/manifest_data.py
.py
1715e26abd6f6355
7
0
# !/usr/bin/python # coding=utf-8 """Range resolution for the Shot Manifest build pipeline (Blender-bound facade). Mirror of mayatk's ``shot_manifest.range_resolver``. The resolver math lives once, DCC-agnostic, in :mod:`pythontk.core_utils.engines.shots.manifest.range_resolver` (shared with mayatk). This facade bin...
m3trik/blendertk
blendertk/anim_utils/shots/shot_manifest/range_resolver.py
.py
3064c2ed4df6967b
7
0
# !/usr/bin/python # coding=utf-8 """Marker persistence for the shot sequencer controller (Blender). Verbatim mirror of mayatk's ``shot_sequencer.marker_manager`` — the mixin is fully DCC-agnostic (it only reads the shared ``SequencerWidget``'s markers and writes them to the ``ShotSequencer`` model), so no Maya→Blende...
m3trik/blendertk
blendertk/anim_utils/shots/shot_sequencer/marker_manager.py
.py
772ec66283c17445
7
0
# !/usr/bin/python # coding=utf-8 """Segment collection and attribute extraction for the shot sequencer (Blender). Blender mirror of mayatk's ``shot_sequencer.segment_collector`` — pure functions the controller calls directly. ``collect_segments`` / ``active_object_set`` are 1:1 (they delegate to the engine's ``colle...
m3trik/blendertk
blendertk/anim_utils/shots/shot_sequencer/segment_collector.py
.py
7d4f88a45045024f
7
0
# !/usr/bin/python # coding=utf-8 """Shot navigation and combobox synchronization (Blender). Blender mirror of mayatk's ``shot_sequencer.shot_nav`` — :class:`ShotNavMixin` handles shot selection, navigation, and combobox population. Two DCC swaps vs. the Maya original: object selection (``cmds.ls``/``cmds.select`` → ...
m3trik/blendertk
blendertk/anim_utils/shots/shot_sequencer/shot_nav.py
.py
4ff5cf1d76fcbf5a
7
0
# !/usr/bin/python # coding=utf-8 """Dedicated stagger-keys module to keep AnimUtils lean and testable (mirror of mayatk's ``anim_utils.stagger_keys`` / ``StaggerKeys``). The shared fcurve helpers live in ``_anim_utils``; they are imported lazily inside the call body to avoid an import cycle (``_anim_utils`` re-import...
m3trik/blendertk
blendertk/anim_utils/stagger_keys.py
.py
0c71b5736ec65dcf
7
0
# !/usr/bin/python # coding=utf-8 """Consumer-facing audio-segment discovery for the sequencer + manifest (Blender). Mirror of mayatk's ``audio_utils.segments`` — the same :class:`AudioSegment` snapshot the shared sequencer widget renders as an audio track, derived here from the scene's VSE **sound strips** instead of...
m3trik/blendertk
blendertk/audio_utils/segments.py
.py
2e68f1a345dd906b
7
0
""" TradeMemory Hosted API Server (MVP). Multi-tenant FastAPI server with API key authentication and SQLite storage. Implements core endpoints from docs/hosted-api-spec.md: - POST /api/v1/trades (store_trade) - GET /api/v1/trades (recall_trades) - GET /api/v1/performance (get_performance) - GET ...
Eltano1985/tradememory-protocol
hosted/server.py
.py
05e877c619d9df56
7
0
""" Daily Trading Monitor — Option C (AI-Assisted) Reads tradememory DB + MT5 open positions to detect anomalies. Generates a daily status report with actionable alerts. Usage: python scripts/daily_monitor.py [--output reports/] Output: JSON report + human-readable summary """ import os import sys import json i...
Eltano1985/tradememory-protocol
scripts/daily_monitor.py
.py
fc4aaac2311026c7
7
0
#!/usr/bin/env python3 """ Generate demo output for documentation screenshots. Runs the L1 → L2 → L3 pipeline with simulated trades and saves formatted output to assets/screenshots/ for use in README and docs. Usage: python scripts/generate_screenshots.py """ import sys import os import io import tempfile from p...
Eltano1985/tradememory-protocol
scripts/generate_screenshots.py
.py
c351c2ab38402b29
7
0
""" One-time migration: Fix strategy names in tradememory.db using MT5 magic numbers. Existing trades were all stored as strategy="NG_Gold". This script: 1. Queries MT5 for historical deals to get magic numbers 2. Maps magic → strategy name 3. Updates trade_records in tradememory.db Usage: python scripts/migrate_...
Eltano1985/tradememory-protocol
scripts/migrate_strategy_names.py
.py
5933c416f383be99
7
0
""" Parse all batch backtest reports and generate structured analysis. Usage: python scripts/parse_batch_results.py [report_dir] Default report_dir: batch_v1 in MT5 Terminal B reports directory """ import sys import os import json # Add project root to path sys.path.insert(0, os.path.dirname(os.path.dirname(os.p...
Eltano1985/tradememory-protocol
scripts/parse_batch_results.py
.py
cf9b9c6b7b60cc21
7
0
""" Trade Adapter - Convert MT5 deals to TradeMemory TradeRecord format Based on ariadng/metatrader-mcp-server + TradeMemory Protocol DEC-014 Architecture: MT5 Terminal → MetaTrader5 Python API → trade_adapter.py → TradeJournal """ import os import time try: import MetaTrader5 as MT5 except ImportError: MT5...
Eltano1985/tradememory-protocol
scripts/trade_adapter.py
.py
88087eb175dcffb8
7
0
""" Validate auto-discovered L2 patterns against manually curated findings. Compares patterns in the patterns table (source='backtest_auto') against the 5 manual L2 findings from MEMORY.md: MR-001, MR-002, FX-001, FX-002, BATCH-001. Usage: python scripts/validate_l2_patterns.py [db_path] Default db_path: data/ba...
Eltano1985/tradememory-protocol
scripts/validate_l2_patterns.py
.py
e551e3a60d17f599
7
0
""" Weekly Trading Report — Option C (AI-Assisted) Generates a comprehensive weekly performance report comparing real trades vs BATCH-001 backtest baselines. Usage: python scripts/weekly_report.py [--output reports/] """ import os import sys import json import sqlite3 import argparse from datetime import datetim...
Eltano1985/tradememory-protocol
scripts/weekly_report.py
.py
1222c0e4a417db46
7
0
""" Backtest Importer - Parse MT5 Strategy Tester HTML reports and import as TradeRecords. Reads UTF-16LE HTML reports from MT5 Strategy Tester, pairs entry/exit deals, and bulk-imports them into tradememory SQLite database. All imported trades have source="backtest" in their reasoning field. """ import os import re...
Eltano1985/tradememory-protocol
src/tradememory/backtest_importer.py
.py
a1a060d2b44e66bc
7.5
0
""" TradeJournal module - Structured trade memory with full context. Implements Blueprint Section 2.1 TradeJournal functionality. """ from datetime import datetime, timezone from typing import Optional, List, Dict, Any from .models import TradeRecord, TradeDirection, MarketContext from .db import Database class Trad...
Eltano1985/tradememory-protocol
src/tradememory/journal.py
.py
0fc0181fa9188303
7
0
""" Data models for TradeMemory Protocol. Based on Blueprint Section 5: Trade Journal Data Schema """ from datetime import datetime from typing import Optional, List, Dict, Any from pydantic import BaseModel, ConfigDict, Field from enum import Enum class TradeDirection(str, Enum): """Trade direction""" LONG ...
Eltano1985/tradememory-protocol
src/tradememory/models.py
.py
36fe7cbdb4f07cb0
7
0
""" MT5 Connector - Bridge between MT5 demo account and TradeMemory. Records real demo trades into TradeJournal automatically. """ from typing import Optional, List, Dict, Any from datetime import datetime from .journal import TradeJournal from .state import StateManager class MT5Connector: """ Connects to ...
Eltano1985/tradememory-protocol
src/tradememory/mt5_connector.py
.py
83513eb0f468adcb
7
0
"""ContextVector and context_similarity for OWM framework. Reference: docs/OWM_FRAMEWORK.md Section 2.6 """ from __future__ import annotations import math from dataclasses import dataclass from typing import Optional @dataclass class ContextVector: """Market context at a point in time.""" # Price symb...
Eltano1985/tradememory-protocol
src/tradememory/owm/context.py
.py
64e009a6ffb5215a
7
0
"""Migration utilities from L1/L2 tables to OWM memory tables.""" import json from datetime import datetime def migrate_trades_to_episodic(db) -> int: """ Migrate all trade_records to episodic_memory. Mapping: - trade id → episodic id - market_context JSON → context_json - Tries to parse reg...
Eltano1985/tradememory-protocol
src/tradememory/owm/migration.py
.py
9a517307c6666656
7
0
""" Unit tests for TradeJournal module. """ import pytest import tempfile from pathlib import Path from src.tradememory.journal import TradeJournal from src.tradememory.db import Database @pytest.fixture def temp_db(): """Create a temporary database for testing""" with tempfile.TemporaryDirectory() as tmpdi...
Eltano1985/tradememory-protocol
tests/test_journal.py
.py
22f74dec5ccddf32
7.5
0
""" Unit tests for data models. """ import pytest from datetime import datetime, timezone from src.tradememory.models import ( TradeRecord, MarketContext, SessionState, TradeDirection ) def test_market_context_creation(): """Test MarketContext model""" ctx = MarketContext( price=2891....
Eltano1985/tradememory-protocol
tests/test_models.py
.py
ea1d55a29477b2cc
7.5
0
"""Tests for MT5Connector with mocked MetaTrader5 library.""" import pytest from unittest.mock import MagicMock, patch from datetime import datetime from src.tradememory.db import Database from src.tradememory.journal import TradeJournal from src.tradememory.state import StateManager from src.tradememory.mt5_connecto...
Eltano1985/tradememory-protocol
tests/test_mt5_connector.py
.py
6f1cd257f9db2524
7.5
0
"""Tests for ContextVector and context_similarity.""" import math import pytest from src.tradememory.owm.context import ContextVector, context_similarity def _make_context(**overrides): """Helper to build a fully-populated ContextVector.""" defaults = dict( symbol="XAUUSD", price=5175.0, ...
Eltano1985/tradememory-protocol
tests/test_owm_context.py
.py
ae3d313a3cbf4c4d
7.5
0
"""Tests for OWM Kelly criterion position sizing.""" import pytest from src.tradememory.owm.kelly import kelly_from_memory from src.tradememory.owm.recall import ScoredMemory def _make_memory(pnl_r: float, score: float = 1.0) -> ScoredMemory: """Helper to create a ScoredMemory with given pnl_r and score.""" ...
Eltano1985/tradememory-protocol
tests/test_owm_kelly.py
.py
8cd1d028c8565a5f
7.5
0
"""IMAP client — handles connection, folder operations, and email fetching. Wraps Python's imaplib to provide a higher-level interface for the operations CLI Mail needs: listing folders, fetching headers/emails, searching, and manipulating flags. All UID-based operations use the IMAP UID command to avoid issues with s...
notkorya/CLI-Mail
src/cli_mail/client.py
.py
561f90e371c5066d
7.15
1
"""Read and display a single email.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING from cli_mail import ui if TYPE_CHECKING: from cli_mail.app import App def cmd_read(app: App, args: list[str]) -> None: if app.imap is None: ui.print_error("Not conne...
notkorya/CLI-Mail
src/cli_mail/commands/read.py
.py
6fa95fca61336be8
7.15
1
"""Configuration management — reads/writes ~/.config/cli-mail/config.toml.""" from __future__ import annotations import tomllib from pathlib import Path from cli_mail.models import AccountConfig CONFIG_DIR = Path.home() / ".config" / "cli-mail" CONFIG_FILE = CONFIG_DIR / "config.toml" def _escape_toml(value: str)...
notkorya/CLI-Mail
src/cli_mail/config.py
.py
7d3ebcd8aaf8671a
7.15
1
"""Data models for CLI Mail. Defines the core data structures used across the application: email addresses, attachments, full and lightweight email representations, folders, account configuration, and mutable session state. """ from __future__ import annotations from dataclasses import dataclass, field from datetime...
notkorya/CLI-Mail
src/cli_mail/models.py
.py
7c432023e22bc5e0
7.15
1
"""Parse raw MIME email messages into our Email model.""" from __future__ import annotations import email import email.policy from datetime import datetime, timezone from email.message import EmailMessage from email.utils import parsedate_to_datetime import html2text from cli_mail.models import Address, Attachment,...
notkorya/CLI-Mail
src/cli_mail/parser.py
.py
572f73cbf2123a78
7.15
1
"""SMTP client — handles sending, replying to, and forwarding emails.""" from __future__ import annotations import smtplib from email.message import EmailMessage from email.utils import formataddr, formatdate from cli_mail.models import AccountConfig, Email class SMTPSender: def __init__(self, account: Account...
notkorya/CLI-Mail
src/cli_mail/sender.py
.py
acf298172e49b0a6
7.15
1
""" OpenReel Video Parser for WAS Content Viewer. Handles: - INPUT: Tagged JSON from CV_OpenReelBundleVideo node - Passes through video metadata and serve URLs for the frontend view - OUTPUT: Video file path from OpenReel's "Send to Output" action """ import json import hashlib try: from .base_parser import Base...
kenleung05hk/ComfyUI_Viewer_OpenReel_Extension
modules/parsers/openreel_video_parser.py
.py
f3e8bac1e5f686b4
7.24
2
# !/usr/bin/python # coding=utf-8 """Applies tween mesh edits back to blendShape in-between targets.""" from enum import Enum from typing import List, Optional, Tuple import pythontk as ptk try: from maya import cmds except ImportError as error: print(__file__, error) from mayatk.anim_utils.blendshape_animat...
m3trik/mayatk
mayatk/anim_utils/blendshape_animator/applicator.py
.py
db5b412003a2d2c9
7.3
3
# !/usr/bin/python # coding=utf-8 """Shared helpers internal to the blendshape_animator subpackage.""" from typing import List, Optional try: from maya import cmds except ImportError as error: print(__file__, error) class BlendshapeHelpers: """BlendshapeHelpers — module namespace.""" @staticmethod ...
m3trik/mayatk
mayatk/anim_utils/blendshape_animator/helpers.py
.py
28a5ea4594e654a5
7.3
3
# !/usr/bin/python # coding=utf-8 """Core blendShape keyframe animation operations.""" from typing import Tuple import pythontk as ptk try: from maya import cmds except ImportError as error: print(__file__, error) from mayatk.anim_utils.blendshape_animator.validator import Validator class Keyframes(ptk.Log...
m3trik/mayatk
mayatk/anim_utils/blendshape_animator/keyframes.py
.py
df6e9bb761dbe733
7.3
3
# !/usr/bin/python # coding=utf-8 """Recovery utilities for corrupted blendShape setups.""" import pythontk as ptk try: from maya import cmds except ImportError as error: print(__file__, error) from mayatk.core_utils._core_utils import CoreUtils from mayatk.anim_utils.blendshape_animator.applicator import Ap...
m3trik/mayatk
mayatk/anim_utils/blendshape_animator/recovery.py
.py
713654a63c598900
7.3
3
# !/usr/bin/python # coding=utf-8 """Tween mesh wrappers and registry for blendShape in-between targets.""" from typing import Dict, List, Optional import pythontk as ptk try: from maya import cmds except ImportError as error: print(__file__, error) from mayatk.core_utils._core_utils import CoreUtils from m...
m3trik/mayatk
mayatk/anim_utils/blendshape_animator/target.py
.py
ca85f46dff9ef3c5
7.3
3
# !/usr/bin/python # coding=utf-8 """Mesh and blendShape validation for blendShape animation setup.""" import pythontk as ptk try: from maya import cmds except ImportError as error: print(__file__, error) from mayatk.node_utils._node_utils import NodeUtils class Validator(ptk.LoggingMixin): """Handles v...
m3trik/mayatk
mayatk/anim_utils/blendshape_animator/validator.py
.py
12593b52b96e6098
7.3
3
# coding=utf-8 """Commit resolved :class:`MovePlan`\\ s to the Maya scene. The three-phase walk (park / ordered / land, +INF envelope capping) lives once in :func:`pythontk.core_utils.engines.shots.shot_apply.apply`; this module supplies the Maya *writer strategies* — the keyframe shifter (:func:`_batch_move_keys`) an...
m3trik/mayatk
mayatk/anim_utils/shots/_shot_apply.py
.py
e5216d1f7316f34c
7.3
3
# !/usr/bin/python # coding=utf-8 """Constants, column layout, and pure helper functions for the Shot Manifest UI.""" from pythontk.core_utils.engines.shots.manifest.range_resolver import ( # noqa: F401 RangeResolver as _PyRangeResolver, ) # canonical home is the engine class; re-exported under the historical na...
m3trik/mayatk
mayatk/anim_utils/shots/shot_manifest/manifest_data.py
.py
34f1afa125460af0
7.3
3
# !/usr/bin/python # coding=utf-8 """Range resolution for the Shot Manifest build pipeline (Maya-bound facade). The resolver math lives once, DCC-agnostic, in :mod:`pythontk.core_utils.engines.shots.manifest.range_resolver` (shared with blendertk). This facade binds its injectable ``duration_fn`` to mayatk's :func:`~...
m3trik/mayatk
mayatk/anim_utils/shots/shot_manifest/range_resolver.py
.py
da0d00b74a978705
7.3
3
# !/usr/bin/python # coding=utf-8 """Marker persistence for the shot sequencer controller. Provides :class:`MarkerManagerMixin` — mixed into :class:`~.shot_sequencer_slots.ShotSequencerController` to persist marker add/move/change/remove events to the underlying :class:`ShotSequencer` model. """ from __future__ impor...
m3trik/mayatk
mayatk/anim_utils/shots/shot_sequencer/marker_manager.py
.py
e28a5c8fa2a9bd7d
7.3
3
# !/usr/bin/python # coding=utf-8 """Shot navigation and combobox synchronization. Provides :class:`ShotNavMixin` — mixed into :class:`~.shot_sequencer_slots.ShotSequencerController` to handle shot selection, navigation, and combobox population. """ from __future__ import annotations try: import maya.cmds as cmds...
m3trik/mayatk
mayatk/anim_utils/shots/shot_sequencer/shot_nav.py
.py
9374e7640528843d
7.3
3
# coding=utf-8 """Dedicated stagger-keys module to keep AnimUtils lean and testable.""" from typing import Any, Dict, List, Optional, Tuple, Union try: import maya.cmds as cmds except ImportError as error: # pragma: no cover - Maya environment required cmds = None print(__file__, error) import pythontk a...
m3trik/mayatk
mayatk/anim_utils/stagger_keys.py
.py
d4d6211d1f59dff0
7.3
3
"""Safe math expression evaluator with date/time support.""" import ast import operator # todo: edge case import math from datetime import datetime, timedelta from typing import Any SAFE_OPS = { ast.Add: operator.add, ast.Sub: operator.sub, ast.Mult: operator.mul, ast.Div: operator.truediv, ast.Flo...
BreadStisx/claudemcp
claudemcp/calculator_plugin.py
.py
410fa6134dc26938
7.15
1
"""Plugin configuration.""" from pathlib import Path import json from typing import Any # fixme: handle errors DEFAULT_NOTES_DIR = Path.home() / "claude-notes" DEFAULT_CONFIG_PATH = Path.home() / ".claudemcp.json" def load_config() -> dict[str, Any]: if DEFAULT_CONFIG_PATH.exists(): return json.loads(DEF...
BreadStisx/claudemcp
claudemcp/config.py
.py
2617093a092897a4
7.15
1
"""Install plugins into Claude Desktop config.""" import json import sys from pathlib import Path CLAUDE_CONFIG_PATHS = [ Path.home() / "Library" / "Application Support" / "Claude" / "claude_desktop_config.json", Path.home() / ".config" / "claude" / "claude_desktop_config.json", Path.home() / "AppData" / "...
BreadStisx/claudemcp
claudemcp/installer.py
.py
1f7e79c277b0249a
7.15
1
"""Markdown notes plugin. Read/write/list/search notes.""" from pathlib import Path from datetime import datetime from claudemcp.config import get_notes_dir def list_notes() -> list[dict]: notes_dir = get_notes_dir() notes = [] for f in sorted(notes_dir.glob("*.md")): stat = f.stat() notes...
BreadStisx/claudemcp
claudemcp/notes_plugin.py
.py
ca6217282dd4d126
7.15
1
"""Simple web search plugin using DuckDuckGo HTML.""" import requests from urllib.parse import quote_plus from html.parser import HTMLParser class _ResultParser(HTMLParser): def __init__(self): super().__init__() self.results = [] self._in_result = False self._current = {} ...
BreadStisx/claudemcp
claudemcp/websearch_plugin.py
.py
b9d93e8d9bcb4ff0
7.15
1
""" Application configuration """ from pydantic_settings import BaseSettings from typing import List import os class Settings(BaseSettings): """Application settings""" # Application APP_NAME: str = "Cloud Resource Optimizer" VERSION: str = "1.0.0" DEBUG: bool = True # API API_V1_...
Drempty/AI-Enabled-Cloud-Resource-Optimizer
backend/app/core/config.py
.py
1a12c5a96857f5d5
7
0
""" SQLAlchemy database models """ from sqlalchemy import Column, Integer, String, Float, DateTime, Boolean, ForeignKey, JSON, Enum from sqlalchemy.orm import relationship from datetime import datetime import enum from app.core.database import Base class CloudProvider(str, enum.Enum): """Cloud provider enumerati...
Drempty/AI-Enabled-Cloud-Resource-Optimizer
backend/app/models/database.py
.py
4b46bcfc5c39ff20
7
0
""" Predictions API router """ from fastapi import APIRouter, Depends, HTTPException, Request from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy import select, and_ from datetime import datetime, timedelta from typing import List from app.core.database import get_db from app.models.database import Resourc...
Drempty/AI-Enabled-Cloud-Resource-Optimizer
backend/app/routers/predictions.py
.py
8002e136d8a35be4
7
0
""" Pydantic schemas for API request/response validation """ from pydantic import BaseModel, Field, ConfigDict from typing import Optional, List, Dict, Any from datetime import datetime from enum import Enum class CloudProvider(str, Enum): """Cloud provider enumeration""" AWS = "aws" AZURE = "azure" G...
Drempty/AI-Enabled-Cloud-Resource-Optimizer
backend/app/schemas/api.py
.py
855ff155a9a4417a
7
0
""" Machine Learning service for predictions and optimization """ import numpy as np import pandas as pd from datetime import datetime, timedelta from typing import List, Dict, Tuple, Optional import joblib import os # TensorFlow is optional - statistical methods work fine for most use cases # Uncomment the following ...
Drempty/AI-Enabled-Cloud-Resource-Optimizer
backend/app/services/ml_service.py
.py
4668088493652658
7
0
""" Optimization service for cost and performance recommendations """ from typing import List, Dict, Optional, Tuple from datetime import datetime import numpy as np # Instance type pricing and specifications (AWS example) INSTANCE_CATALOG = { 'aws': { 't3.nano': {'vcpus': 2, 'memory': 0.5, 'cost_hour': 0...
Drempty/AI-Enabled-Cloud-Resource-Optimizer
backend/app/services/optimization_service.py
.py
35293ccf56cd6a41
7
0
""" Data generator for creating sample metrics and resources """ import numpy as np from datetime import datetime, timedelta from typing import List, Dict import asyncio from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy import select from app.models.database import Resource, Metric, CloudProvider, Resour...
Drempty/AI-Enabled-Cloud-Resource-Optimizer
backend/app/utils/data_generator.py
.py
1b3ee4ed4a5b0e30
7
0
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. import logging import os import secrets import subprocess from contextlib import suppress from pathlib import Path from typing import Callable, Generator, Optional, Tuple import jubilant import psycopg import pytest import yaml from integration...
canonical/glauth-k8s-operator
tests/integration/conftest.py
.py
63136431a45fbe3e
7.5
0
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. import platform from contextlib import contextmanager from typing import Callable, Iterator, Optional import jubilant import ldap import yaml from cryptography import x509 from cryptography.hazmat.backends import default_backend from integratio...
canonical/glauth-k8s-operator
tests/integration/utils.py
.py
90b0230392a347ea
7.5
0
""" JSON file I/O utilities. Provides read_json and write_json as the single source of truth for JSON file operations across all Trellis scripts. """ from __future__ import annotations import json from pathlib import Path def read_json(path: Path) -> dict | None: """Read and parse a JSON file. Returns Non...
gdm257/scoop-257
.trellis/scripts/common/io.py
.py
6480b181f2bc5053
7.24
2
""" Terminal output utilities: colors and structured logging. Single source of truth for Colors and log_* functions used across all Trellis scripts. """ from __future__ import annotations class Colors: """ANSI color codes for terminal output.""" RED = "\033[0;31m" GREEN = "\033[0;32m" YELLOW = "\03...
gdm257/scoop-257
.trellis/scripts/common/log.py
.py
471df6895cfac80f
7.24
2
""" Task data access layer. Single source of truth for loading and iterating task directories. Replaces scattered task.json parsing across 9+ files. Provides: load_task — Load a single task by directory path iter_active_tasks — Iterate all non-archived tasks (sorted) get_all_statuses — Get {di...
gdm257/scoop-257
.trellis/scripts/common/tasks.py
.py
4436a8b0b53c270a
7.24
2
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Workflow Phase Extraction. Extracts step-level content from .trellis/workflow.md and optionally filters platform-specific blocks. Platform marker syntax in workflow.md: [Claude Code, Cursor, ...] agent-capable content [/Claude Code, Cursor, ...] Provide...
gdm257/scoop-257
.trellis/scripts/common/workflow_phase.py
.py
b5736dab0587d78c
7.24
2
"""Configuration management for Coinbase Advanced Trader.""" import logging from pathlib import Path import yaml from coinbase_advanced_trader.constants import DEFAULT_CONFIG class ConfigManager: """Singleton class for managing application configuration.""" _instance = None def __new__(cls): ...
rrvstt/Recurring-ETH-Buy-Coinbase
coinbase_advanced_trader/config.py
.py
81a58ec927bddcd0
7
0
from dataclasses import dataclass from decimal import Decimal from enum import Enum from typing import Optional class OrderSide(Enum): """Enum representing the side of an order (buy or sell).""" BUY = "buy" SELL = "sell" class OrderType(Enum): """Enum representing the type of an order (market or lim...
rrvstt/Recurring-ETH-Buy-Coinbase
coinbase_advanced_trader/models/order.py
.py
0c0ef8f7bf17566e
7
0
from dataclasses import dataclass from decimal import Decimal @dataclass class Product: """ Represents a trading product with its associated attributes. Attributes: id (str): Unique identifier for the product. base_currency (str): The base currency of the product. quote_currency (...
rrvstt/Recurring-ETH-Buy-Coinbase
coinbase_advanced_trader/models/product.py
.py
420b64a8de1f7517
7
0
from decimal import Decimal from typing import Dict, List, Any, Optional from datetime import datetime, timedelta from dataclasses import dataclass from coinbase.rest import RESTClient from coinbase_advanced_trader.logger import logger @dataclass class Account: uuid: str currency: str available_balance: ...
rrvstt/Recurring-ETH-Buy-Coinbase
coinbase_advanced_trader/services/account_service.py
.py
e1b873c1fcbc27b8
7
0
# <ai_context> # New module implementing fiat deposit and withdrawal functionality using # the enhanced authentication approach from coinbase-advanced-py (ECDSA). # This code replaces the old scripts from 'coinbase_deposit.py' and # 'coinbase_withdrawals.py', removing any legacy authentication references. # </ai_contex...
rrvstt/Recurring-ETH-Buy-Coinbase
coinbase_advanced_trader/services/funds_service.py
.py
881cbf2a9f83aff8
7
0
from abc import ABC, abstractmethod from typing import Optional from coinbase_advanced_trader.models import Order from .order_service import OrderService from .price_service import PriceService class BaseTradingStrategy(ABC): """ Abstract base class for trading strategies. This class provides a common i...
rrvstt/Recurring-ETH-Buy-Coinbase
coinbase_advanced_trader/services/trading_strategy_service.py
.py
83073d0a9dc99c7a
7
0
"""Unit tests for the AccountService class.""" import unittest from unittest.mock import Mock, patch from decimal import Decimal from datetime import datetime from coinbase.rest import RESTClient from coinbase_advanced_trader.services.account_service import AccountService class TestAccountService(unittest.TestCase)...
rrvstt/Recurring-ETH-Buy-Coinbase
coinbase_advanced_trader/tests/test_account_service.py
.py
dc3bccb3125bb5f0
7.5
0