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 |
|---|---|---|---|---|---|---|
from __future__ import annotations
import hashlib
import json
import logging
import time
from datetime import UTC, datetime
from typing import Any
from homeassistant.components import media_source, mqtt
from homeassistant.components.media_player import (
MediaPlayerDeviceClass,
MediaPlayerEntity,
MediaPla... | v1k70rk4/HASS.Agent.NET10-Integration | custom_components/hass_agent/media_player.py | .py | 0c36ebc35559e554 | 7.42 | 6 |
"""Notify platform for HASS.Agent."""
from __future__ import annotations
import json
import logging
from typing import Any
from aiohttp import ClientError, ClientTimeout
from homeassistant.components import mqtt
from homeassistant.components.notify import NotifyEntity
from homeassistant.config_entries import ConfigE... | v1k70rk4/HASS.Agent.NET10-Integration | custom_components/hass_agent/notify.py | .py | b47ac60387117db7 | 7.42 | 6 |
"""Repairs platform for HASS.Agent."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.components.repairs import RepairsFlow
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResult
from .const import CONF_DEVICE_NAME
class RestartRequiredFixF... | v1k70rk4/HASS.Agent.NET10-Integration | custom_components/hass_agent/repairs.py | .py | 3ba368a1f970742d | 7.42 | 6 |
# Copyright 2026 IBM Corporation
#
# 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 writi... | IBM/qradar-mcp | auth_context.py | .py | 0738da4390dcf693 | 7.42 | 6 |
# Copyright 2026 IBM Corporation
#
# 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 writi... | IBM/qradar-mcp | client/qradar_rest_client.py | .py | 545821e91836f8de | 7.42 | 6 |
# Copyright 2026 IBM Corporation
#
# 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 writi... | IBM/qradar-mcp | resources/api_query_syntax.py | .py | 54d4885c4f8bfa64 | 7.42 | 6 |
# Copyright 2026 IBM Corporation
#
# 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 writi... | IBM/qradar-mcp | resources/aql_functions.py | .py | d08392749545202f | 7.42 | 6 |
# Copyright 2026 IBM Corporation
#
# 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 writi... | IBM/qradar-mcp | resources/aql_guide.py | .py | 0a61e7838fab5ef8 | 7.42 | 6 |
# Copyright 2026 IBM Corporation
#
# 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 writi... | IBM/qradar-mcp | resources/base.py | .py | f4933ca615c47788 | 7.42 | 6 |
# Copyright 2026 IBM Corporation
#
# 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 writi... | IBM/qradar-mcp | tests/client/qradar_rest_client/test_config.py | .py | cf6b344a730d8be2 | 7.92 | 6 |
# Copyright 2026 IBM Corporation
#
# 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 writi... | IBM/qradar-mcp | tests/conftest.py | .py | a7a2608f52f404d0 | 7.92 | 6 |
"""
Tests for MCP Resource base class
"""
import pytest
from qradar_mcp.resources.base import MCPResource
class ConcreteResource(MCPResource):
"""Concrete implementation for testing."""
@property
def uri(self) -> str:
return "qradar://test/resource"
@property
def name(self) -> str:
... | IBM/qradar-mcp | tests/resources/test_base.py | .py | ef9f3cabd799b5fc | 7.92 | 6 |
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Optional
import torch
from transformers.cache_utils import Cache
@dataclass
class _DecodeWorkspace:
# Stage1 workspace: [B,H,S] float32 (S = max_splits)
M: torch.Tensor
L: torch.Tensor
# Rank accumulator: [... | Zishan-Shao/FlashSVD | runtime/cache/attn_legacy_sparse_kv.py | .py | 2e14f0fde9dca2a7 | 7.65 | 19 |
"""Long-horizon coherence test for Surreal-Memory.
Simulates 5 sessions across 30 days:
1. Day 1: encode initial memories, query
2. Day 3: encode more, query day 1
3. Day 7: encode more, query days 1+3
4. Day 14: run consolidation, query all
5. Day 30: test long-term retention
Target: > 60% recall accuracy at day 30.... | acidkill/surreal-memory | benchmarks/coherence_test.py | .py | cfc542dd3bde7d84 | 7.95 | 7 |
"""Standard IR evaluation metrics for Surreal-Memory benchmarks.
Implements:
- Precision@K: How many top-K results are relevant
- Recall@K: How many relevant results found in top-K
- MRR (Mean Reciprocal Rank): How quickly the first relevant result appears
- NDCG@K (Normalized Discounted Cumulative Gain): Overall rank... | acidkill/surreal-memory | benchmarks/metrics.py | .py | 09e41437f2eb740a | 7.45 | 7 |
"""Naive keyword-overlap baseline for benchmark comparison.
This is the strawman that Surreal-Memory's activation-based recall must beat.
Simple approach: tokenize query, count shared words with each memory, rank by overlap.
"""
from __future__ import annotations
import re
from dataclasses import dataclass
# Common... | acidkill/surreal-memory | benchmarks/naive_baseline.py | .py | 6860a986dcfc132a | 7.45 | 7 |
"""Retrieval-trace overhead benchmark (U4).
Measures the cost of building + persisting a RetrievalTrace so the telemetry
path can be shown to be negligible relative to a recall. Run manually:
.venv/bin/python benchmarks/trace_overhead.py
The automated guarantee that tracing is a *true no-op when disabled* lives ... | acidkill/surreal-memory | benchmarks/trace_overhead.py | .py | 1354cb0978cd7fba | 7.45 | 7 |
"""
Chatbot memory example for Surreal-Memory.
This example demonstrates how to use Surreal-Memory
to give a chatbot persistent memory across conversations.
"""
import asyncio
from datetime import datetime
from typing import Any
from surreal_memory.core.brain import Brain, BrainConfig
from surreal_memory.engine.enco... | acidkill/surreal-memory | examples/chatbot_memory.py | .py | 23162303cf380c80 | 7.45 | 7 |
"""
Tests for package_plugin.py — PCM zip layout, metadata, and template resolution.
Running tests rebuilds the plugin zip under ``dist/``.
"""
import json
import os
import sys
import unittest
import zipfile
import tempfile
import shutil
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")... | alphaseneca/kiforge | tests/test_package.py | .py | bbe0792750a4f018 | 7.98 | 8 |
"""
GUI tests for KiForge Studio (wx dialog and CD sync).
Opt in with ``KIFORGE_RUN_GUI_TESTS=1`` — requires a display and wxPython.
"""
import unittest
import sys
import os
import tempfile
import json
import shutil
# Add root directory to sys.path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.... | alphaseneca/kiforge | tests/test_studio.py | .py | a1e61e0a5d8bc931 | 7.98 | 8 |
#!/usr/bin/env python3
"""Build per-skill BUNDLE.md files for on-the-fly skill loading over MCP.
`cekura_load_skill` (Cekura MCP server) can only hand the model a single file.
Fetching SKILL.md alone omits the reference files that carry the full authoring
rules, so a loaded-not-installed session is weaker than a real ... | cekura-ai/cekura-skills | cekura/scripts/build_bundles.py | .py | 745bc2c546f0029c | 7.42 | 6 |
#!/usr/bin/env python3
"""Validate marketplace-eligibility invariants. Safe to run locally or from CI.
1. every cekura/skills/*/SKILL.md has spec-compliant frontmatter: name
matches its directory, description present and <= 1024 chars, body
<= 500 lines, no `cekura-internal:*` references
2. version decla... | cekura-ai/cekura-skills | cekura/scripts/validate_skills.py | .py | c2665e23e5821327 | 7.42 | 6 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/app_utils/a2a.py | .py | 42692e8db86a6058 | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/app_utils/reasoning_engine_adapter.py | .py | 671fdd865f0079a4 | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/app_utils/services.py | .py | d720b90175bd07da | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/app_utils/telemetry.py | .py | ec709a307fa3ccca | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/core/batch.py | .py | b88ec3d4a22a2f91 | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/core/config.py | .py | 13b0cdd3eab02d06 | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/core/download.py | .py | b4a0ae41c7657767 | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/core/hardware.py | .py | 30b6b4728439121e | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/fast_api_app.py | .py | 61a71ba9fa50b006 | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/models/af2/config.py | .py | 9dfc98913883b941 | 7.63 | 17 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/models/af2/pipeline/pipelines/alphafold_inference_pipeline.py | .py | a1af571b64f76823 | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/models/af2/startup.py | .py | bca26855c9b2b95f | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/models/af2/tools/analyze.py | .py | 1e25b1154f3a0872 | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/models/af2/tools/check_database_download.py | .py | 88156dde9c65dee5 | 7.63 | 17 |
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/LifeSciences | applications/foldrun/foldrun-agent/foldrun_app/models/af2/tools/check_gpu_quota.py | .py | 77c59540441ccbbe | 7.63 | 17 |
#!/usr/bin/env python
"""Throughput benchmarks for layup.
Produces the "how fast is it" numbers (rows/s for ``convert``, fits/s for orbit
fitting) on synthetic data, for the paper and for spotting regressions.
Usage::
python benchmarks/run_benchmarks.py # default sizes, pretty table
python be... | Smithsonian/layup | benchmarks/run_benchmarks.py | .py | b5f08631cf5740e6 | 7.52 | 10 |
import logging
import os
from pathlib import Path
from typing import Literal
import numpy as np
import pandas as pd
import rebound, assist
from sorcha.ephemeris.simulation_setup import create_assist_ephemeris, generate_simulations
from layup.convert import get_output_column_names_and_types, convert
from layup.utilitie... | Smithsonian/layup | src/layup/comet.py | .py | 098d8287bd7f6292 | 7.52 | 10 |
import numpy as np
import logging
from pathlib import Path
from layup.utilities.data_processing_utilities import parse_fit_result
from layup.utilities.file_io import CSVDataReader, HDF5DataReader
from layup.utilities.file_io.file_output import write_csv, write_hdf5
logger = logging.getLogger(__name__)
# Columns whi... | Smithsonian/layup | src/layup/unpack.py | .py | 599ea0428c47e775 | 7.52 | 10 |
import os
import pooch
from layup.utilities.layup_configs import AuxiliaryConfigs
"""
An example output from running `build_meta_kernel_file` might look like
the following:
\begindata
PATH_VALUES = ('/Users/scientist/layup/data_files/assist_and_rebound')
PATH_SYMBOLS = ('A')
KERNELS_TO_LOA... | Smithsonian/layup | src/layup/utilities/bootstrap_utilties/create_meta_kernel.py | .py | 1f17f037ab5d4795 | 7.52 | 10 |
from argparse import Namespace
import concurrent.futures
import os
import pooch
from typing import Optional
from layup.utilities.layup_configs import AuxiliaryConfigs
from layup.utilities.bootstrap_utilties.create_meta_kernel import build_meta_kernel_file
from layup.utilities.cache_location import default_cache_dir
# ... | Smithsonian/layup | src/layup/utilities/bootstrap_utilties/download_utilities.py | .py | 305634921a43e4ff | 7.52 | 10 |
import os
from pathlib import Path
def get_config_setups_filepath(filename):
"""Return the full path to a test file in the ``.../config_setups`` directory.
Parameters
----------
filename : string
The name of the file inside the ``config_setups`` directory.
Returns
-------
: strin... | Smithsonian/layup | src/layup/utilities/data_utilities_for_tests.py | .py | 1435ff663adab8c1 | 7.02 | 10 |
from itertools import product
from pathlib import Path
import numpy as np
import healpy as hp
import pandas as pd
from layup.utilities.cache_location import default_cache_dir
# From Siegfried Eggl's code
MPC_CATALOGS = {
"USNOA1": "a",
"USNOSA1": "b",
"USNOA2": "c",
"USNOSA2": "d",
"UCAC1": "e",
... | Smithsonian/layup | src/layup/utilities/debiasing.py | .py | 2673efcb7e06d715 | 7.52 | 10 |
"""Reader for MPC ADES observation files in XML form (issue #44).
ADES XML wraps each observation in an ``<optical>`` (or ``<radar>``) element
whose child tags are the ADES field names -- the same fields the CSV/PSV reader
consumes, e.g. ``provID``, ``stn``, ``obsTime``, ``ra``, ``dec``, ``mag``.
Both the "flat" form ... | Smithsonian/layup | src/layup/utilities/file_io/ADESXMLReader.py | .py | 2cc1934115a829c8 | 7.52 | 10 |
import logging
import sys
import numpy as np
import pandas as pd
from layup.utilities.file_io.ObjectDataReader import ObjectDataReader
# Characters we remove from column names.
_INVALID_COL_CHARS = "!#$%&‘()*+, ./:;<=>?@[\\]^{|}~"
# Note that the separators (aside from whitespace) are all single characters. This
# ... | Smithsonian/layup | src/layup/utilities/file_io/CSVReader.py | .py | 6f4c79acad8b30c2 | 7.52 | 10 |
import logging
import pandas as pd
import numpy as np
from layup.utilities.file_io.ObjectDataReader import ObjectDataReader
class HDF5DataReader(ObjectDataReader):
"""A class to read in object data files stored as HDF5 files."""
def __init__(self, filename, **kwargs):
"""A class for reading the objec... | Smithsonian/layup | src/layup/utilities/file_io/HDF5Reader.py | .py | eb0a0baff7ecab96 | 7.52 | 10 |
"""Base class for reading object-related data from a variety of sources
and returning a numpy structured array.
Each subclass of ObjectDataReader must implement at least the functions
_read_rows_internal and _read_objects_internal, both of which return a
numpy structured array. Each data source needs to have a column ... | Smithsonian/layup | src/layup/utilities/file_io/ObjectDataReader.py | .py | db83dec4aec4a761 | 7.52 | 10 |
"""Utility functions for writing data from our internal representation of numpy structured arrays to output files."""
import logging
import os
import pandas as pd
def write_csv(data, filepath, move_columns=None):
"""Write a numpy structured array to a CSV file.
Parameters
----------
data : numpy str... | Smithsonian/layup | src/layup/utilities/file_io/file_output.py | .py | d80654b4170e0f87 | 7.52 | 10 |
from dataclasses import dataclass, field
import configparser
import sys
@dataclass
class AuxiliaryConfigs:
"""Data class for holding auxiliary section configuration file keys and validating them."""
naif_base_url = "https://naif.jpl.nasa.gov/pub/naif/generic_kernels"
ssd_base_url = "https://ssd.jpl.nasa.... | Smithsonian/layup | src/layup/utilities/layup_configs.py | .py | bc23f799717d6188 | 7.52 | 10 |
import logging
import sys
from datetime import datetime
from pathlib import Path
class LayupLogger:
"""This logger configures the root-level logger for Layup to emit messages
to potentially three locations 1) STDERR 2) layup-<datetime>.log and
3) layup-<datetime>.err depending on the log level. See the `... | Smithsonian/layup | src/layup/utilities/layup_logging.py | .py | cf19e27303699dde | 7.52 | 10 |
"""Resolve space-based ("special case") MPC observatory codes via JPL Horizons.
A handful of MPC observatory codes denote *spacecraft* rather than fixed ground
stations (issue #55). They have no parallax constants, so layup cannot compute
their position geometrically, and -- unlike a roving ground observer -- the user... | Smithsonian/layup | src/layup/utilities/special_observatories.py | .py | ef01e267e4c0817a | 8.02 | 10 |
from argparse import ArgumentParser
# Originally a class in Sorcha (/src/sorcha_cmdline/sorchaargumentparser.py ) called SorchaArgumentParser
class LayupArgumentParser(ArgumentParser):
"""A subclass of the argparse.ArgumentParser that adds in a print statement
to make it clearer how to get detailed help for ... | Smithsonian/layup | src/layup_cmdline/layupargumentparser.py | .py | 433f981d1366ac0b | 7.52 | 10 |
import argparse
import subprocess
import sys
import shutil
import os
#
# Generic verb dispatcher code
#
def find_layup_verbs():
"""Find available layup commands in the system's PATH."""
layup_verbs = []
for directory in os.environ.get("PATH", "").split(os.pathsep):
if os.path.isdir(directory):
... | Smithsonian/layup | src/layup_cmdline/main.py | .py | 82c1dc7ff4b84edc | 7.52 | 10 |
#
# The `layup predict` subcommand implementation
#
import argparse
import logging
from datetime import datetime, timezone
from pathlib import Path
import astropy.units as u
from layup_cmdline.layupargumentparser import LayupArgumentParser
from layup.utilities.cache_location import default_cache_dir
logger = logging... | Smithsonian/layup | src/layup_cmdline/predict.py | .py | 3a917e2970fca870 | 7.52 | 10 |
"""CLI entrypoint that applies the five PR label axes: type, size, status, area, stacked.
::
ok: --dry-run -> prints the label diff, calls no API
ok: (no --dry-run) -> prints the diff, then applies it
Pure derivation lives in `pr_labeler_derivation.py`; the GitHub API transport
lives in `pr_... | jl-cmd/claude-dev-env | .github/ci/pr_labeler.py | .py | 4c7de1c91c3d0528 | 7.42 | 6 |
"""Validate workflow-generated plan packets."""
from __future__ import annotations
import argparse
import json
import re
import sys
from pathlib import Path
from anthropic_plan_scripts_constants.validate_packet_constants import (
ALL_REQUIRED_RELATIVE_PATHS,
EXIT_CODE_VALIDATION_FAILED,
MARKDOWN_FILE_SUF... | jl-cmd/claude-dev-env | packages/claude-dev-env/.agents/skills-archived/anthropic-plan/scripts/validate_packet.py | .py | e3e003715660ffd3 | 7.42 | 6 |
"""Probe one detector inside code_rules_enforcer.py against a fixture file.
Loads ~/.claude/hooks/blocking/code_rules_enforcer.py dynamically and invokes
the requested check function (e.g. check_collection_prefix, check_library_print)
against the contents of a target fixture file. Prints the returned issue list.
Used... | jl-cmd/claude-dev-env | packages/claude-dev-env/.agents/skills-archived/bugteam/scripts/probe_code_rules_enforcer_check.py | .py | c17af43b39d7a890 | 7.42 | 6 |
"""Recursively remove a directory tree, stripping Windows ReadOnly attributes.
Required by ~/.claude/rules/windows-filesystem-safe.md so bugteam teardown does
not silently swallow Windows ReadOnly-attribute failures the way the unsafe
shutil ignore-errors flag does.
Usage:
python windows_safe_rmtree.py <absolute-... | jl-cmd/claude-dev-env | packages/claude-dev-env/.agents/skills-archived/bugteam/scripts/windows_safe_rmtree.py | .py | b13c582994c74135 | 7.42 | 6 |
"""Classify Codex run streams into down-detail and gate outcome classes.
::
classification = classify_codex_run(exit_code=1, stream_text=stderr_text)
classification.detail_class # usage_limit | auth_failure | ...
classification.outcome_class # codex_down | completed
"""
from __future__ import annotati... | jl-cmd/claude-dev-env | packages/claude-dev-env/.agents/skills-archived/codex-review/scripts/codex_down_classifier.py | .py | ee67c322cbd04cb7 | 7.42 | 6 |
"""Publish one ntfy notification for the Copilot gate.
::
run: notify_ntfy.py --title "PR 743" --message "..." --click-url "https://r"
ok: topic set -> POST to {server}/{topic}, exit 0
flag: topic unset -> readable error on stderr, exit 1
The topic and the optional server override both read from the... | jl-cmd/claude-dev-env | packages/claude-dev-env/.agents/skills-archived/copilot-finding-triage/scripts/notify_ntfy.py | .py | 22ab89446b3e6873 | 7.42 | 6 |
"""
Session-level test-DB setup that pytest.ini's `--no-migrations` skips.
`--no-migrations` builds the test database by reflecting current Django
model state, not by replaying migration files. That's fast, but it silently
skips any migration whose effect isn't representable in model state —
specifically:
- `pg_trgm`... | healthkey-ai/promop | conftest.py | .py | 763ab23fd5ca63ff | 7 | 9 |
"""Small FHIR -> OMOP CRUD walkthrough.
This intentionally mirrors the *shape* of the production FHIR importer, not
its batching and vocabulary-resolution machinery. Run against a disposable
organization and a service token. Every clinical write goes to an OMOP
endpoint; PatientRecord is refreshed by the API's signa... | healthkey-ai/promop | docs/examples/fhir_omop_crud.py | .py | 2b28e1d210c56f11 | 7.5 | 9 |
import "@testing-library/jest-dom/vitest";
// jsdom implements neither the Pointer Capture API nor scrollIntoView, both of
// which Radix primitives call unconditionally while opening a popover. Without
// these an interaction test against any Radix Select/Dropdown dies with
// "target.hasPointerCapture is not a funct... | healthkey-ai/promop | frontend/src/test/setup.ts | .ts | 54184a186da5d396 | 7 | 9 |
from __future__ import annotations
import asyncio
from collections.abc import Callable
from dataclasses import dataclass
from typing import Dict
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions impo... | tabascoz/hass-neakasa | custom_components/neakasa/__init__.py | .py | b4ed1e9e245c8830 | 7.57 | 13 |
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorStateClass,
)
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.const import (
STATE_ON,
STATE_OFF,
)
from homeassistant.config_entries import ConfigEntry
f... | tabascoz/hass-neakasa | custom_components/neakasa/binary_sensor.py | .py | 8529ec968a56038f | 7.57 | 13 |
from dataclasses import dataclass, field
from datetime import timedelta
import logging
from typing import Optional, Any, Awaitable, Callable
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_DEVICE_ID,
CONF_FRIENDLY_NAME,
CONF_USERNAME,
CONF_PASSWORD,
)
from ho... | tabascoz/hass-neakasa | custom_components/neakasa/coordinator.py | .py | b5a9002457b221d0 | 7.57 | 13 |
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorStateClass,
)
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.const import (
STATE_ON,
STATE_OFF,
)
from homeassistant.config_entries import ConfigEntry
f... | tabascoz/hass-neakasa | custom_components/neakasa/switch.py | .py | fc3cfe24e7355df4 | 7.57 | 13 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Fail-closed SmartCMP Provider bridge and projections for embedded page context."""
from __future__ import annotations
import re
import uuid
from types import TracebackType
from typing import Any, Protocol
from _atlascl... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/assistant_context/resolvers/_context_resolver_common.py | .py | bb3e6c7a2f2016ae | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Side-effect-free object actions for SmartCMP alarm alerts."""
from __future__ import annotations
from typing import Any, Mapping
from _object_actions_common import build_object_prompt_action
from smartcmp_provider.doma... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/alarm/scripts/_alarm_object_actions.py | .py | 1133f75318136689 | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Dynamic object actions owned by the SmartCMP approval Domain Skill."""
from __future__ import annotations
from typing import Any
from urllib.parse import quote, urlencode
from _object_actions_common import (
build_... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/approval/scripts/_approval_object_actions.py | .py | 3baaeb4bd44ee782 | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Side-effect-free object actions for SmartCMP cost recommendations."""
from __future__ import annotations
import json
from typing import Any, Mapping
from _object_actions_common import build_object_prompt_action
from sm... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/cost-optimization/scripts/_cost_object_actions.py | .py | 82b7c373b98f7e26 | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Object metadata and actions owned by the SmartCMP request Domain Skill."""
from __future__ import annotations
from typing import Any
from urllib.parse import quote
from _object_actions_common import (
build_object_... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/request/scripts/_request_object_actions.py | .py | 063be238eb4d9ca2 | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Dynamic object actions owned by the SmartCMP resource Domain Skill."""
from __future__ import annotations
import json
from typing import Any
from _object_actions_common import (
build_object_open_action,
build_... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/resource/scripts/_resource_object_actions.py | .py | b2239200c9897214 | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Read the saved script bound to the current SmartCMP page Context."""
from __future__ import annotations
import json
import os
import re
import sys
from typing import Any
try:
from pydantic_ai import RunContext
exc... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/script-designer/scripts/read_current_script.py | .py | c239b8b9fa5c474a | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Side-effect-free object actions for SmartCMP Security violations."""
from __future__ import annotations
import json
import re
from typing import Any, Mapping
from _object_actions_common import build_object_prompt_actio... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/security-compliance/scripts/_security_object_actions.py | .py | ac1a00ca232f2e9a | 7.6 | 15 |
"""AtlasClaw-only request and result helpers for SmartCMP Skill adapters.
This module is deliberately outside :mod:`smartcmp_provider`: it translates
AtlasClaw ``RunContext`` state and user-facing Tool results, while the Provider
implementation remains independent of AtlasClaw and MCP.
"""
from __future__ import anno... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/shared/scripts/_atlasclaw_adapter.py | .py | 66685fc0e4b01107 | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Adapt AtlasClaw page Context to SmartCMP Provider object reads."""
from __future__ import annotations
from typing import Any
from _provider_bootstrap import load_provider
from _atlasclaw_adapter import (
AtlasClawA... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/shared/scripts/_current_page_object.py | .py | 87c41fcb103377fe | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Side-effect-free helpers for SmartCMP object-action builders.
Domain action builders and the page Context resolver both import this module.
It must remain free of Provider configuration, authentication, and network
initi... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/shared/scripts/_object_actions_common.py | .py | 648430f3653ea1e4 | 7.6 | 15 |
"""Load the co-located SmartCMP Provider for AtlasClaw Skill handlers."""
from __future__ import annotations
import importlib
import sys
from pathlib import Path
from types import ModuleType
_PROVIDER_ROOT = Path(__file__).resolve().parents[3]
_PROVIDER_SRC = _PROVIDER_ROOT / "src"
def _is_colocated_module(module:... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/skills/shared/scripts/_provider_bootstrap.py | .py | fc3a64b0a888ecac | 7.6 | 15 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Build reusable SmartCMP resource compliance evidence and analysis contracts."""
from __future__ import annotations
from typing import Any
GENERIC_ANALYSIS_TARGET = "llm:generic_cloud_resource"
... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/analysis/compliance.py | .py | 1bea866dcf1a3775 | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Analyze SmartCMP requests before an approval decision."""
from __future__ import annotations
import re
from typing import Any
PREAPPROVAL_HEADINGS = (
"# Pre Approval Instructions",
"# Preapproval Instruction... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/analysis/preapproval.py | .py | 246141ec41fabb76 | 7.6 | 15 |
"""Keep authentication input and resolved secrets outside execution context.
Both AtlasClaw and MCP use these Provider-owned contracts. An adapter may supply
a cookie, webhook token, configured reference, or future OAuth context, but only
Provider resolution converts it into SmartCMP request headers.
"""
from __futur... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/auth/models.py | .py | 7014dffcc86657c3 | 7.6 | 15 |
"""Request-scoped caller and execution context contracts."""
from __future__ import annotations
from dataclasses import dataclass, field
from datetime import datetime
from typing import Literal
from smartcmp_provider.instance import SmartCmpInstance
ActorType = Literal["user", "robot"]
@dataclass(frozen=True, slo... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/context.py | .py | e73623f071d26f62 | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Shared helpers for SmartCMP alarm retrieval, analysis, and operations."""
from __future__ import annotations
import time
from typing import Any, Dict, Iterable, List, Mapping
from smartcmp_provider.domain.object_opera... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/domain/alarms.py | .py | d16680b299e4ffbc | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Build normalized SmartCMP pending approval context."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime, timezone
from typing import Any
from smartcmp_provider.domain.... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/domain/approval_context.py | .py | 14655e3278d4b84f | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Validate SmartCMP approval action identifiers."""
from __future__ import annotations
from collections.abc import Iterable
from smartcmp_provider.domain.request_ids import (
MAX_REQUEST_ID_LENGTH,
is_request_id... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/domain/approval_validation.py | .py | 35febc254c070488 | 7.6 | 15 |
"""SmartCMP service-catalog availability rules shared by output adapters."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from smartcmp_provider.domain.object_operations import available_operation
from smartcmp_provider.models.object_operations import AvailableOperati... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/domain/catalogs.py | .py | 8f6037a50b20573e | 7.6 | 15 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Normalize SmartCMP cost values, object operations, and timestamps."""
from __future__ import annotations
from datetime import datetime, timezone
from typing import Any
from zoneinfo import ZoneIn... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/domain/cost.py | .py | 10c297aaca5ca2a3 | 7.6 | 15 |
"""Build adapter-neutral object operations from Provider capabilities.
The returned operation tells an agent which capability applies to a concrete
SmartCMP object and supplies stable arguments. MCP publishes its ``tool_name``
directly, while the AtlasClaw adapter projects the same operation into its own
``object_acti... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/domain/object_operations.py | .py | 1be611ce36fa22c3 | 7.6 | 15 |
# -*- coding: utf-8 -*-
# Copyright 2026 Qianyun, Inc., www.cloudchef.io, All rights reserved.
"""Normalize opaque SmartCMP user-facing request identifiers."""
from __future__ import annotations
from typing import Any
MAX_REQUEST_ID_LENGTH = 256
def normalize_request_id(value: Any) -> str:
"""Normalize one r... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/domain/request_ids.py | .py | c42566fcc8ce1a0f | 7.6 | 15 |
"""Derive protocol-neutral operations for concrete SmartCMP resources."""
from __future__ import annotations
from smartcmp_provider.domain.object_operations import available_operation
from smartcmp_provider.models.object_operations import AvailableOperation
def normalize_operation_id(operation_id: str) -> str:
... | CloudChef/atlasclaw-providers | providers/SmartCMP-Provider/src/smartcmp_provider/domain/resource_actions.py | .py | 2d766473d660b745 | 7.6 | 15 |
#!/usr/bin/env python3
import json
import time
import traceback
import uuid
import os
import random
import urllib.request
import http.cookiejar
import gzip
import io
from typing import List, Tuple, Dict, Any, Final
TXT_HEADER = """#
# tunnelbear_ips.txt
# https://github.com/tn3w/TunnelBear-IPs/blob/master/tunnelbear_... | tn3w/TunnelBear-IPs | main.py | .py | d7a1e83a5c8af6fb | 7.52 | 10 |
#!/usr/bin/env python3
"""Decide whether a git tag should also move Docker ``latest``.
Only a plain ``X.Y.Z`` tag that is greater than or equal to every other
plain ``X.Y.Z`` tag is latest. Prerelease and backfill tags are not.
"""
from __future__ import annotations
import argparse
import re
import subprocess
impor... | danger-dream/Parrot | scripts/is_latest_release_tag.py | .py | 759983f2f0442d95 | 8.15 | 19 |
"""下游 API Key 验证(常数时间比较,防止时序侧信道)。
返回三元组 (key_name, allowed_models, err):
- 验证通过:allowed_models 为列表(空 = 无限制,非空 = 白名单)
- 验证失败:allowed_models 置空,err 为原因字符串
"""
import hmac
from typing import Optional
from . import config
def validate(headers) -> tuple[Optional[str], list[str], Optional[str]]:
"""验证请求头中的 API K... | danger-dream/Parrot | src/auth.py | .py | 9e0875c8f7641e0f | 7.65 | 19 |
"""Token / prompt-cache display helpers.
统一 UI 展示口径:
prompt_total = input + cache_creation + cache_read
cache_rate = cache_read / prompt_total
只展示读缓存;写缓存通常为 0,UI 层默认不展示,避免噪音。
本模块不依赖 telegram,供菜单与 oauth_manager 共用。
"""
from __future__ import annotations
from typing import Any
def _to_int(v: Any) -> int:
... | danger-dream/Parrot | src/cache_display.py | .py | 8157d113dc73bc1a | 7.65 | 19 |
"""Cross-protocol prompt-cache hint helpers.
Parrot accepts several protocol dialects whose cache knobs are not named the
same way:
- Anthropic Messages uses top-level/block-level ``cache_control``.
- OpenAI-family APIs route prompt cache via ``prompt_cache_key`` and optionally
``prompt_cache_retention``.
This mod... | danger-dream/Parrot | src/cache_hints.py | .py | 1829c168ec028d9e | 7.65 | 19 |
"""API 渠道兼容策略的归一化与模型范围匹配。"""
from __future__ import annotations
from typing import Any
AUTO_MODE = "auto"
FORCE_MODE = "force"
VALID_MODES = {AUTO_MODE, FORCE_MODE}
def normalize_mode(value: Any) -> str:
"""未知/缺省值一律回落到自动透传,保持旧配置行为。"""
mode = str(value or AUTO_MODE).strip().lower()
return mode if mode ... | danger-dream/Parrot | src/channel/compatibility.py | .py | f794d2d4705884c9 | 7.65 | 19 |
"""Cursor OAuth channel backed by Parrot's private AgentService bridge."""
from __future__ import annotations
import hashlib
import json
from typing import Any, Optional
from .. import cache_hints, oauth_manager
from ..cursor_bridge import catalog as cursor_catalog
from ..cursor_bridge import runtime as cursor_runti... | danger-dream/Parrot | src/channel/cursor_oauth_channel.py | .py | 65aefaf572bce32e | 7.65 | 19 |
"""渠道 URL 处理工具。
背景:原有约定是用户填 baseUrl(如 `https://api.example.com`),代理按协议自动
追加 `/v1/messages` / `/v1/chat/completions` / `/v1/responses`。但少数上游(典型
代表:智谱 Coding Plan Max 的 OpenAI 入口)把接口挂在不标准子路径
`/api/coding/paas/v4/chat/completions`,不带 `/v1`,导致拼出来的 URL 永远 404。
解决方案:允许 baseUrl 直接填完整调用路径;代理在保存时按末段白名单识别并拆分
成 `(baseUrl, apiPa... | danger-dream/Parrot | src/channel/url_utils.py | .py | b776e05767c5bf4f | 7.65 | 19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.