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 |
|---|---|---|---|---|---|---|
"""Bounded asyncpg worker for ``kestrel doctor``.
Doctor launches this module with the same executable, environment, and working
directory as the agent. The process boundary lets the parent enforce a finite
deadline without changing any asyncpg connection setting.
"""
from __future__ import annotations
import async... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/_doctor_postgres_probe.py | .py | cc2ff30046001783 | 7.48 | 8 |
"""Shared subprocess helpers for the host-side bash-to-Python ports
(epic #1050).
The verify-install / demo-runner / docker-remote / agent-docker CLI
modules all spawn long-running subprocesses (uvicorn, docker run,
playwright test) and need the same three primitives:
- :func:`run_streaming` — ``subprocess.run`` with... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/_subprocess_helpers.py | .py | 80641fdac06b9922 | 7.48 | 8 |
"""Verification-document lookup for signed A2A envelopes.
This module answers one question only: which DID document should the envelope
verifier use for a claimed sender DID? Local hybrid identities are resolved
from the live :class:`AgentManager`; optional ``did:web`` lookup is a
per-recipient policy.
Peer authoriza... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/did_registry.py | .py | 3880b4d12ae8588a | 7.48 | 8 |
"""Recipient-scoped authorization for cryptographically verified A2A senders.
Cryptographic DID verification and recipient authorization are independent
trust decisions. The endpoint first verifies the signed envelope, then calls
this authorizer with the verified sender DID before it marks the sender
verified or creat... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/inbound_authorization.py | .py | d77f525a580d25ca | 7.48 | 8 |
"""Explicit host-attested local A2A submission.
This is intentionally separate from the wire-envelope verifier. A host that
has already authenticated two locally routed tenants can attest that delivery
was authorized without fabricating a DID signature or marking the sender
cryptographically verified. The helper rec... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/local_submission.py | .py | 5e976a8c03063be0 | 7.48 | 8 |
"""Shared replay-nonce reservation for A2A signed envelopes.
The in-process ``ReplayGuard`` in :mod:`kestrel_sovereign.a2a.envelope_signing`
is still useful as a fast path and as a degraded-mode fallback, but it cannot
see replays that land on another worker. This store provides the shared,
atomic reservation keyed by... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/replay_store.py | .py | 241b2251ecdba0d4 | 7.48 | 8 |
"""
Shared utilities for A2A datastores.
"""
import json
from datetime import datetime, timezone
from typing import Any
from uuid import uuid4
def generate_id() -> str:
"""Generate a unique ID for store records."""
return uuid4().hex
def now_utc() -> datetime:
"""Get current UTC timestamp."""
retur... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/stores/base.py | .py | 7092bd3e6a834b7c | 7.48 | 8 |
"""
FeedbackStore - Agent Self-Diagnosis and User Feedback.
This module provides SQLite-backed A2A feedback storage using the unified
backend-agnostic store implementation with SQLiteBackend.
For new code, use the unified store directly:
from kestrel_sovereign.storage.db import SQLiteBackend
from kestrel_sove... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/stores/feedback_store.py | .py | f85ec7607d15ca6e | 7.48 | 8 |
"""
MemoryService - Long-term Searchable Memory.
This module provides SQLite-backed A2A memory storage using the unified
backend-agnostic store implementation with SQLiteBackend.
For new code, use the unified store directly:
from kestrel_sovereign.storage.db import SQLiteBackend
from kestrel_sovereign.a2a.sto... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/stores/memory_service.py | .py | 4b89f9485dc9263f | 7.48 | 8 |
"""
ObservabilityStore - Telemetry, Metrics, and Error Tracking.
This module provides SQLite-backed A2A observability using the unified
backend-agnostic store implementation with SQLiteBackend.
For new code, use the unified store directly:
from kestrel_sovereign.storage.db import SQLiteBackend
from kestrel_so... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/stores/observability_store.py | .py | 0dd4d6b6fb53ad6a | 7.48 | 8 |
"""
OrchestrationStore - Multi-Agent Workflow Coordination.
This module provides SQLite-backed A2A workflow orchestration using the unified
backend-agnostic store implementation with SQLiteBackend.
For new code, use the unified store directly:
from kestrel_sovereign.storage.db import SQLiteBackend
from kestre... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/stores/orchestration_store.py | .py | 2a383802b97f91e7 | 7.48 | 8 |
"""
SessionService - Session State and Event History.
This module provides SQLite-backed A2A session management using the unified
backend-agnostic store implementation with SQLiteBackend.
For new code, use the unified store directly:
from kestrel_sovereign.storage.db import SQLiteBackend
from kestrel_sovereig... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/stores/session_service.py | .py | 59bdce3f47bf65f6 | 7.48 | 8 |
"""
TaskStore - Async Task Persistence.
This module provides SQLite-backed A2A task storage using the unified
backend-agnostic store implementation with SQLiteBackend.
For new code, use the unified store directly:
from kestrel_sovereign.storage.db import SQLiteBackend
from kestrel_sovereign.a2a.stores.unified... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/stores/task_store.py | .py | 678bd83e0f6bf285 | 7.48 | 8 |
"""Per-agent feature / MCP-server **enablement** deltas, persisted in the DB.
Two distinct concerns must not be conflated (see the capability-management
design ruling):
* **Provisioning** — which feature *packages* are installed in the host venv —
stays in config (``.kestrel-host-features.toml`` + ``feature_reconci... | KestrelSovereignAI/kestrel-sovereign | kestrel_sovereign/a2a/stores/unified/feature_enablement_store.py | .py | 0f7bf42c9f24344e | 7.48 | 8 |
"""Kit capability detection.
The console runs on two hardware SKUs in the WarDragon family:
* **Elite** (x86_64, second SDR): runs DragonSig for FPV/RF signal detection.
* **Pro** (ARM/Pi, single SDR): does not run DragonSig.
Rather than probing hardware directly, we key on whether the kit was
provisioned for Dragon... | alphafox02/wardragon-console | src/wardragon_console/capabilities.py | .py | e65df42e023feee8 | 7.45 | 7 |
"""Read/write for the DragonSync kit-id override file.
The file lives adjacent to wardragon_monitor.py at
<dragonsync_dir>/kit-id-override and, when present, wins over the
dmidecode serial. See wardragon_monitor.py for the read side.
"""
from __future__ import annotations
import os
import re
import tempfile
from path... | alphafox02/wardragon-console | src/wardragon_console/kit_id.py | .py | 57941855351d6517 | 7.45 | 7 |
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
DEFAULT_DRAGONSYNC_DIR = Path("/home/dragon/WarDragon/DragonSync")
DEFAULT_DRAGONSCOPE_DIR = Path("/home/dragon/WarDragon/dragonsdr_dji_droneid")
@dataclass(frozen=True)
class Settings:
bind_host: str = "127... | alphafox02/wardragon-console | src/wardragon_console/settings.py | .py | 0278be94c440d4e9 | 7.45 | 7 |
# Copyright (c) 2026 Ahmed Awad (NullC0d3)
# SPDX-License-Identifier: Apache-2.0
"""Alembic migration environment for the HunterX TIDB.
The target metadata is the shared declarative ``Base`` with every legacy and
TIDB model imported, so ``autogenerate`` covers the whole schema. The database
URL comes from ``HUNTERX_D... | nullc0d30/HunterX | alembic/env.py | .py | 50f0277c56965427 | 7.57 | 13 |
"""professional reporting intelligence tables
Revision ID: b2e3f5a7c9d1
Revises: a1f0c2e4b6d8
Create Date: 2026-08-10
Extends the TIDB schema with the Sprint 029 professional finding
intelligence & reporting capability: report metadata, immutable report
versions, data-driven report templates and template versions, cl... | nullc0d30/HunterX | alembic/versions/b2e3f5a7c9d1_professional_reporting_tables.py | .py | 0a45840e8eb7a6e8 | 7.57 | 13 |
# Copyright (c) 2026 Ahmed Awad (NullC0d3)
# SPDX-License-Identifier: Apache-2.0
#
# HunterX — AI-Assisted Vulnerability Hunter
import threading
import uuid
from typing import Dict, Optional, List
from api.models import ScanJob
class JobQueue:
"""In-memory job queue for async scan execution."""
def __init__... | nullc0d30/HunterX | docs/archive/v6/source/api/job_queue.py | .py | 67d12158cd5c5e39 | 7.57 | 13 |
# Copyright (c) 2026 Ahmed Awad (NullC0d3)
# SPDX-License-Identifier: Apache-2.0
#
# HunterX — AI-Assisted Vulnerability Hunter
import threading
import uuid
from typing import Dict, Optional, List
from .models import ScanJob
class JobQueue:
"""In-memory job queue for async scan execution."""
def __init__(se... | nullc0d30/HunterX | docs/archive/v6/source/hunterx/api/job_queue.py | .py | d7a42f6093900d2c | 7.57 | 13 |
# Copyright (c) 2026 Ahmed Awad (NullC0d3)
# SPDX-License-Identifier: Apache-2.0
#
# HunterX — AI-Assisted Vulnerability Hunter
import os
from dataclasses import field, dataclass
from typing import List, Dict, Optional
@dataclass
class AuthConfig:
type: str = "none"
username: Optional[str] = None
password... | nullc0d30/HunterX | docs/archive/v6/source/hunterx/config/config.py | .py | bc2d0095e52ad91f | 7.57 | 13 |
#!/usr/bin/env python
"""Detect which SLURM cluster (if any) this process is running on.
Used by ``submit_job.py``/the model-adding agent to decide which resource
profile to use, without hardcoding any institution-specific hostnames beyond
the generic patterns below (real account/partition/mail details live in
whichev... | ml-lab-htw/RamanBench | cluster/detect_cluster.py | .py | 836f93b113dc0816 | 7.63 | 17 |
#!/usr/bin/env python
"""Aggregate cached v1 per-config results into a combined leaderboard-ready table.
Scans ``{results_dir}/{experiment_name}/{task_name}/{repeat}_{fold}/results.pkl``
caches (as written by ``scripts/run_experiment.py``) and calls TabArena's own
``EndToEnd.from_raw`` once, across every cached result... | ml-lab-htw/RamanBench | scripts/aggregate_results.py | .py | 9b4dd5a69cb22bdd | 7.63 | 17 |
#!/usr/bin/env python
"""Build a target list for a full-benchmark submission, one entry per (dataset, target).
Reads dataset-name lists (JSON arrays of raman_data keys, e.g. the paper repo's
``configs/datasets/{classification,regression}_all.json``), loads each dataset once to
determine its real target names and insta... | ml-lab-htw/RamanBench | scripts/build_target_list.py | .py | 48226045ad649e8d | 7.63 | 17 |
#!/usr/bin/env python
"""Plot per-dataset performance from an aggregated v1 results CSV.
Consumes ``hpo_results.csv`` (written by ``scripts/aggregate_results.py``) and
produces one bar chart per model, showing ``metric_error`` across every
(dataset,target) task -- grouped by default/tuned/tuned+ensemble when more
than... | ml-lab-htw/RamanBench | scripts/plot_v1_results.py | .py | ca57c4eb63359a03 | 7.63 | 17 |
#!/usr/bin/env python
"""Run the RamanBench benchmark pipeline.
This is a thin wrapper around the ``raman-bench run`` CLI command.
It is provided for users who prefer running a script directly over the CLI.
Pipeline steps
--------------
1. **predictions** — train all models on all datasets and save prediction CSVs
2.... | ml-lab-htw/RamanBench | scripts/run_benchmark.py | .py | f9b1a482c51b59e4 | 7.63 | 17 |
"""
RamanBench: A large-scale benchmark for machine learning on Raman spectroscopy data.
74 datasets · 163 prediction targets · 28+ baseline models
Ecosystem
---------
- **raman-data** (datasets):
PyPI: ``pip install raman-data``
Source: https://github.com/ml-lab-htw/raman_data
- **raman-bench** (this package):
... | ml-lab-htw/RamanBench | src/raman_bench/__init__.py | .py | 68dc3f2aba3dd714 | 7.63 | 17 |
"""Command-line interface for RamanBench.
Usage
-----
::
# Run the full benchmark pipeline
raman-bench run --config configs/benchmark_v0.1.json
# Run individual steps
raman-bench run --step predictions
raman-bench run --step metrics
raman-bench run --step plots
# Show the precomputed lea... | ml-lab-htw/RamanBench | src/raman_bench/cli.py | .py | 3f2afa7f514d6346 | 7.63 | 17 |
"""Configuration loading and validation for the benchmark pipeline."""
import json
import os
_ALL_PREPROCESSING_STEPS = {
"crop": True,
"baseline_correction": True,
"airpls": True,
"arpls": True,
"rubberband": True,
"cosmic_ray_removal": True,
"msc": True,
"emsc": True,
"denoising"... | ml-lab-htw/RamanBench | src/raman_bench/config.py | .py | 1c9c1cbc93fe1d17 | 7.63 | 17 |
"""Trivial-dataset filter for RamanBench v1 results.
Flags a (dataset, target) *key* as "trivial" -- carrying little discriminative
signal between models -- using the same two-criterion definition TabArena
(NeurIPS 2025, arXiv:2506.16791) uses to curate which datasets enter its own
benchmark suite. Appendix B.1, "Data... | ml-lab-htw/RamanBench | src/raman_bench/filters.py | .py | 9de7d9bd08012749 | 7.63 | 17 |
"""Classification metrics for RamanBench."""
import warnings
import numpy as np
from sklearn.metrics import (
accuracy_score,
balanced_accuracy_score,
classification_report,
cohen_kappa_score,
confusion_matrix,
f1_score,
log_loss,
matthews_corrcoef,
precision_score,
recall_scor... | ml-lab-htw/RamanBench | src/raman_bench/metrics/classification.py | .py | 28a09bd4000a22a1 | 7.63 | 17 |
"""Regression metrics for RamanBench."""
import numpy as np
from sklearn.metrics import (
explained_variance_score,
max_error,
mean_absolute_error,
mean_squared_error,
median_absolute_error,
r2_score,
)
class RegressionMetrics:
"""Compute regression evaluation metrics."""
def compute... | ml-lab-htw/RamanBench | src/raman_bench/metrics/regression.py | .py | 0c0b784e7e84fbdc | 7.63 | 17 |
"""Utility functions for metrics computation."""
from typing import Any
import numpy as np
from raman_data import TASK_TYPE
from raman_bench.metrics.classification import ClassificationMetrics
from raman_bench.metrics.regression import RegressionMetrics
def compute_metrics(
y_true: np.ndarray,
y_pred: np.n... | ml-lab-htw/RamanBench | src/raman_bench/metrics/utils.py | .py | bbf4137ae966322b | 7.63 | 17 |
"""Per-model metadata bundle for the ``models/custom/<key>/info.py`` convention.
Mirrors upstream TabArena's own per-model ``info.py`` pattern
(``tabarena.models._model_info.ModelInfo``) at the scope RamanBench actually
needs. TabArena's version requires a ``MethodMetadata`` (suite/cache_root/
S3 bucket bookkeeping fo... | ml-lab-htw/RamanBench | src/raman_bench/models/_model_info.py | .py | 249560d1c00b57c8 | 7.63 | 17 |
"""Shared utilities for `benchmarks/bench_*.py` scripts.
Not a benchmark itself — internal support code implementing the
methodology defined in `docs/performance.md`: median of N runs plus
p95, peak/average memory via `tracemalloc`, and a smoke-vs-full size
split so CI can run a fast subset while a scheduled job runs ... | Abolfazlrwm/SecureSync | benchmarks/_common.py | .py | 777e3e17711ba8b8 | 7.42 | 6 |
"""Benchmark: chunking throughput (`StreamingChunkReader` + `FixedSizeChunkingStrategy`).
Run directly:
python -m benchmarks.bench_chunking # smoke set (fast)
python -m benchmarks.bench_chunking --full # full set (slow, thorough)
Or via the whole suite: `python -m benchmarks` (see `benchmarks... | Abolfazlrwm/SecureSync | benchmarks/bench_chunking.py | .py | bc93db1c21213e80 | 7.42 | 6 |
"""Benchmark: SHA-256 hashing throughput (`SHA256HashProvider`).
Run directly:
python -m benchmarks.bench_hashing # smoke set (fast)
python -m benchmarks.bench_hashing --full # full set (slow, thorough)
Or via the whole suite: `python -m benchmarks` (see `benchmarks/__main__.py`).
Methodolog... | Abolfazlrwm/SecureSync | benchmarks/bench_hashing.py | .py | 471593fd41c0acdb | 7.42 | 6 |
"""A basic observer that logs every filesystem event it receives."""
from __future__ import annotations
import structlog
from securesync.domain.events import FileSystemEvent
logger = structlog.get_logger(__name__)
class LoggingFileSystemEventObserver:
"""Observer that logs every filesystem event it receives.
... | Abolfazlrwm/SecureSync | src/securesync/application/observers/logging_observer.py | .py | 32dd5bec7ba2ed5c | 7.42 | 6 |
"""Orchestration layer coordinating all synchronization components."""
from __future__ import annotations
import asyncio
import contextlib
from dataclasses import dataclass
from enum import StrEnum, unique
from pathlib import Path
import structlog
from securesync.application.use_cases.conflict_resolution import Det... | Abolfazlrwm/SecureSync | src/securesync/application/orchestration.py | .py | becc13bad659bae1 | 7.42 | 6 |
"""Use case: compute chunk hashes for a file without retaining chunk bytes."""
from __future__ import annotations
from collections.abc import AsyncIterator, Iterator
from pathlib import Path
import structlog
from securesync.domain.chunk import ChunkCollection, ChunkMetadata
from securesync.domain.chunking import Ch... | Abolfazlrwm/SecureSync | src/securesync/application/use_cases/calculate_chunk_hashes.py | .py | 5be7c5d9a4fa5d26 | 7.42 | 6 |
"""Use case: split a file into fully hashed chunks, streaming throughout."""
from __future__ import annotations
from collections.abc import AsyncIterator, Iterator
from pathlib import Path
import structlog
from securesync.domain.chunk import Chunk
from securesync.domain.chunking import ChunkHasher, ChunkingStrategy... | Abolfazlrwm/SecureSync | src/securesync/application/use_cases/chunk_file.py | .py | d4a2b122c969aeb8 | 7.42 | 6 |
"""Use case: compute a delta plan for a file against its recorded baseline."""
from __future__ import annotations
import asyncio
from pathlib import Path
import structlog
from securesync.application.use_cases.calculate_chunk_hashes import CalculateChunkHashesUseCase
from securesync.domain.chunking import ChunkingSt... | Abolfazlrwm/SecureSync | src/securesync/application/use_cases/compute_delta.py | .py | 5086b36ccc74909a | 7.42 | 6 |
"""Use cases for detecting and resolving synchronization conflicts."""
from __future__ import annotations
import uuid
import structlog
from securesync.domain.conflict import (
ConflictMetadata,
ConflictRepository,
ConflictType,
MergeStrategy,
VersionVector,
)
from securesync.domain.conflict_exce... | Abolfazlrwm/SecureSync | src/securesync/application/use_cases/conflict_resolution.py | .py | ec214c03cef660d2 | 7.42 | 6 |
"""Use case for discovering and tracking peers on the network."""
from __future__ import annotations
import structlog
from securesync.domain.networking import (
DiscoveryService,
Peer,
PeerDiscoveryObserver,
PeerRepository,
PeerStatus,
)
logger = structlog.get_logger()
class DiscoverPeersUseCa... | Abolfazlrwm/SecureSync | src/securesync/application/use_cases/discover_peers.py | .py | c114fa1178e9d5e1 | 7.42 | 6 |
"""Use case: monitor one or more directories for filesystem changes."""
from __future__ import annotations
from types import TracebackType
import structlog
from securesync.domain.watcher import FileSystemEventObserver, FileWatcher
logger = structlog.get_logger(__name__)
class MonitorDirectoriesUseCase:
"""Or... | Abolfazlrwm/SecureSync | src/securesync/application/use_cases/monitor_directories.py | .py | 28bcec712b9cf042 | 7.42 | 6 |
"""Use case: synchronize one file with a peer, in an explicit direction.
Composes every piece built across Phases 3-14 into the first genuine
end-to-end file sync: request the peer's manifest, diff it against
the local one, and transfer whichever chunks are missing.
`push` and `pull` are deliberately separate, explic... | Abolfazlrwm/SecureSync | src/securesync/application/use_cases/sync_file.py | .py | afa8bdafb0c7b10d | 7.42 | 6 |
"""Use cases for transferring chunks between peers."""
from __future__ import annotations
from collections.abc import AsyncIterator, Sequence
import structlog
from securesync.domain.chunk import Chunk
from securesync.domain.networking import Peer
from securesync.domain.transfer import TransferTransport
logger = st... | Abolfazlrwm/SecureSync | src/securesync/application/use_cases/transfer_chunks.py | .py | ec23be6e0020ccb5 | 7.42 | 6 |
"""Use case: verify a chunk's content against its recorded hash."""
from __future__ import annotations
import asyncio
import structlog
from securesync.domain.chunk import Chunk
from securesync.domain.chunk_exceptions import ChunkVerificationError
from securesync.domain.chunking import ChunkHasher
logger = structlo... | Abolfazlrwm/SecureSync | src/securesync/application/use_cases/verify_chunk.py | .py | d380d26636cb4b1b | 7.42 | 6 |
"""Binary wire protocol for SecureSync.
Defines the header layout, packet types, and serialization logic for
peer-to-peer communication.
"""
from __future__ import annotations
import struct
import time
import zlib
from dataclasses import dataclass, replace
from enum import IntEnum, unique
from typing import Any, Fin... | Abolfazlrwm/SecureSync | src/securesync/core/protocol.py | .py | 4011c13842d10c47 | 7.42 | 6 |
"""Domain entities and value objects for content chunking.
Everything in this module is pure Python: no filesystem I/O, no
hashing library import, no third-party dependency. Concrete
infrastructure adapters (a streaming file reader, a ``hashlib``-based
hasher) produce and consume these value objects; the domain itself... | Abolfazlrwm/SecureSync | src/securesync/domain/chunk.py | .py | d9bd2b526724b2a2 | 7.42 | 6 |
"""Domain-level exceptions for the chunk engine.
These exceptions describe failures in terms the domain understands (an
invalid chunk size, a missing chunk source, a hash mismatch) without
any knowledge of the concrete technology (``hashlib``, the OS
filesystem API, etc.) that ultimately raised them. Infrastructure
ad... | Abolfazlrwm/SecureSync | src/securesync/domain/chunk_exceptions.py | .py | 3259dd720c8dc1dc | 7.42 | 6 |
"""Ports (interfaces) for the chunk engine.
This module defines the boundary between the domain and any concrete
chunking, hashing, reading, writing, or persistence technology.
Application code depends only on these abstractions; infrastructure
adapters implement them. Nothing here performs I/O or imports a
hashing li... | Abolfazlrwm/SecureSync | src/securesync/domain/chunking.py | .py | d6bf4163b273e744 | 7.42 | 6 |
"""Domain entities for the configuration system."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import StrEnum, unique
@unique
class RuntimeProfile(StrEnum):
"""Execution profiles for different environments."""
DEVELOPMENT = "development"
TESTING = "testing"
... | Abolfazlrwm/SecureSync | src/securesync/domain/config.py | .py | 91e40ef2d4e779fd | 7.42 | 6 |
"""Domain entities and ports for Conflict Resolution.
This module defines the abstractions for version tracking and conflict
detection/resolution, isolated from concrete storage or network logic.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from ... | Abolfazlrwm/SecureSync | src/securesync/domain/conflict.py | .py | 5975803a284b9fb3 | 7.42 | 6 |
"""Domain-level exceptions for conflict detection and resolution.
These exceptions describe failures in terms the domain understands (a
conflict record that was never saved, or has already been resolved)
without any knowledge of the concrete technology a
:class:`~securesync.domain.conflict.ConflictRepository` implemen... | Abolfazlrwm/SecureSync | src/securesync/domain/conflict_exceptions.py | .py | 72f361d5481b5c4c | 7.42 | 6 |
"""Domain ports for End-to-End Encryption.
Defines the cryptographic contracts for key exchange and AEAD encryption,
following the design in docs/security.md.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Final
KEY_SIZE: Final = 32
NO... | Abolfazlrwm/SecureSync | src/securesync/domain/crypto.py | .py | ea707338e5035c91 | 7.42 | 6 |
"""Domain entities and pure logic for delta synchronization.
Everything in this module is pure Python: no filesystem I/O, no
network code, no third-party dependency. Given two
:class:`~securesync.domain.chunk.ChunkCollection` manifests (a
previously recorded *baseline* and a freshly computed *current* one),
:class:`De... | Abolfazlrwm/SecureSync | src/securesync/domain/delta.py | .py | bd5da051430e3a78 | 7.42 | 6 |
"""Domain-level exceptions for delta synchronization.
These exceptions describe failures in terms the domain understands (an
attempt to diff manifests of two different files, a chunk missing the
hash it needs to be compared) without any knowledge of the concrete
technology that produced the manifests being compared — ... | Abolfazlrwm/SecureSync | src/securesync/domain/delta_exceptions.py | .py | 58033991c2d9e62c | 7.42 | 6 |
"""Domain events describing filesystem changes.
Everything in this module is pure Python: no filesystem I/O, no
third-party dependency (in particular, no ``watchdog`` import). Concrete
infrastructure adapters translate whatever low-level events their
underlying technology produces into instances of :class:`FileSystemE... | Abolfazlrwm/SecureSync | src/securesync/domain/events.py | .py | f03bfdfa485d65ad | 7.42 | 6 |
"""Domain-level exceptions for filesystem monitoring.
These exceptions describe failures in terms the domain understands
(an invalid watch target, an invalid state transition) without any
knowledge of the concrete technology (``watchdog``, the OS notification
API, etc.) that ultimately raised them. Infrastructure adap... | Abolfazlrwm/SecureSync | src/securesync/domain/exceptions.py | .py | e43492b25725206f | 7.42 | 6 |
"""Domain port for establishing a secure per-peer session before transfer.
Sits between peer discovery and chunk transfer: before a chunk can
move to or from a peer, something must have negotiated the session
keys their `TransferTransport` needs. `SessionCoordinator` is that
something, kept behind a port so applicatio... | Abolfazlrwm/SecureSync | src/securesync/domain/handshake.py | .py | 28c13233092bf092 | 7.42 | 6 |
"""Domain port for persistent device identity and signing.
Separate from :mod:`securesync.domain.crypto`'s X25519 key-exchange
port: X25519 keys there are ephemeral, generated fresh per handshake
for forward secrecy, and can't sign anything. `IdentityProvider` is
for a device's *long-term* identity — generated once, p... | Abolfazlrwm/SecureSync | src/securesync/domain/identity.py | .py | 07ece8d276f93ed4 | 7.42 | 6 |
"""Domain-level exceptions for peer identity and trust-on-first-use.
See ``docs/adr/0019-peer-authentication-and-trust-on-first-use.md``
for the trust model these exceptions enforce.
"""
from __future__ import annotations
class IdentityError(Exception):
"""Base class for all domain identity/trust errors."""
c... | Abolfazlrwm/SecureSync | src/securesync/domain/identity_exceptions.py | .py | 093e15d9a96de32a | 7.42 | 6 |
"""Domain port for exchanging chunk manifests with a peer over the network.
Sits alongside :class:`~securesync.domain.transfer.TransferTransport`:
that port only *pushes* chunk bytes (`send_chunk`) — its
`request_chunks` never actually asks the peer for anything, it just
waits for whatever the peer already decided to ... | Abolfazlrwm/SecureSync | src/securesync/domain/manifest_exchange.py | .py | 8d3fab2e6c8d044b | 7.42 | 6 |
"""Domain entities and ports for metadata persistence.
This module defines the schema and repository port for storing file metadata,
peer information, and transfer history in a persistent store.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from d... | Abolfazlrwm/SecureSync | src/securesync/domain/metadata.py | .py | 2a65e576463c9c10 | 7.42 | 6 |
"""Domain port for reconstructing a file from downloaded chunks.
Deliberately separate from :class:`~securesync.domain.chunking.ChunkWriter`:
that port writes a chunk's bytes as its own standalone file (e.g. into
a chunk store), which is the wrong shape for what
:class:`~securesync.application.use_cases.sync_file.Sync... | Abolfazlrwm/SecureSync | src/securesync/domain/reconstruction.py | .py | 552132a80ffb6492 | 7.42 | 6 |
"""Domain service for deciding the sync direction of one file with one peer.
`SyncDirectionResolver` compares the local and remote `VersionVector`
for a single file and returns one of four outcomes:
- ``PUSH`` — the local version is strictly newer than the remote;
push our chunks to the peer.
- ``PULL`` — the remot... | Abolfazlrwm/SecureSync | src/securesync/domain/sync_direction.py | .py | 69d84438d0aefc65 | 7.42 | 6 |
"""Domain ports and entities for the Transfer Engine.
Defines how chunks are transferred between peers, isolating the
transport (TCP/TLS) from the sync logic.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import AsyncIterator
from dataclasses import dataclass
from ty... | Abolfazlrwm/SecureSync | src/securesync/domain/transfer.py | .py | 2308fd4686ea9847 | 7.42 | 6 |
"""Ports (interfaces) for filesystem monitoring.
This module defines the boundary between the domain and any concrete
filesystem-notification technology. It contains two cooperating
abstractions that together implement the Observer pattern:
- :class:`FileWatcher` is the *subject*: a port that infrastructure
adapter... | Abolfazlrwm/SecureSync | src/securesync/domain/watcher.py | .py | eb559d7c8a1338ad | 7.42 | 6 |
"""Filesystem-based implementation of the ``ChunkWriter`` port."""
from __future__ import annotations
from pathlib import Path
import structlog
from securesync.domain.chunk import Chunk
from securesync.domain.chunking import ChunkWriter
from securesync.infrastructure.chunking._atomic_write import atomic_write_bytes... | Abolfazlrwm/SecureSync | src/securesync/infrastructure/chunking/chunk_file_writer.py | .py | 26d16c74428f7903 | 7.42 | 6 |
"""Temporary filesystem-backed implementation of the ``ChunkRepository`` port.
A placeholder until the SQLite-backed metadata store planned for
Phase 8 lands (see ``ROADMAP.md``) — the port stays the same either
way, so callers never need to change when that adapter is swapped in.
Each file's manifest is stored as one... | Abolfazlrwm/SecureSync | src/securesync/infrastructure/chunking/file_chunk_repository.py | .py | a69c39252339fcbc | 7.42 | 6 |
"""Create and own one Modal desktop from native async Python.
Use ``AsyncComputerSandbox.attach(...)`` when another process owns the target.
An attached context detaches on exit and never terminates that remote Sandbox.
"""
from __future__ import annotations
import asyncio
from modal_computer_use import AsyncComput... | ashtonchew/modal-computer-use | examples/async_modal_owner.py | .py | 2de78e41c75996b2 | 7.48 | 8 |
"""Acquire one named Modal desktop from native async Python.
The process owns a Sandbox it creates and only attaches to an existing named
Sandbox. Use ``detach()`` before exit to keep a newly created Sandbox running.
"""
from __future__ import annotations
import asyncio
from modal_computer_use import AsyncComputerS... | ashtonchew/modal-computer-use | examples/async_named_desktop.py | .py | 6400a7d4723626d4 | 7.48 | 8 |
"""Borrow one Modal desktop for a complete stateful deployed Function trajectory.
Replace ``choose_action_with_model`` with an application-owned model call. The
SDK core remains provider-neutral, and this example never logs task text,
typed content, screenshots, endpoints, credentials, or resource identifiers.
The co... | ashtonchew/modal-computer-use | examples/modal_function_session_handoff.py | .py | 250a843e2452a286 | 7.48 | 8 |
"""Compatibility entry point for the application-owned Modal run gateway.
Behavior lives in :mod:`examples.run_gateway`; this module preserves the
original example's imports and Modal executable surface.
"""
from __future__ import annotations
import sys
from pathlib import Path
if __package__:
from .run_gateway... | ashtonchew/modal-computer-use | examples/modal_run_gateway.py | .py | f23c756fc0b0ca19 | 7.48 | 8 |
"""Pin Modal placement near the caller or model loop after measuring regions."""
from __future__ import annotations
from modal_computer_use import ComputerConfig, ComputerSandbox
def computer_config_for_model_loop(*, modal_region: str | None = None) -> ComputerConfig:
return ComputerConfig(
ingress="att... | ashtonchew/modal-computer-use | examples/region_colocation.py | .py | cffbb6ea8200931e | 7.48 | 8 |
"""Application-owned dependency ports for the run gateway."""
from __future__ import annotations
from datetime import datetime, timedelta
from typing import TYPE_CHECKING, Protocol
from fastapi import Request
from .domain import (
AdmissionCommand,
AdmissionResult,
CancelOutcome,
DispatchClaim,
... | ashtonchew/modal-computer-use | examples/run_gateway/ports.py | .py | 190088f233248c52 | 7.48 | 8 |
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# dependencies = ["cairosvg==2.7.1"]
# ///
"""Export a draft's diagrams to PNG, numbered in the order they appear.
The article references SVGs from docs/assets. Publishing surfaces often want
raster images, and they want them in reading order... | ashtonchew/modal-computer-use | scripts/export_article_images.py | .py | dd70e3dfa81c8fb0 | 7.48 | 8 |
"""Custom httpx authentication schemes for Confluent SQL connections.
Today this holds BYOIDC bearer-token auth for the Flink data plane (#100). The interactive-login
OAuth effort will add its own httpx.Auth adapters alongside FlinkBearerAuth here.
"""
from __future__ import annotations
from collections.abc import G... | confluentinc/confluent-sql | src/confluent_sql/auth.py | .py | d175df1bea5c8b3b | 7.42 | 6 |
from enum import Enum
class ExecutionMode(Enum):
"""Controls statement execution and result handling behavior."""
SNAPSHOT = "snapshot"
"""Submit the statement as a snapshot query -- point in time results, bounded result set."""
STREAMING_QUERY = "streaming_query"
"""Submit the statement as a st... | confluentinc/confluent-sql | src/confluent_sql/execution_mode.py | .py | 89137160103a1cfc | 7.42 | 6 |
"""Discoverable, type-checkable enumerations of Flink SQL statement properties.
Statement properties are the `SET` options a statement is submitted with (`spec.properties` on the
wire). Callers can pass raw `str` keys and values, but this module curates the ones worth
discovering: the property *keys* as `Property`, an... | confluentinc/confluent-sql | src/confluent_sql/statement_properties.py | .py | 8a077175c8140f80 | 7.42 | 6 |
"""
Tableflow types, request builders, and response parsers for the Confluent SQL DB-API driver.
These model the Tableflow Topic API (`/tableflow/v1/tableflow-topics`), which adds an Iceberg
or Delta materialization sink to the Kafka topic backing a Flink table. The request-side inputs
(storage specs, config, error-ha... | confluentinc/confluent-sql | src/confluent_sql/tableflow.py | .py | 9dd367b8c2f0ea68 | 7.42 | 6 |
"""Fixtures and setup for all tests."""
import os
from collections.abc import Callable, Generator
from typing import TypeAlias
import pytest
from confluent_sql import Connection, connect
from confluent_sql.connection import DEFAULT_HTTP_TIMEOUT_SECS
def pytest_runtest_setup(item):
"""Ensure that all tests are ... | confluentinc/confluent-sql | tests/conftest.py | .py | b1e7f4a676bbd4e7 | 7.92 | 6 |
"""Integration test pytest configuration and fixtures."""
import getpass
import logging
import os
import re
from collections.abc import Callable, Generator
from datetime import datetime
from pathlib import Path
from typing import Any
import pytest
from dotenv import load_dotenv
import confluent_sql
from confluent_sq... | confluentinc/confluent-sql | tests/integration/conftest.py | .py | 83fd6b4c8d02dcfd | 7.92 | 6 |
"""Integration test for the connector lifecycle: create -> RUNNING -> pause/resume -> delete,
end to end.
Runs only when a connector-capable configuration is present in the environment. Uses a managed
**Datagen source** connector -- free, self-contained, and needing no external system to stand up.
"Green" here is a he... | confluentinc/confluent-sql | tests/integration/test_connector.py | .py | 3a1ecde79ce2755e | 7.92 | 6 |
"""Integration test for the Tableflow lifecycle: enable -> insert -> disable, end to end.
Runs only when a Tableflow-capable configuration is present in the environment. "Green" here is a
health check (phase RUNNING with no failing formats), not a materialization read-back: confirming
rows landed in the Iceberg/Delta ... | confluentinc/confluent-sql | tests/integration/test_tableflow.py | .py | dfbe9fbc2733df8e | 7.92 | 6 |
"""Pytest configuration + fixtures for unit tests."""
from __future__ import annotations
import types
from collections.abc import Callable
from typing import Any, TypeAlias
import pytest
from confluent_sql import Connection, Cursor
from confluent_sql.connection import RowTypeRegistry
from confluent_sql.statement im... | confluentinc/confluent-sql | tests/unit/conftest.py | .py | 2be930badf81c2f2 | 7.92 | 6 |
import httpx
import pytest
from confluent_sql.auth import FlinkBearerAuth
pytestmark = pytest.mark.unit
def test_auth_flow_stamps_bearer_and_identity_pool_headers():
"""FlinkBearerAuth stamps both the Bearer token and the identity-pool id on every request."""
auth = FlinkBearerAuth(bearer_token="tok-abc", i... | confluentinc/confluent-sql | tests/unit/test_auth_unit.py | .py | 1463b16922948140 | 7.92 | 6 |
"""Unit tests for BYOIDC bearer-token authentication (#100).
BYOIDC lets a caller authenticate to the Flink data plane with a bearer token minted by their own
OAuth/OIDC identity provider plus a Confluent-Identity-Pool-Id, in place of API key + secret. It
reaches Flink only; every control-plane surface fails closed (s... | confluentinc/confluent-sql | tests/unit/test_connection_byoidc_unit.py | .py | 1d8e94545d7ccdfc | 7.92 | 6 |
"""Unit tests for the network-free connector types, payload builder, and response parsers."""
from __future__ import annotations
import re
import pytest
from confluent_sql.connectors import (
Connector,
ConnectorSpec,
ConnectorState,
ConnectorStatus,
TaskStatus,
build_create_payload,
)
from ... | confluentinc/confluent-sql | tests/unit/test_connectors_unit.py | .py | 6f4a6c7dba44dba5 | 7.92 | 6 |
import pytest
from confluent_sql import polling
from confluent_sql.polling import sleep_with_backoff
class _FakeClock:
"""A monotonic clock that only advances when sleep() is called, so backoff pacing can be
exercised deterministically without real time passing."""
def __init__(self) -> None:
se... | confluentinc/confluent-sql | tests/unit/test_polling_unit.py | .py | 5418e9b38f9c0cb3 | 7.92 | 6 |
"""Unit tests for the statement_properties enumerations (Issue #162)."""
import json
import re
from datetime import timedelta
import pytest
import confluent_sql
from confluent_sql import InterfaceError
from confluent_sql.statement_properties import (
DRIVER_OWNED_PROPERTIES,
Property,
PropertyValue,
... | confluentinc/confluent-sql | tests/unit/test_statement_properties_unit.py | .py | f35441ef1a3996e3 | 7.92 | 6 |
"""Regression tests for AS-ORCH-FIX BOM tolerance.
Closes F-RUN-ASSESSMENT-ORCH-BOM-01: Windows PowerShell 5.x collectors
emit JSON files with a UTF-8 BOM (EF BB BF prefix). The Python engine
loaders previously used encoding="utf-8" which raises UnicodeDecodeError
on BOM-prefixed input. Switched to encoding="utf-8-sig... | judeper/FSI-AgentGov | assessment/tests/test_bom_tolerance.py | .py | 4753643e4ef2f892 | 7.98 | 8 |
"""Tests for ``scripts/hooks/copy_assessment_data.py``.
The mkdocs hook publishes the manifest to ``site/assessment/data/controls.json``.
Manifest ``TODO:`` authoring placeholders must be stripped before the file
reaches the customer-facing SPA (finding U-022).
"""
from __future__ import annotations
import importlib.... | judeper/FSI-AgentGov | assessment/tests/test_copy_assessment_data_hook.py | .py | 02e162da93f45e41 | 7.98 | 8 |
"""MkDocs build-SHA cache-bust hook.
Computes a build SHA at build time and:
* Writes ``<docs_dir>/version.json`` with the framework version (read
from the repo-root ``VERSION`` file), the build SHA, and an ISO
timestamp so deployment smoke tests can poll the live site for the
deployed SHA *and* downstre... | judeper/FSI-AgentGov | overrides/hooks/cache_bust.py | .py | a10ce8c9115e6425 | 7.48 | 8 |
#!/usr/bin/env python3
"""
Audit script to check control file metadata and footers.
Checks for:
- Required metadata fields (Control ID, Pillar, Regulatory Reference)
- Footer format and version
- Roles & Responsibilities section
"""
import re
from pathlib import Path
def audit_control_file(filepath):
"""Audit a ... | judeper/FSI-AgentGov | scripts/audit_control_metadata.py | .py | 40b9dbd69da56989 | 7.48 | 8 |
#!/usr/bin/env python3
"""Advance deferred Learn Monitor baselines after autodoc issues close.
A pending Learn change is only "terminal" (safe to advance + delete) when an ``autodoc``
issue that was closed **as COMPLETED** carries the change's EXACT identity. Identity is the
``(source url, content hash)`` pair, matche... | judeper/FSI-AgentGov | scripts/autodoc_advance.py | .py | 270af4d668524e70 | 7.48 | 8 |
#!/usr/bin/env python3
"""Stage 2 auto-merge unlock gate + agreement ledger for autodoc *redirect* PRs.
(Distinct from ``autodoc_canary.py``, which is the deterministic poison-pill guard.)
Redirect auto-merge stays OFF until there is evidence that the unattended redirect
pipeline agrees with human judgement. This mod... | judeper/FSI-AgentGov | scripts/autodoc_automerge.py | .py | 0c7ba098016a146b | 7.48 | 8 |
#!/usr/bin/env python3
"""Independent cross-model faithfulness reviewer for autonomous documentation edits.
This is the second half of the autodoc verification gate. The drafter authors a doc
edit with one GitHub Copilot model family; this reviewer re-checks the edit with a
**different** Copilot model family (passed v... | judeper/FSI-AgentGov | scripts/autodoc_cli_review.py | .py | 2915305b516e74cd | 7.48 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.