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 json
from typing import Any
try:
from redis.asyncio import Redis
except ImportError:
raise ImportError(
"The redis package is not installed. Please install it with 'pip install redis' or 'pip install -e \".[redis]\"'"
)
from pydantic import BaseModel
from ...config.settings import get_sett... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/cache/backends/redis.py | .py | b09e89a0efe68fa4 | 7 | 0 |
import logging
import os
from enum import StrEnum
from pydantic import Field
from pydantic_settings import BaseSettings
from starlette.config import Config
from .enums import CacheBackend, LogFormat, LogLevel, SessionBackend, TaskiqBrokerType
logger = logging.getLogger(__name__)
current_file_dir = os.path.dirname(o... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/config/settings.py | .py | e48c57a5e082bb59 | 7 | 0 |
from collections.abc import AsyncGenerator
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
from sqlalchemy.orm import DeclarativeBase, MappedAsDataclass
from ..config.settings import settings
engine = create_async_engine(
settings.DATABASE_URL,
echo=False,
future=... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/database/session.py | .py | 5f1ffc8aeaa94adb | 7 | 0 |
"""Smart logger factory with automatic configuration and settings integration.
This module provides the main interface for obtaining loggers throughout
the application. It automatically detects calling modules, applies
configuration based on settings, and provides a simple API for getting
properly configured loggers.
... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/logging/factory.py | .py | af55e0b4f88e9c7c | 7 | 0 |
"""Custom logging formatters for different environments and output types.
This module provides specialized formatters that adapt to different environments
and use cases. Each formatter is optimized for its intended output medium and
provides the appropriate level of detail and structure.
Available Formatters:
- Simpl... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/logging/formatters.py | .py | 52b4368f901729bc | 7 | 0 |
"""Custom logging handlers for different output destinations."""
import logging
import logging.handlers
import sys
from pathlib import Path
from .formatters import get_formatter
class ColoredConsoleHandler(logging.StreamHandler):
"""Enhanced console handler with color support."""
COLORS = {
"DEBUG"... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/logging/handlers.py | .py | d5e1969baf930153 | 7 | 0 |
"""Middleware components for the FastAPI application."""
from fastapi import Request, Response
from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
from starlette.types import ASGIApp
# Two years, matching the HSTS preload-list requirement.
HSTS_MAX_AGE_SECONDS = 63072000
class ClientCa... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/middleware.py | .py | 53bc94080dd2c53f | 7 | 0 |
import hashlib
from datetime import UTC, datetime
try:
import aiomcache
except ImportError:
raise ImportError(
"The aiomcache package is not installed. "
"Please install it with 'pip install aiomcache' or 'pip install -e \".[memcached]\"'"
)
from pydantic import BaseModel
from ....modules... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/rate_limit/backends/memcached.py | .py | a74f6c5f173f2e85 | 7 | 0 |
from datetime import UTC, datetime
try:
from redis.asyncio import Redis
from redis.exceptions import RedisError
except ImportError:
raise ImportError(
"The redis package is not installed. Please install it with 'pip install redis' or 'pip install -e \".[redis]\"'"
)
from pydantic import BaseMo... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/rate_limit/backends/redis.py | .py | c99e7c93d0c5b4a9 | 7 | 0 |
from fastapi import HTTPException, status
class RateLimitException(HTTPException):
"""Exception raised when a rate limit is exceeded.
This HTTP exception is thrown when a client exceeds their allowed request
rate, providing appropriate HTTP status code and headers for rate limiting.
The exception au... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/rate_limit/exceptions.py | .py | 63832a2692472a9a | 7 | 0 |
from collections.abc import Callable
from typing import Any, cast
from fastapi import Depends, Request
from sqlalchemy.ext.asyncio import AsyncSession
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.responses import Response
from ...modules.common.utils.logger import get_logger
from ...modules... | lakshyakumarsaini07/Salesforce-QA-Agent | backend/src/infrastructure/rate_limit/middleware.py | .py | 1f23bc30c144a43f | 7 | 0 |
"""Analysis: action-potential detection, F-I curves, gating dynamics, rate profiles."""
from __future__ import annotations
from typing import Dict, Optional, Tuple
import numpy as np
from scipy.signal import find_peaks
from .cell import PointCell
from .simulator import Simulator, Solution, step_pulse
from . import p... | aks014-hue/comp-neuro-biophyX | hh_simulator/analysis.py | .py | cc924492de1f868f | 7 | 0 |
"""Point cell (single isopotential compartment) for the HH model.
Membrane equation:
C_m * dV/dt = -sum(I_ionic) + I_inj
where I_ionic = g_bar * gating * (V - E) for each channel (outward positive).
"""
from __future__ import annotations
from typing import Dict, List
import numpy as np
from scipy.optimize import b... | aks014-hue/comp-neuro-biophyX | hh_simulator/cell.py | .py | a88536a79f3e428e | 7 | 0 |
"""Ion channels (channel scale) for the classic HH model.
Each channel is composed of gating particles. A particle's voltage-dependent
transition rates come from either:
- an EnergyLandscape (Eyring rate theory, "energy" mode), or
- exact empirical classic-HH alpha/beta callables ("classic" mode).
Conductance fol... | aks014-hue/comp-neuro-biophyX | hh_simulator/channels.py | .py | 7177bdfc11119269 | 7 | 0 |
# Copyright 2025 Emcie Co Ltd.
#
# 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... | rajath-raman/parlant | src/parlant/adapters/nlp/anthropic_service.py | .py | 94cb77a72421545a | 7 | 0 |
# Copyright 2025 Emcie Co Ltd.
#
# 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... | rajath-raman/parlant | src/parlant/adapters/nlp/aws_service.py | .py | 41e49969d1a015de | 7 | 0 |
# Copyright 2025 Emcie Co Ltd.
#
# 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... | rajath-raman/parlant | src/parlant/adapters/nlp/cerebras_service.py | .py | 29bcb0139d7e4778 | 7 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""convert_maares —— 把 MAA 官方资源(MAA 语法)转换为标准 MaaFramework bundle。
MAA(及 MAA-Meow) 资源基于 MaaFramework 格式,但使用少量 MAA 扩展动作/识别名
(ClickSelf/ClickRect/Stop/Input/OcrDetect/MatchTemplate 等),且 OCR 模型布局
不同。本脚本做规范化,输出标准 bundle(pipeline/ + image/ + model/ocr/),
可直接被 MaaFramework post_... | SimonQvQ/MAAi | maai-server/convert_maares.py | .py | 9e5cc79d5691625f | 7.15 | 1 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""把 MAAi 设备类型注入 MWU 后端(自适应 MWU 版本)。
上游 MWU(ravizhan/MWU)分为两类:
A) 已自带 MAAi 后端(device_service.py 含 case "MAAi",并有 maa_bridge.py /
maa_controller.py)-> 本脚本只确保这两个文件拷贝到位,跳过旧版补丁。
B) 旧版(无 MAAi)-> 执行 10 处 device_service 锚点 patch + models Literal +
app_state pending... | SimonQvQ/MAAi | maai-server/mwu/patch_backend.py | .py | 1e8480da3faff85a | 7.15 | 1 |
#!/usr/bin/env python3
"""
Generate static blog pages from markdown files.
"""
import os
import re
from datetime import datetime
from pathlib import Path
from xml.etree.ElementTree import Element, SubElement, tostring
from xml.dom import minidom
import html
try:
import markdown
except ImportError:
print("Error... | alexalemi/kissimmee.fyi | src/generate_blog.py | .py | dbbff4d4a5e0d873 | 7 | 0 |
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import pandas as pd
@dataclass(frozen=True)
class DatasetInfo:
"""Metadata about a cached or uploaded Niche Finder dataset."""
path: Path
source: str
rows: int
columns: tuple[str... | DanHachuel/thunderbolt | app/modules/niche_finder/models.py | .py | 7cec5c1968eba5b1 | 7.15 | 1 |
"""Safe, read-only API credential diagnostics used by the Settings UI.
Every check in this module is deliberately bounded and avoids uploads, posts,
actor runs, image generation and audio generation. Results contain no secret,
URL or raw exception text; callers may persist them in local settings safely.
"""
from __f... | DanHachuel/thunderbolt | hermes_ui/api_key_tests.py | .py | daf6b5295264dc1e | 7.65 | 1 |
"""Helpers for resuming video creation from persisted scripts and drafts."""
from __future__ import annotations
from typing import Any
VIDEO_SETTING_KEYS = (
"video_source",
"video_format",
"video_concatenation_mode",
"match_visuals_to_script_order",
"video_transition_mode",
"video_aspect_rat... | DanHachuel/thunderbolt | hermes_ui/draft_video.py | .py | 5bda602a028d0cbb | 7.15 | 1 |
from __future__ import annotations
import uuid
from typing import Any
from .storage import now, read_json, write_json
DRAFTS_FILE = "drafts.json"
MAX_DRAFTS = 200
def list_drafts() -> list[dict[str, Any]]:
"""Return locally persisted drafts, newest first."""
records = read_json(DRAFTS_FILE, [])
return ... | DanHachuel/thunderbolt | hermes_ui/drafts.py | .py | 04d065af9c86ba53 | 7.15 | 1 |
"""Discovery of models from OpenAI-compatible providers such as NVIDIA NIM."""
from __future__ import annotations
from typing import Any
import requests
DEFAULT_NVIDIA_NIM_BASE_URL = "https://integrate.api.nvidia.com/v1"
DEFAULT_TIMEOUT_SECONDS = 12
MAX_MODEL_IDS = 2000
class ModelDiscoveryError(ValueError):
... | DanHachuel/thunderbolt | integrations/openai_model_discovery.py | .py | c572d594c60e064b | 7.15 | 1 |
"""Health check read-only para sessões do Upload directo YouTube.
O token ``sessionInfo`` não é interpretado nem devolvido. O módulo controla a
idade de captura persistida no documento de credenciais, aplica uma janela
conservadora de expiração e permite que a UI/worker alerte antes de iniciar um
upload. A renovação c... | DanHachuel/thunderbolt | integrations/session_info_health.py | .py | c52f56f8d0193dbf | 7.15 | 1 |
#!/usr/bin/env python3
"""Forward one command-hook lifecycle event to a running Cargento.
Serves every harness whose hooks are *hook-shaped*: a fresh process per event,
one JSON payload on stdin, a `hook_event_name` naming what happened. Claude Code,
Codex and Gemini CLI all are, and Codex's `hooks.json` turned out to... | spacedock-dev/cargento | cargento-gemini/hooks/event_hook.py | .py | 6aa4cd0bc06a89ef | 7.24 | 2 |
#!/usr/bin/env python3
"""Forward a Claude Code hook payload to a running Cargento dashboard.
This exists because the equivalent shell one-liner is not portable. The
documented `curl` form relies on POSIX single-quoting, `/dev/null`, `|| true`,
and `--data-binary @-`: cmd.exe accepts none of that, and Windows PowerShe... | spacedock-dev/cargento | cargento-gemini/hooks/notify_hook.py | .py | b6cf0d86938454c3 | 7.24 | 2 |
#!/usr/bin/env python3
"""Forward one Antigravity lifecycle hook to a running Cargento.
Antigravity's third input contract, and the reason this is not folded into
`event_hook.py`. Three things differ from a Claude or Codex hook, and each one
would be a silent bug if assumed away:
1. **The payload is camelCase.** Anti... | spacedock-dev/cargento | cargento/skills/cargento/agy_hook.py | .py | d18eb727307a4881 | 7.24 | 2 |
"""Outstanding questions a session asked, and their one-slot answer mailboxes.
A mailbox holds one outcome, not a queue: a question is answered, declined or
expired exactly once, and the first of those to land is the one the asking
session gets. Nothing here can revise it. A declined ask that could later read
as answe... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/asks.py | .py | 7e7052f437fd0184 | 7.24 | 2 |
"""Argument parsing, runtime assembly, and the three serve branches."""
from __future__ import annotations
import argparse
import contextlib
import ipaddress
import json
import os
import sys
import time
from pathlib import Path
from typing import TYPE_CHECKING
from cargento_runtime import aggregate, diagnostics, htt... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/cli.py | .py | 9a6836fef91e58e2 | 7.24 | 2 |
"""Codex rollout collection."""
from __future__ import annotations
import os
from typing import TYPE_CHECKING, Any
# Absolute on the canonical top-level package: a sub-package cannot use
# parent-relative imports without tripping the repository's own TID252 rule.
from cargento_runtime import io as runtime_io
from ca... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/collectors/codex.py | .py | 70fc628677fab257 | 7.24 | 2 |
"""Gemini CLI collection.
Gemini CLI stopped serving consumer accounts on 2026-06-18, and Antigravity CLI
is Google's current agent. It does *not* follow that nothing writes this store.
Enterprise Gemini Code Assist licences and API-key authentication were explicitly
unaffected, and the CLI is actively released: 0.53.... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/collectors/gemini.py | .py | 2cf996a52b1b9de3 | 7.24 | 2 |
"""Goose collection from its shared read-only SQLite store."""
from __future__ import annotations
import json
from typing import TYPE_CHECKING, Any
from cargento_runtime import io as runtime_io
from cargento_runtime import records, sessions, turns
if TYPE_CHECKING:
from cargento_runtime.config import RuntimeCon... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/collectors/goose.py | .py | b2ff29a767e5c721 | 7.24 | 2 |
"""Why a harness is not showing up: store paths, what is on disk, and errors."""
from __future__ import annotations
import os
import stat as stat_module
import sys
from typing import TYPE_CHECKING, Any
from cargento_runtime import config as runtime_config
from cargento_runtime import io as runtime_io
if TYPE_CHECKI... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/diagnostics.py | .py | b237c44fdeea7943 | 7.24 | 2 |
"""Dismissals: the sessions the reader has marked handled.
The one thing Cargento writes on the reader's behalf. Every other file it writes
records the instance (`lifecycle`); this one records intent, so it lives outside
the per-port state file and outlives the process that wrote it. See
docs/design-dismissals.md for ... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/dismissals.py | .py | af944cd61c6e07fb | 7.24 | 2 |
"""A coarse store probe: cheap detection that something on disk moved.
The probe answers one question, "is it worth collecting", and answers it wrongly
in one documented direction. It is a wake-up hint, never authority, which is why
periodic reconciliation stays whatever this reports.
What it stats, and why that set:... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/probe.py | .py | a1179c3f15856cb2 | 7.24 | 2 |
"""The published dashboard snapshot: one built response per variant, versioned.
The revision is a pair, not an integer. A counter alone restarts at zero with
the process, so a tab frozen at revision 512 across a dashboard restart would
treat every later revision as older and never refetch again. Pairing it with
the se... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/snapshot.py | .py | f67a480aa505fc1c | 7.24 | 2 |
"""Mutable process state owned by one Cargento runtime."""
from __future__ import annotations
import threading
from collections import deque
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, TypedDict
from cargento_runtime import asks as runtime_asks
from cargento_runtime import snapsho... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/state.py | .py | e957f589aa0f18dc | 7.24 | 2 |
"""Connected SSE clients and their one-slot revision mailboxes.
A mailbox holds one revision, not a queue. A client that reads slowly must fall
behind by skipping intermediate revisions rather than by growing an unbounded
backlog, and skipping costs it nothing: it refetches the whole payload on the
revision it does se... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/stream.py | .py | e7ff55be4134dbed | 7.24 | 2 |
"""Generic incremental turn scanning and turn display data."""
from __future__ import annotations
import json
import os
from typing import TYPE_CHECKING, Any
from . import io as runtime_io
from . import records, sessions
if TYPE_CHECKING:
from .config import RuntimeConfig
from .state import RuntimeState
d... | spacedock-dev/cargento | cargento/skills/cargento/cargento_runtime/turns.py | .py | a77bd2ffac1fc724 | 7.24 | 2 |
"""
High School Management System API
A super simple FastAPI application that allows students to view and sign up
for extracurricular activities at Mergington High School.
"""
from fastapi import FastAPI, HTTPException
from fastapi.staticfiles import StaticFiles
from fastapi.responses import RedirectResponse
import o... | tyler-low/skills-getting-started-with-github-copilot | src/app.py | .py | 343ff1dc2d52e201 | 7 | 0 |
# -*- coding: utf-8 -*-
"""命令层共享小工具。
commands 各模块只调 core 的函数,不知鉴权细节(spec §9 分层铁律)。
全局 --profile / --credentials-file 由 main.py 的 callback 塞进 ctx.obj,
命令经 auth_params(ctx) 取出,透传给 core.client。
"""
from __future__ import annotations
import typer
# 输出格式默认值常量复用
from dw_cli.core.output import OUTPUT_JSON
def auth_params... | dcbandtss/dw-cli | dw-cli/dw_cli/commands/__init__.py | .py | e63b002fe271cabd | 7 | 0 |
# -*- coding: utf-8 -*-
"""ide_event 类命令(v3.18.6,2026-08-26 新增)。
IDE 扩展点事件:用于 DataWorks 开放平台扩展程序流程。
- get-ide-event-detail:查询扩展点事件数据快照
- update-ide-event-result:将扩展程序检查结果回调至 DataWorks
⚠️ SDK 方法名:get_ideevent_detail / update_ideevent_result(ideevent 不拆下划线)。
扩展点事件流程:文件提交/发布时 DataWorks 触发扩展点 → 事件消息含 message_id →
扩展程序处理后... | dcbandtss/dw-cli | dw-cli/dw_cli/commands/ide_event.py | .py | 9fe104aef0678f99 | 7 | 0 |
# -*- coding: utf-8 -*-
"""migration 类命令(spec §9 按资源分文件,对外平铺)。
DataWorks 导入导出迁移:把一个空间的导出包导入到另一个空间。
- create-import-migration:创建导入任务(高危,会导入包内容到目标空间)。
- start-migration:启动执行导入任务(高危,执行后包内容替换目标空间)。
⚠️ 高危:导入包内容会替换目标空间的任务/表/数据源。此处强制 --confirm。
⚠️ 私有云不可用(2026-07-10 真调验证):
- 普通版 create_import_migration 返回 200 但无 Migratio... | dcbandtss/dw-cli | dw-cli/dw_cli/commands/migration.py | .py | 06e7f3460b113f66 | 7 | 0 |
# -*- coding: utf-8 -*-
"""raw 透传命令(spec §2 / §8.2)。
`raw <api_name> --key val ...`:一个命令让清单「待建(raw)」项一次性可用。
实现路径(已验证基线,spec §8.2):
1. snake_case api_name → CamelCase Request 类名(GetNodeRequest 等)。
2. inspect.signature(ReqCls.__init__) 读合法字段集 + 类型注解。
3. kebab-case --key → snake_case,非法字段名报错并给合法字段清单(对 agent 友好)。
... | dcbandtss/dw-cli | dw-cli/dw_cli/commands/raw.py | .py | 48596fb5691634d1 | 7 | 0 |
# -*- coding: utf-8 -*-
"""resource 类命令(spec §9 按资源分文件,对外平铺)。
资源文件(Resource)是 DataStudio 里可被节点/UDF 引用的 jar/py/archive 等文件。
清单「待封装」resource 项:create-resource-file(含 Advance 上传分支)。
⚠️ 私有云重要约束(2026-06-29 真调确认):
create-resource-file 在私有云**打不通**——服务端要求 ConnectionName,但 SDK
2020-05-18 的 CreateResourceFileRequest 模型缺该字段... | dcbandtss/dw-cli | dw-cli/dw_cli/commands/resource.py | .py | ed14634b1c0ce4c6 | 7 | 0 |
# -*- coding: utf-8 -*-
"""写操作分级保护(spec §7.2)。
- 低危(create / update)默认执行。
- 高危(delete / deploy / stop / terminate / offline)必须显式 --confirm,
否则拒绝执行并返回退出码 2(用法错)。
- --dry-run 预览影响(不真执行,输出将操作的资源 + 影响摘要)。
判定逻辑集中在此,raw 透传命令与语义封装命令共用,避免两套口径
(spec §7.2 铁律)。
"""
from __future__ import annotations
from typing import Option... | dcbandtss/dw-cli | dw-cli/dw_cli/core/confirm.py | .py | b71368470979cbef | 7 | 0 |
# -*- coding: utf-8 -*-
"""输出三层解耦(spec §3)。
CLI 内部始终持有全量原始 JSON(从 Tea 响应序列化来),三层解耦:
1. 取数层 --query / -q:JMESPath 表达式,在全量 JSON 上裁剪。
2. 格式层 --output:json(默认)/ table / text,作用于裁剪后结果。
3. 默认 = 全量 JSON,无 query 无 output 转换。
铁律:stdout 只放最终数据;进度/诊断/警告/错误一律 stderr(spec §4)。
凭据相关输出永不经手 AK/SK 明文(脱敏在 core/client 内完成)。
"""
f... | dcbandtss/dw-cli | dw-cli/dw_cli/core/output.py | .py | a0cc0a4c4e79d386 | 7 | 0 |
# -*- coding: utf-8 -*-
"""分页(spec §5)。
- --all 触发自动翻页:CLI 内部循环调用,合并每页 items 成统一 JSON。
- 软截断 + 警告:默认上限 5000 条,超出输出已取部分到 stdout + stderr 警告 + exit 0。
- 两种风格都支持:偏移分页(page_number/page_size)与游标分页(next_token)。
分页逻辑集中在此,所有列表命令经它翻页,避免各自实现(spec §5)。
"""
from __future__ import annotations
from typing import Any, Callable, Op... | dcbandtss/dw-cli | dw-cli/dw_cli/core/paging.py | .py | c22b24ebc6767165 | 7 | 0 |
"""Fix workflow step timeout/cancellation schema.
Revision ID: 61661b7e79f8
Revises: fa1b2c3d4e56
"""
from alembic import op
import sqlalchemy as sa
revision = "61661b7e79f8"
down_revision = "fa1b2c3d4e56"
branch_labels = None
depends_on = None
def upgrade() -> None:
# e4f5a6b7c809 placed this index on workflow... | ijoolaie/AI-Employee | backend/alembic/versions/61661b7e79f8_fix_workflow_step_timeout_schema.py | .py | 3b51cb016ebbd305 | 7 | 0 |
"""Align workflow approval created_at index with the SQLAlchemy model.
Revision ID: 7a2b3c4d5e6f
Revises: 61661b7e79f8
"""
from alembic import op
revision = "7a2b3c4d5e6f"
down_revision = "61661b7e79f8"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_index(
"ix_workflow_approvals... | ijoolaie/AI-Employee | backend/alembic/versions/7a2b3c4d5e6f_workflow_approval_created_at_index.py | .py | 023e6ae1fe87734b | 7 | 0 |
"""add tool approval requests
Revision ID: 9f3a1c7b2d10
Revises: 677a41c87946
"""
from alembic import op
import sqlalchemy as sa
import uuid
from sqlalchemy.dialects import postgresql
revision = "9f3a1c7b2d10"
down_revision = "677a41c87946"
branch_labels = None
depends_on = None
def upgrade() -> None:
# Create ... | ijoolaie/AI-Employee | backend/alembic/versions/9f3a1c7b2d10_tool_approval_requests.py | .py | 52851dd105ea68e3 | 7 | 0 |
"""Workflow condition steps and durable schedules.
Revision ID: a7b8c9d0e123
Revises: f1b2c3d4e506
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = "a7b8c9d0e123"
down_revision = "f1b2c3d4e506"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.... | ijoolaie/AI-Employee | backend/alembic/versions/a7b8c9d0e123_workflow_conditions_and_schedules.py | .py | f52ded91da9ba6f6 | 7 | 0 |
"""Durable human approval/wait-resume for workflow steps.
Revision ID: c2d3e4f5a607
Revises: b8c9d0e1f234
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = "c2d3e4f5a607"
down_revision = "b8c9d0e1f234"
branch_labels = None
depends_on = None
def upgrade() -> None:
... | ijoolaie/AI-Employee | backend/alembic/versions/c2d3e4f5a607_workflow_human_approval.py | .py | a03eff8efc09b3eb | 7 | 0 |
"""Transactional outbox for durable post-commit dispatch.
Revision ID: d3e4f5a6b708
Revises: c2d3e4f5a607
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = "d3e4f5a6b708"
down_revision = "c2d3e4f5a607"
branch_labels = None
depends_on = None
def upgrade() -> None:
... | ijoolaie/AI-Employee | backend/alembic/versions/d3e4f5a6b708_transactional_outbox.py | .py | 647b87545f03efd3 | 7 | 0 |
"""durable Employee memory foundation
Revision ID: d4e7f1a9b302
Revises: c1e4f8a72b31
"""
from alembic import op
import sqlalchemy as sa
import uuid
from sqlalchemy.dialects import postgresql
revision = "d4e7f1a9b302"
down_revision = "c1e4f8a72b31"
branch_labels = None
depends_on = None
def upgrade() -> None:
pe... | ijoolaie/AI-Employee | backend/alembic/versions/d4e7f1a9b302_employee_memory.py | .py | def2f48a96270c9f | 7 | 0 |
"""Encrypted webhook secrets for newly created triggers.
Revision ID: d4f5a6b7c809
Revises: d3e4f5a6b708
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = "d4f5a6b7c809"
down_revision = "d3e4f5a6b708"
branch_labels = None
depends_on = None
def upgrade() -> None:
... | ijoolaie/AI-Employee | backend/alembic/versions/d4f5a6b7c809_webhook_secret_encryption.py | .py | 8683dfc4b21e6207 | 7 | 0 |
"""Workflow timeout and cancellation support.
Revision ID: e4f5a6b7c809
Revises: d3e4f5a6b708
"""
from alembic import op
import sqlalchemy as sa
revision = "e4f5a6b7c809"
down_revision = "d3e4f5a6b708"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column("workflow_runs", sa.Column("deadline_... | ijoolaie/AI-Employee | backend/alembic/versions/e4f5a6b7c809_workflow_timeout_cancellation.py | .py | 376ae21961d0541c | 7 | 0 |
"""Memory lifecycle, versioning, and supersession.
Revision ID: e8a1c4d7b902
Revises: d4e7f1a9b302
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = "e8a1c4d7b902"
down_revision = "d4e7f1a9b302"
branch_labels = None
depends_on = None
def upgrade() -> None:
... | ijoolaie/AI-Employee | backend/alembic/versions/e8a1c4d7b902_memory_lifecycle.py | .py | 43976e5dadf77040 | 7 | 0 |
"""Phase 1 DLQ, replay and observability fields.
Revision ID: f7c8d9e0a123
Revises: f6b7c8d9e012
"""
from alembic import op
import sqlalchemy as sa
revision = "f7c8d9e0a123"
down_revision = "f6b7c8d9e012"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column("outbox_messages", sa.Column("de... | ijoolaie/AI-Employee | backend/alembic/versions/f7c8d9e0a123_dlq_replay_observability.py | .py | 450cdc32006b343d | 7 | 0 |
"""Phase 1 workflow versioning and execution-contract hardening.
Revision ID: f8d9e0a1b234
Revises: f7c8d9e0a123
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = "f8d9e0a1b234"
down_revision = "f7c8d9e0a123"
branch_labels = None
depends_on = None
def upgrade()... | ijoolaie/AI-Employee | backend/alembic/versions/f8d9e0a1b234_workflow_versioning_execution_contract.py | .py | f8556aad619f5b1a | 7 | 0 |
"""platform admin flag for Phase 1 admin dashboard
Revision ID: f9a0b1c2d345
Revises: f8d9e0a1b234
"""
from alembic import op
import sqlalchemy as sa
revision = "f9a0b1c2d345"
down_revision = "f8d9e0a1b234"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column("users", sa.Column("is_platfo... | ijoolaie/AI-Employee | backend/alembic/versions/f9a0b1c2d345_platform_admin_and_admin_dashboard.py | .py | 65df395a957de7ca | 7 | 0 |
"""Add workflow-run retry state fields.
Revision ID: fa1b2c3d4e56
Revises: f9a0b1c2d345
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = "fa1b2c3d4e56"
down_revision = "f9a0b1c2d345"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_colu... | ijoolaie/AI-Employee | backend/alembic/versions/fa1b2c3d4e56_workflow_run_retry_state.py | .py | 8c97808be2c17fe0 | 7 | 0 |
"""Phase 5 commercial license authority.
Revision ID: p5license01
Revises: rc9merge02
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = "p5license01"
down_revision = "rc9merge02"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(... | ijoolaie/AI-Employee | backend/alembic/versions/p5_commercial_licenses.py | .py | e75c29a90ac338fa | 7 | 0 |
"""Align the commercial license schema with the SQLAlchemy model.
Revision ID: p5license02
Revises: p5merge01
"""
from alembic import op
revision = "p5license02"
down_revision = "p5merge01"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_index(
"ix_commercial_licenses_status",
... | ijoolaie/AI-Employee | backend/alembic/versions/p5_license_schema_alignment.py | .py | b6f2a1766b90bf9c | 7 | 0 |
"""Backfill v1.1.1 release identity for existing vendor tenants.
Revision ID: p5vendoridentity01
Revises: p5license02
"""
from alembic import op
import sqlalchemy as sa
revision = "p5vendoridentity01"
down_revision = "p5license02"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.execute(
... | ijoolaie/AI-Employee | backend/alembic/versions/p5_vendor_identity_backfill.py | .py | 9c363e7ca87bbb01 | 7 | 0 |
"""Merge the remaining independent Alembic heads into one release head.
This migration is intentionally empty: the parent migrations already contain
all schema/data operations. It only reconciles the migration graph so fresh
installs and upgrades can target ``head`` unambiguously.
Revision ID: rc9merge03
Revises: rc9... | ijoolaie/AI-Employee | backend/alembic/versions/rc9_merge_final_heads.py | .py | 48a13f8c90079888 | 7 | 0 |
"""Add explicit permission scopes to tenant API keys.
Revision ID: v14004apikeyscopes
Revises: rc9merge02
"""
from alembic import op
import sqlalchemy as sa
revision = "v14004apikeyscopes"
down_revision = "rc9merge02"
branch_labels = None
depends_on = None
def upgrade() -> None:
# NULL preserves the legacy beha... | ijoolaie/AI-Employee | backend/alembic/versions/v14004_api_key_scopes.py | .py | 95809ffd11a760e9 | 7 | 0 |
"""Add idempotent usage event ledger for V1.4-005.
Revision ID: v14005usage
Revises: v14004merge
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = "v14005usage"
down_revision = "v14004merge"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.c... | ijoolaie/AI-Employee | backend/alembic/versions/v14005_usage_event_ledger.py | .py | 5f57b24ba7d35b45 | 7 | 0 |
"""Authorize and audit the V1.4 refund/reversal lifecycle.
Revision ID: v14007refundauth
Revises: v14006refund
"""
from alembic import op
import sqlalchemy as sa
revision = "v14007refundauth"
down_revision = "v14006refund"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.execute(
sa.text... | ijoolaie/AI-Employee | backend/alembic/versions/v14007_refund_authorization_audit.py | .py | b621bb8ef7e846e2 | 7 | 0 |
#!/usr/bin/env python3
"""
🚫 Player Ban
"""
import argparse
import os
import json
from datetime import datetime
def ban_player(player_name):
print(f"🚫 BANNING player: {player_name}")
# Create ban record
ban_record = {
'player': player_name,
'timestamp': datetime.now().isoformat(),
... | C0FFEEC0DE/mars-colony-game | game/server/anticheat/ban.py | .py | 6572bf01d7a21d99 | 7 | 0 |
#!/usr/bin/env python3
"""
🛡️ Cheating Validation
"""
import json
import os
import sys
def validate_player(filename):
"""Check player data for suspicious values"""
try:
with open(f'players/{filename}', 'r') as f:
player = json.load(f)
resources = player.get('resources', {})
... | C0FFEEC0DE/mars-colony-game | game/server/anticheat/validate.py | .py | c8b8aae8f45a6eb4 | 7 | 0 |
#!/usr/bin/env python3
"""
🌅 Mars Day Cycle
Updates global world state
"""
import json
import random
import sys
from datetime import datetime
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parents[2]
if str(ROOT_DIR) not in sys.path:
sys.path.insert(0, str(ROOT_DIR))
from game.server.ai_content im... | C0FFEEC0DE/mars-colony-game | game/server/day_cycle.py | .py | fcd44a04b66fda3c | 7 | 0 |
#!/usr/bin/env python3
"""
🫁 Colonist Resource Consumption
"""
import json
import os
def load_player(filename):
with open(f'players/{filename}', 'r') as f:
return json.load(f)
def save_player(filename, player):
with open(f'players/{filename}', 'w') as f:
json.dump(player, f, indent=2)
def m... | C0FFEEC0DE/mars-colony-game | game/server/economy/consumption.py | .py | 1fd9e8a502b4aaa3 | 7 | 0 |
#!/usr/bin/env python3
"""
⚡ Energy Generation
"""
import json
import os
def load_player(filename):
with open(f'players/{filename}', 'r') as f:
return json.load(f)
def save_player(filename, player):
with open(f'players/{filename}', 'w') as f:
json.dump(player, f, indent=2)
def load_world():
... | C0FFEEC0DE/mars-colony-game | game/server/economy/energy.py | .py | e17a11c05b65f7da | 7 | 0 |
#!/usr/bin/env python3
"""
🔧 Degradation and Maintenance
"""
import json
import os
import random
def load_player(filename):
with open(f'players/{filename}', 'r') as f:
return json.load(f)
def save_player(filename, player):
with open(f'players/{filename}', 'w') as f:
json.dump(player, f, inde... | C0FFEEC0DE/mars-colony-game | game/server/economy/maintenance.py | .py | d77bc307cc374478 | 7 | 0 |
#!/usr/bin/env python3
"""
📈 Market - Dynamic Prices
"""
import json
import random
def load_world():
with open('world_state.json', 'r') as f:
return json.load(f)
def save_world(world):
with open('world_state.json', 'w') as f:
json.dump(world, f, indent=2)
def main():
world = load_world(... | C0FFEEC0DE/mars-colony-game | game/server/economy/market.py | .py | c5a3c393ed873d5d | 7 | 0 |
#!/usr/bin/env python3
"""
🌱 Food Production (hydroponics)
"""
import json
import os
def load_player(filename):
with open(f'players/{filename}', 'r') as f:
return json.load(f)
def save_player(filename, player):
with open(f'players/{filename}', 'w') as f:
json.dump(player, f, indent=2)
def m... | C0FFEEC0DE/mars-colony-game | game/server/economy/production.py | .py | 1d7e5cdf8c415f0a | 7 | 0 |
#!/usr/bin/env python3
"""
🔍 Scientific Discovery
"""
import json
import random
import sys
from datetime import datetime
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parents[3]
if str(ROOT_DIR) not in sys.path:
sys.path.insert(0, str(ROOT_DIR))
from game.server.ai_content import attach_event_fla... | C0FFEEC0DE/mars-colony-game | game/server/events/discovery.py | .py | 3c47225421d35582 | 7 | 0 |
#!/usr/bin/env python3
"""
💧 Underground Ice
"""
import json
import os
import random
import sys
from datetime import datetime
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parents[3]
if str(ROOT_DIR) not in sys.path:
sys.path.insert(0, str(ROOT_DIR))
from game.server.ai_content import attach_even... | C0FFEEC0DE/mars-colony-game | game/server/events/ice_discovery.py | .py | 4c9f6513d1536dc9 | 7 | 0 |
#!/usr/bin/env python3
"""
🌠 Meteor Shower
"""
import json
import os
import random
import sys
from datetime import datetime
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parents[3]
if str(ROOT_DIR) not in sys.path:
sys.path.insert(0, str(ROOT_DIR))
from game.server.ai_content import attach_event_... | C0FFEEC0DE/mars-colony-game | game/server/events/meteor_shower.py | .py | cc13e5a40fe7d4b1 | 7 | 0 |
#!/usr/bin/env python3
"""
🌪️ Major Sandstorm
"""
import json
import sys
from datetime import datetime
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parents[3]
if str(ROOT_DIR) not in sys.path:
sys.path.insert(0, str(ROOT_DIR))
from game.server.ai_content import attach_event_flavor
def load_worl... | C0FFEEC0DE/mars-colony-game | game/server/events/sandstorm.py | .py | 24cfc596f6d48c56 | 7 | 0 |
#!/usr/bin/env python3
"""
⚡ Solar Flare
"""
import json
import sys
from datetime import datetime
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parents[3]
if str(ROOT_DIR) not in sys.path:
sys.path.insert(0, str(ROOT_DIR))
from game.server.ai_content import attach_event_flavor
def load_world():
... | C0FFEEC0DE/mars-colony-game | game/server/events/solar_flare.py | .py | 886c51a58d3ef549 | 7 | 0 |
#!/usr/bin/env python3
"""
🛸 Traders from Earth
"""
import json
import random
import sys
from datetime import datetime
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parents[3]
if str(ROOT_DIR) not in sys.path:
sys.path.insert(0, str(ROOT_DIR))
from game.server.ai_content import attach_event_flavo... | C0FFEEC0DE/mars-colony-game | game/server/events/traders.py | .py | 0490742ce6d1459f | 7 | 0 |
#!/usr/bin/env python3
"""
🌪️ Dust Storm Processing
"""
import json
import random
import os
from datetime import datetime
def load_world():
with open('world_state.json', 'r') as f:
return json.load(f)
def save_world(world):
with open('world_state.json', 'w') as f:
json.dump(world, f, indent=... | C0FFEEC0DE/mars-colony-game | game/server/storms.py | .py | 62075c6c60e58abf | 7 | 0 |
#!/usr/bin/env python3
"""
🌡️ Mars Weather
"""
import json
import random
from datetime import datetime
def load_world():
with open('world_state.json', 'r') as f:
return json.load(f)
def save_world(world):
with open('world_state.json', 'w') as f:
json.dump(world, f, indent=2)
def main():
... | C0FFEEC0DE/mars-colony-game | game/server/weather.py | .py | d58ea4f35a2e1304 | 7 | 0 |
#!/usr/bin/env python3
"""
🧪 AUTOMATED TESTS for Mars Colony Game
Run with: python3 test_game.py
"""
import json
import os
import sys
import subprocess
from pathlib import Path
def test_python_syntax():
"""Test all Python files compile without errors"""
print("🐍 Testing Python syntax...")
errors = []
... | C0FFEEC0DE/mars-colony-game | test_game.py | .py | 03b1447f9d03589f | 7.5 | 0 |
"""Activation — materialise a provider/model into ``~/.claude/settings.json``.
Plain ``activate`` fills every model slot with the stock Claude Code
defaults from :mod:`cc_switch._defaults`; ``--custom`` lets the user
override each env key interactively before writing.
The secret is read from credstore (by the *api_ke... | juzcn/slife | cc-switch/cc_switch/_activate.py | .py | e9ad27312ca3b658 | 7 | 0 |
"""Persistent provider/model configuration storage.
The non-secret *shape* of a Claude Code provider setup lives in
``~/.claude/cc-switch.json`` (path overridable via ``CC_SWITCH_FILE``).
Only provider metadata is stored here — never API keys. The secret is
referenced by *name* (the ``api_key_name`` field) and resolv... | juzcn/slife | cc-switch/cc_switch/_api.py | .py | 2981514e50cd6a3e | 7 | 0 |
"""Default settings template for the generated ``~/.claude/settings.json``.
The Claude Code convention: the other model slots
(``ANTHROPIC_DEFAULT_HAIKU_MODEL`` / ``_SONNET_`` / ``_OPUS_`` /
``CLAUDE_CODE_SUBAGENT_MODEL``) default to the **main model** picked on
the command line (``ANTHROPIC_MODEL``), and are never le... | juzcn/slife | cc-switch/cc_switch/_defaults.py | .py | bb405db2629ac33a | 7 | 0 |
"""Shared fixtures for cc-switch tests — isolated config/settings paths.
The real ``~/.claude/cc-switch.json`` is never touched: every test
points the config storage at a temp file and the settings writer at a
temp output path.
"""
from __future__ import annotations
import pytest
import cc_switch._activate as act
i... | juzcn/slife | cc-switch/tests/conftest.py | .py | 9332820e84073079 | 7.5 | 0 |
"""Tests for the cc-switch CLI (cc_switch.cli)."""
import builtins
import json
import os
import pytest
pytestmark = pytest.mark.unit
from cc_switch import _activate, _api, cli
@pytest.fixture(autouse=True)
def _clean_env(monkeypatch):
monkeypatch.delenv("ANTHROPIC_AUTH_TOKEN", raising=False)
@pytest.fixture... | juzcn/slife | cc-switch/tests/test_cli.py | .py | a669d1e3324218ac | 7.5 | 0 |
"""Dual-write backend for credstore.
Architecture:
- System keyring: primary read/write (deterministic per-platform:
WinVaultKeyring / WslBackend / macOS Keychain / KeyutilsBackend)
- keyrings.cryptfile: encrypted backup sync (survives OS password changes)
On set(): write to BOTH system keyring + cryptfile.
O... | juzcn/slife | credstore/credstore/_backend.py | .py | 76b5f9c5979c25d5 | 7 | 0 |
"""credstore — resolve the encrypted credential file path.
Priority:
1. ``CREDSTORE_FILE`` env var
2. ``~/.credstore/credentials.crypt`` (production) or
``./credentials.crypt`` (dev — when CWD contains slife's pyproject.toml)
"""
from __future__ import annotations
import os
from pathlib import Path
_tomlli... | juzcn/slife | credstore/credstore/_config.py | .py | 852d90f59ff803aa | 7 | 0 |
"""keyring: URI resolution.
Format::
keyring:<service>/<key>
Examples::
"keyring:slife/provider/deepseek"
"keyring:myapp/github"
The ``keyring:`` prefix signals that the value should be resolved
from the credential store. Everything else passes through unchanged.
"""
from __future__ import annotations... | juzcn/slife | credstore/credstore/_resolver.py | .py | d9eedaa265b2f6ed | 7 | 0 |
"""Terminal I/O helpers — platform-agnostic masked input.
Extracted from the CLI module so the command implementations in
``__main__.py`` don't carry the bulk of raw terminal handling.
"""
from __future__ import annotations
import sys
def masked_input(prompt: str = "") -> str:
"""Read a line from stdin, echoin... | juzcn/slife | credstore/credstore/_tty.py | .py | 7507a52e15737450 | 7 | 0 |
"""Tests for credstore._config — cryptfile path resolution."""
import importlib
import os
from pathlib import Path
from unittest.mock import patch
import pytest
pytestmark = pytest.mark.unit
from credstore._config import get_cryptfile_path
# _config.py conditionally defines is_slife_dev; Pylance can't resolve the
... | juzcn/slife | credstore/tests/test_config.py | .py | f7a481e3d62635c6 | 7.5 | 0 |
"""Tests for credstore._tty — masked terminal input."""
import sys
from unittest.mock import MagicMock, patch
import pytest
pytestmark = pytest.mark.unit
class TestMaskedInputDispatcher:
"""Tests for masked_input platform dispatch."""
def test_dispatches_to_windows_on_win32(self):
with patch.objec... | juzcn/slife | credstore/tests/test_tty.py | .py | 81574e6d6c586861 | 7.5 | 0 |
"""OS-level path detection for MCP allowed-paths injection.
The philosophy: trust the LLM, use OS file permissions as the safety net.
Instead of hard-coding restricted paths in MCP server configs, we detect
what the OS user can access and expose everything — the OS itself enforces
read/write/execute permissions on eve... | juzcn/slife | mcp-plugin/mcp_plugin/os_detect.py | .py | cd6a4e7b61a40229 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.