input string | label int64 | sample_id string | category string | repo_id string |
|---|---|---|---|---|
"""Tests for channel plugin discovery, merging, and config compatibility."""
from __future__ import annotations
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from nanobot.bus.events import OutboundMessage
from nanobot.bus.queue import MessageBus
from nanobot.channels.base import Ba... | 0 | HKUDS/nanobot:tests/test_channel_plugins.py | unknown | HKUDS/nanobot |
#!/usr/bin/env python3
"""
Skill Initializer - Creates a new skill from template
Usage:
init_skill.py <skill-name> --path <path> [--resources scripts,references,assets] [--examples]
Examples:
init_skill.py my-new-skill --path skills/public
init_skill.py my-new-skill --path skills/public --resources script... | 0 | HKUDS/nanobot:nanobot/skills/skill-creator/scripts/init_skill.py | unknown | HKUDS/nanobot |
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2026)
#
# 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... | 1 | streamlit/streamlit:lib/tests/streamlit/web/server/starlette/starlette_auth_routes_test.py | test | streamlit/streamlit |
#!/usr/bin/env python3
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
#
# 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
#
# U... | 0 | PaddlePaddle/PaddleOCR:skills/paddleocr-text-recognition/scripts/ocr_caller.py | unknown | PaddlePaddle/PaddleOCR |
import os
import re
from collections.abc import Iterable, Sequence
from typing import Any
from django.apps.config import AppConfig
from django.conf import settings
from django.core import checks
def check_required_settings(
app_configs: Sequence[AppConfig] | None,
databases: Sequence[str] | None,
**kwarg... | 1 | zulip/zulip:zerver/checks.py | function_complex | zulip/zulip |
"""
Base classes for MLflow GenAI tools that can be used by judges.
This module provides the foundational interfaces for tools that judges can use
to enhance their evaluation capabilities.
"""
from abc import ABC, abstractmethod
from typing import Any
from mlflow.entities.trace import Trace
from mlflow.types.llm imp... | 1 | mlflow/mlflow:mlflow/genai/judges/tools/base.py | documentation | mlflow/mlflow |
from typing import Any
def bubble_sort_iterative(collection: list[Any]) -> list[Any]:
"""Pure implementation of bubble sort algorithm in Python
:param collection: some mutable ordered collection with heterogeneous
comparable items inside
:return: the same collection ordered in ascending order
Ex... | 0 | TheAlgorithms/Python:sorts/bubble_sort.py | unknown | TheAlgorithms/Python |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Evaluate Transcription API correctness by computing Word Error Rate (WER)
on a given ASR dataset. When provided, it will also compare the WER against
a baseline.
This simulates real work usage of the API and m... | 0 | vllm-project/vllm:tests/entrypoints/openai/correctness/test_transcription_api_correctness.py | unknown | vllm-project/vllm |
# Copyright 2025 Bytedance Ltd. and/or its affiliates
#
# 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 ... | 0 | verl-project/verl:tests/special_sanity/check_pr_title.py | unknown | verl-project/verl |
# Copyright 2023-present the HuggingFace Inc. team.
#
# 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... | 0 | huggingface/peft:src/peft/utils/peft_types.py | unknown | huggingface/peft |
#!/usr/bin/env python3
"""Run trigger evaluation for a skill description.
Tests whether a skill's description causes Claude to trigger (read the skill)
for a set of queries. Outputs results as JSON.
"""
import argparse
import json
import os
import select
import subprocess
import sys
import time
import uuid
from concu... | 0 | davila7/claude-code-templates:cli-tool/components/skills/development/skill-creator/scripts/run_eval.py | unknown | davila7/claude-code-templates |
from __future__ import annotations
from abc import abstractmethod
from collections.abc import AsyncIterator, Callable, Iterator, Sequence
from typing import Any, Generic, Literal, cast, overload
from langchain_core.runnables import Runnable, RunnableConfig
from langchain_core.runnables.graph import Graph as DrawableG... | 0 | langchain-ai/langgraph:libs/langgraph/langgraph/pregel/protocol.py | unknown | langchain-ai/langgraph |
#!/usr/bin/env python3
"""Fetch num_key_value_heads from HuggingFace config.json and update TOML model cards.
Usage:
# Update only cards missing num_key_value_heads
uv run python scripts/fetch_kv_heads.py --missing
# Update all cards (overwrite existing values)
uv run python scripts/fetch_kv_heads.py ... | 0 | exo-explore/exo:scripts/fetch_kv_heads.py | unknown | exo-explore/exo |
"""
Functions related to generating headers and fingerprints generally
"""
from functools import lru_cache
from platform import system as platform_system
from browserforge.headers import Browser, HeaderGenerator
from browserforge.headers.generator import SUPPORTED_OPERATING_SYSTEMS
from scrapling.core._types import ... | 0 | D4Vinci/Scrapling:scrapling/engines/toolbelt/fingerprints.py | unknown | D4Vinci/Scrapling |
from __future__ import annotations
from typing import TYPE_CHECKING, Any, cast
from lfx.graph.vertex.base import Vertex
from lfx.log.logger import logger
from lfx.processing.utils import validate_and_repair_json
from pydantic import BaseModel
from langflow.schema.graph import InputValue, Tweaks
from langflow.schema.... | 0 | langflow-ai/langflow:src/backend/base/langflow/processing/process.py | unknown | langflow-ai/langflow |
from __future__ import annotations
import warnings
from abc import ABC, abstractmethod
import pytest
import scrapy
from scrapy.exceptions import ScrapyDeprecationWarning
from scrapy.extensions.feedexport import FeedExporter
from scrapy.utils.test import get_crawler
class TestURIParams(ABC):
spider_name = "uri_... | 0 | scrapy/scrapy:tests/test_feedexport_uri_params.py | unknown | scrapy/scrapy |
"""SSE Polling Demo Client
Demonstrates the client-side auto-reconnect for SSE polling pattern.
This client connects to the SSE Polling Demo server and calls process_batch,
which triggers periodic server-side stream closes. The client automatically
reconnects using Last-Event-ID and resumes receiving messages.
Run w... | 1 | modelcontextprotocol/python-sdk:examples/clients/sse-polling-client/mcp_sse_polling_client/main.py | function_simple | modelcontextprotocol/python-sdk |
import abc
import contextlib
import datetime
from collections.abc import AsyncIterator
from typing import Literal, TypeVar
import httpx
import mcp.types
from mcp import ClientSession
from mcp.client.session import (
ElicitationFnT,
ListRootsFnT,
LoggingFnT,
MessageHandlerFnT,
SamplingFnT,
)
from ty... | 1 | PrefectHQ/fastmcp:src/fastmcp/client/transports/base.py | function_simple | PrefectHQ/fastmcp |
from django.utils.timezone import now as timezone_now
from zerver.lib.timestamp import datetime_to_timestamp
from zerver.models import UserProfile
from zerver.models.devices import Device
from zerver.tornado.django_api import send_event_on_commit
def do_register_push_device(
user_profile: UserProfile,
device... | 1 | zulip/zulip:zerver/actions/push_notifications.py | function_simple | zulip/zulip |
"""Tool search — deferred tool discovery at runtime.
Contains:
- DeferredToolRegistry: stores deferred tools and handles regex search
- tool_search: the LangChain tool the agent calls to discover deferred tools
The agent sees deferred tool names in <available-deferred-tools> but cannot
call them until it fetches thei... | 0 | bytedance/deer-flow:backend/packages/harness/deerflow/tools/builtins/tool_search.py | unknown | bytedance/deer-flow |
#!/usr/bin/env python3
"""
Quick validation script for skills - minimal version
"""
import sys
import os
import re
import yaml
from pathlib import Path
def validate_skill(skill_path):
"""Basic validation of a skill"""
skill_path = Path(skill_path)
# Check SKILL.md exists
skill_md = skill_path / 'SKIL... | 0 | davila7/claude-code-templates:cli-tool/components/skills/development/skill-creator/scripts/quick_validate.py | unknown | davila7/claude-code-templates |
import gradio as gr
with gr.Blocks() as demo:
with gr.HTML(html_template='''
<button class="maximize">⛶</button>
<h2>${form_name}</h2>
@children
<button class="submit">Submit</button>
''', css_template='''
border: 2px solid gray;
border-radius: 12px;
... | 1 | gradio-app/gradio:demo/html_children/run.py | documentation | gradio-app/gradio |
from blake3 import blake3
from typing import IO
import os
import asyncio
DEFAULT_CHUNK = 8 * 1024 *1024 # 8MB
# NOTE: this allows hashing different representations of a file-like object
def blake3_hash(
fp: str | IO[bytes],
chunk_size: int = DEFAULT_CHUNK,
) -> str:
"""
Returns a BLAKE3 hex digest fo... | 1 | Comfy-Org/ComfyUI:app/assets/hashing.py | function_complex | Comfy-Org/ComfyUI |
import re
from pathlib import Path
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel, constr
from utils.function_catalog import get_function_catalog
from utils.function_manager import FUNCTION_CALLING_DIR
router = APIRouter()
class LocalToolCreateRequest(BaseModel):
filename: constr(s... | 0 | OpenBMB/ChatDev:server/routes/tools.py | unknown | OpenBMB/ChatDev |
# Copyright (c) 2025, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri Dao.
# SM120 (Blackwell GeForce / DGX Spark) forward pass.
#
# SM120 uses the same SM80-era MMA instructions (mma.sync.aligned.m16n8k16) but has
# a smaller shared memory capacity (99 KB vs 163 KB on SM80). This module subc... | 0 | Dao-AILab/flash-attention:flash_attn/cute/flash_fwd_sm120.py | unknown | Dao-AILab/flash-attention |
#! /usr/bin/env python3
import argparse
import os
import subprocess
import sys
def run(cmd, *, cwd=None, env=None, dry_run=True):
"""Run a command with optional dry-run behavior."""
environ = os.environ.copy()
if env:
environ.update(env)
if dry_run:
print("[DRY RUN]", " ".join(cmd))
... | 1 | django/django:scripts/archive_eol_stable_branches.py | function_complex | django/django |
#!/usr/bin/env python3
__package__ = 'archivebox.cli'
import os
import rich_click as click
from rich import print
from archivebox.misc.util import docstring, enforce_types
@enforce_types
def install(binaries: tuple[str, ...] = (), binproviders: str = '*', dry_run: bool = False) -> None:
"""Detect and install ... | 0 | ArchiveBox/ArchiveBox:archivebox/cli/archivebox_install.py | unknown | ArchiveBox/ArchiveBox |
from collections.abc import Generator
from functools import cache
from typing import Any
from mlx_lm.models.deepseek_v32 import Model as DeepseekV32Model
from mlx_lm.models.gpt_oss import Model as GptOssModel
from mlx_lm.tokenizer_utils import TokenizerWrapper
from openai_harmony import ( # pyright: ignore[reportMiss... | 0 | exo-explore/exo:src/exo/worker/runner/llm_inference/model_output_parsers.py | unknown | exo-explore/exo |
import math, os
if __name__ == "__main__":
os.environ["DEFAULT_FLOAT"] = "bfloat16"
os.environ["OPTIM_DTYPE"] = "bfloat16"
os.environ["DEV"] = "NULL"
from tinygrad import Tensor, nn, function, getenv, dtypes, TinyJit
from tinygrad.helpers import Timing, colored, GlobalCounters
from extra.models.llama import apply... | 0 | tinygrad/tinygrad:examples/mlperf/models/flat_llama.py | unknown | tinygrad/tinygrad |
"""
Recursive Language Model (RLM) module for DSPy.
RLMs are an inference strategy where LLMs treat long contexts as part of an external
environment rather than feeding them directly to the model. The LLM writes Python code
to programmatically examine, decompose, and recursively call sub-LLMs over snippets.
Reference... | 1 | stanfordnlp/dspy:dspy/predict/rlm.py | function_complex | stanfordnlp/dspy |
from __future__ import annotations
from typing import Any
from unittest import mock
import pytest
from testfixtures import LogCapture
from scrapy import signals
from scrapy.crawler import Crawler
from scrapy.http import Response, TextResponse, XmlResponse
from scrapy.settings import Settings
from scrapy.spiders impo... | 0 | scrapy/scrapy:tests/test_spider.py | unknown | scrapy/scrapy |
#!/usr/bin/env python3
"""
Shader Blueprint Updater
Syncs GLSL shader files between this folder and blueprint JSON files.
File naming convention:
{Blueprint Name}_{node_id}.frag
Usage:
python update_blueprints.py extract # Extract shaders from JSONs to here
python update_blueprints.py patch # Patch... | 1 | Comfy-Org/ComfyUI:blueprints/.glsl/update_blueprints.py | function_complex | Comfy-Org/ComfyUI |
"""
Interactive TemperatureGrid sensor visualization with keyboard teleop.
A platform has a temperature grid sensor on its top surface. Move a "hot" pusher
and drop objects onto the platform; the grid shows temperature (blue=cool, red=hot)
from contact-based blending of each body's base_temperature and conductivity.
"... | 0 | Genesis-Embodied-AI/Genesis:examples/sensors/temperature_grid.py | unknown | Genesis-Embodied-AI/Genesis |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
from frappe import _, bold
from frappe.model.document import Document
from frappe.utils import (
add_days,
cint,
comma_and,
flt,
formatdate,
get_link_to_form,
get_time,
... | 0 | frappe/erpnext:erpnext/manufacturing/doctype/workstation/workstation.py | unknown | frappe/erpnext |
"""Abstract base class for sandbox state persistence.
The state store handles cross-process persistence of thread_id → sandbox mappings,
enabling different processes (gateway, langgraph, multiple workers) to find the same
sandbox for a given thread.
"""
from __future__ import annotations
from abc import ABC, abstrac... | 1 | bytedance/deer-flow:backend/src/community/aio_sandbox/state_store.py | documentation | bytedance/deer-flow |
import functools
import math
import operator
import re
import warnings
def _convert_conv_transpose_padding_args_from_keras_to_jax(
kernel_size, stride, dilation_rate, padding, output_padding
):
"""Convert the padding arguments from Keras to the ones used by JAX.
JAX starts with an shape of size `(input-1)... | 0 | keras-team/keras:keras/src/backend/common/backend_utils.py | unknown | keras-team/keras |
"""Async client for managing recurrent runs (cron jobs) in LangGraph."""
from __future__ import annotations
import warnings
from collections.abc import Mapping, Sequence
from datetime import datetime
from typing import Any
from langgraph_sdk._async.http import HttpClient
from langgraph_sdk.schema import (
All,
... | 1 | langchain-ai/langgraph:libs/sdk-py/langgraph_sdk/_async/cron.py | documentation | langchain-ai/langgraph |
# encoding:utf-8
import json
import time
import requests
from models.bot import Bot
from models.session_manager import SessionManager
from bridge.context import ContextType
from bridge.reply import Reply, ReplyType
from common.log import logger
from config import conf, load_config
from .doubao_session import DoubaoSe... | 1 | zhayujie/chatgpt-on-wechat:models/doubao/doubao_bot.py | function_complex | zhayujie/chatgpt-on-wechat |
from __future__ import annotations
import bz2
import gzip
import lzma
import marshal
import pickle
import sys
from io import BytesIO
from pathlib import Path
from typing import TYPE_CHECKING, Any
import pytest
from scrapy.utils.test import get_crawler
from tests.test_feedexport import TestFeedExportBase, path_to_url... | 0 | scrapy/scrapy:tests/test_feedexport_postprocess.py | unknown | scrapy/scrapy |
#!/usr/bin/env python
"""
Example script demonstrating the integration of MinerU parser with RAGAnything
This example shows how to:
1. Process parsed documents with RAGAnything
2. Perform multimodal queries on the processed documents
3. Handle different types of content (text, images, tables)
"""
import os
import arg... | 1 | HKUDS/LightRAG:examples/raganything_example.py | function_complex | HKUDS/LightRAG |
from django.db import NotSupportedError
from django.db.models.expressions import Func
from django.db.models.fields import UUIDField
class UUID4(Func):
function = "UUIDV4"
arity = 0
output_field = UUIDField()
def as_sql(self, compiler, connection, **extra_context):
if connection.features.suppo... | 1 | django/django:django/db/models/functions/uuid.py | function_complex | django/django |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Integration tests for MCP tool support in the Responses API."""
from __future__ import annotations
import pytest
import pytest_asyncio
from openai import OpenAI
from openai_harmony import ToolDescription, Too... | 0 | vllm-project/vllm:tests/entrypoints/openai/responses/test_mcp_tools.py | unknown | vllm-project/vllm |
import os
from pathlib import Path
import pytest
from solidlsp import SolidLanguageServer
from solidlsp.ls_config import Language
from solidlsp.ls_types import SymbolKind
from solidlsp.ls_utils import SymbolUtils
@pytest.mark.dart
class TestDartLanguageServer:
@pytest.mark.parametrize("language_server", [Langua... | 1 | oraios/serena:test/solidlsp/dart/test_dart_basic.py | test | oraios/serena |
from typing import Any
from browser_use.llm.messages import (
AssistantMessage,
BaseMessage,
ContentPartImageParam,
ContentPartTextParam,
SystemMessage,
UserMessage,
)
class LiteLLMMessageSerializer:
@staticmethod
def _serialize_user_content(
content: str | list[ContentPartTextParam | ContentPartImageParam... | 0 | browser-use/browser-use:browser_use/llm/litellm/serializer.py | unknown | browser-use/browser-use |
"""
Tests for the Apache Iceberg format.
Tests in this file use a simple Iceberg catalog based on SQLite, with the same
data used for Parquet tests (``pandas/tests/io/data/parquet/simple.parquet``).
"""
import collections
import importlib
import pathlib
import pytest
import pandas as pd
import pandas._testing as tm... | 1 | pandas-dev/pandas:pandas/tests/io/test_iceberg.py | test | pandas-dev/pandas |
import argparse
import json
from collections import defaultdict
import numpy as np
from openai import OpenAI
from mem0.memory.utils import extract_json
client = OpenAI()
ACCURACY_PROMPT = """
Your task is to label an answer to a question as ’CORRECT’ or ’WRONG’. You will be given the following data:
(1) a quest... | 1 | mem0ai/mem0:evaluation/metrics/llm_judge.py | function_complex | mem0ai/mem0 |
# coding=utf-8
"""
@project: maxkb
@Author:虎
@file: base_question_node.py
@date:2024/6/4 14:30
@desc:
"""
import json
import re
import time
from functools import reduce
from typing import List, Dict
from application.flow.i_step_node import NodeResult, INode
from application.flow.step_node.ai_chat_s... | 0 | 1Panel-dev/MaxKB:apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py | unknown | 1Panel-dev/MaxKB |
"""Imports TreeNodes"""
from algorithms.common.tree_node import TreeNode
class AvlTree:
"""
An avl tree.
"""
def __init__(self):
# Root node of the tree.
self.node = None
self.height = -1
self.balance = 0
def insert(self, key):
"""
Insert new key ... | 0 | keon/algorithms:algorithms/data_structures/avl_tree.py | unknown | keon/algorithms |
"""Task key management for SEP-1686 background tasks.
Task keys encode security scoping and metadata in the Docket key format:
`{session_id}:{client_task_id}:{task_type}:{component_identifier}`
This format provides:
- Session-based security scoping (prevents cross-session access)
- Task type identification (tool/... | 1 | PrefectHQ/fastmcp:src/fastmcp/server/tasks/keys.py | documentation | PrefectHQ/fastmcp |
# Copyright 2024 Bytedance Ltd. and/or its affiliates
# Copyright 2023-2024 SGLang Team
# Copyright 2025 Search-R1 Contributors
#
# 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
#
# ... | 1 | verl-project/verl:verl/utils/reward_score/search_r1_like_qa_em.py | license | verl-project/verl |
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
"""
Export subprocess entry point.
Each export session runs in a persistent subprocess (mp.get_context("spawn")).
This gives us a clean Python interpreter with no stale module ... | 0 | unslothai/unsloth:studio/backend/core/export/worker.py | unknown | unslothai/unsloth |
import numpy as np
import torch
import genesis as gs
import genesis.utils.geom as gu
import genesis.utils.particle as pu
from genesis.repr_base import RBC
class Emitter(RBC):
"""
A particle emitter for fluid or material simulation.
The Emitter manages the generation of particles into the simulation doma... | 0 | Genesis-Embodied-AI/Genesis:genesis/engine/entities/emitter.py | unknown | Genesis-Embodied-AI/Genesis |
from strix.telemetry.flags import is_otel_enabled, is_posthog_enabled
def test_flags_fallback_to_strix_telemetry(monkeypatch) -> None:
monkeypatch.delenv("STRIX_OTEL_TELEMETRY", raising=False)
monkeypatch.delenv("STRIX_POSTHOG_TELEMETRY", raising=False)
monkeypatch.setenv("STRIX_TELEMETRY", "0")
asse... | 0 | usestrix/strix:tests/telemetry/test_flags.py | unknown | usestrix/strix |
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
#
# 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 appli... | 0 | ray-project/ray:python/ray/data/_internal/gpu_shuffle/rapidsmpf_backend.py | unknown | ray-project/ray |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1 | apache/airflow:providers/ssh/src/airflow/providers/ssh/triggers/ssh_remote_job.py | function_complex | apache/airflow |
from typing import TYPE_CHECKING, Any, Optional
import litellm
import pydantic
from dspy.adapters.types.base_type import Type
if TYPE_CHECKING:
from dspy.clients.lm import LM
from dspy.signatures.signature import Signature
class Reasoning(Type):
"""Reasoning type in DSPy.
This type is useful when ... | 1 | stanfordnlp/dspy:dspy/adapters/types/reasoning.py | function_complex | stanfordnlp/dspy |
"""Config flow for the Namecheap DynamicDNS integration."""
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any
from aiohttp import ClientError
import voluptuous as vol
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
from ... | 1 | home-assistant/core:homeassistant/components/namecheapdns/config_flow.py | function_complex | home-assistant/core |
from __future__ import annotations
import argparse
import json
import os
import typing as t
import pytest
import pytest_mock
if t.TYPE_CHECKING:
from ansible_test._internal.ci.azp import AzurePipelinesChanges
def create_azure_pipelines_changes(mocker: pytest_mock.MockerFixture) -> AzurePipelinesChanges:
""... | 1 | ansible/ansible:test/units/ansible_test/_internal/ci/test_azp.py | test | ansible/ansible |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from importlib.util import find_spec
import pytest
import torch
import vllm.envs as envs
from tests.compile.backend import TestBackend
from tests.utils import TestFP8Layer, has_module_attribute, multi_gpu_test
f... | 0 | vllm-project/vllm:tests/compile/passes/distributed/test_fusion_all_reduce.py | unknown | vllm-project/vllm |
import shutil
from collections.abc import Generator
from pathlib import Path
import pytest
import reflex as rx
import reflex.constants as constants
from reflex.assets import remove_stale_external_asset_symlinks
@pytest.fixture
def mock_asset_path(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
"""Crea... | 0 | reflex-dev/reflex:tests/units/assets/test_assets.py | unknown | reflex-dev/reflex |
"""
AgentOS Demo
Prerequisites:
uv pip install -U fastapi uvicorn sqlalchemy pgvector psycopg openai ddgs
"""
from agno import __version__ as agno_version
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.knowledge.knowledge import Knowledge
from agno.models.openai import OpenAIChat
from ... | 0 | agno-agi/agno:cookbook/05_agent_os/interfaces/all_interfaces.py | unknown | agno-agi/agno |
"""
Construct Tree from Preorder and Postorder Traversal
Given preorder and postorder traversals of a full binary tree, construct the
tree and return its inorder traversal. A full binary tree has either zero or
two children per node.
Reference: https://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees
Complexi... | 0 | keon/algorithms:algorithms/tree/construct_tree_postorder_preorder.py | unknown | keon/algorithms |
# Copyright 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of con... | 1 | FunAudioLLM/CosyVoice:runtime/triton_trtllm/model_repo/speaker_embedding/1/model.py | function_complex | FunAudioLLM/CosyVoice |
"""
Copyright 2024, Zep Software, Inc.
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, sof... | 1 | getzep/graphiti:graphiti_core/llm_client/azure_openai_client.py | function_complex | getzep/graphiti |
# flags: --minimum-version=3.14
x = t"foo"
x = t'foo {{ {2 + 2}bar {{ baz'
x = t"foo {f'abc'} bar"
x = t"""foo {{ a
foo {2 + 2}bar {{ baz
x = f"foo {{ {
2 + 2 # comment
}bar"
{{ baz
}} buzz
{print("abc" + "def"
)}
abc"""
t'{(abc:=10)}'
t'''This is a really long string, but just ... | 1 | psf/black:tests/data/cases/pep_750.py | test | psf/black |
import json
import os
from itertools import islice
from typing import Iterable
import pyarrow as pa
import datasets
from datasets.builder import Key
logger = datasets.utils.logging.get_logger(__name__)
class Eval(datasets.GeneratorBasedBuilder):
NUM_EXAMPLES_FOR_FEATURES_INFERENCE = 5
def _info(self):
... | 1 | huggingface/datasets:src/datasets/packaged_modules/eval/eval.py | function_complex | huggingface/datasets |
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2026)
#
# 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... | 1 | streamlit/streamlit:lib/streamlit/components/v2/component_manager.py | license | streamlit/streamlit |
from __future__ import annotations
import numpy as np
import numpy.typing as npt
from supervision.detection.utils.iou_and_nms import box_iou_batch
def clip_boxes(
xyxy: npt.NDArray[np.number],
resolution_wh: tuple[int, int],
) -> npt.NDArray[np.number]:
"""
Clips bounding boxes coordinates to fit wi... | 0 | roboflow/supervision:src/supervision/detection/utils/boxes.py | unknown | roboflow/supervision |
from typing import NotRequired, override
from langchain.agents import AgentState
from langchain.agents.middleware import AgentMiddleware
from langgraph.runtime import Runtime
from src.agents.thread_state import SandboxState, ThreadDataState
from src.sandbox import get_sandbox_provider
class SandboxMiddlewareState(A... | 1 | bytedance/deer-flow:backend/src/sandbox/middleware.py | function_simple | bytedance/deer-flow |
import json
import sys
import types
from pathlib import Path
from typing import Any, ClassVar
import pytest
from opentelemetry.sdk.trace.export import SimpleSpanProcessor, SpanExportResult
from strix.telemetry import tracer as tracer_module
from strix.telemetry import utils as telemetry_utils
from strix.telemetry.tra... | 0 | usestrix/strix:tests/telemetry/test_tracer.py | unknown | usestrix/strix |
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
"""
Audio codec loading and decoding for TTS inference.
Supports: SNAC (Orpheus), CSM (Sesame), BiCodec (Spark), DAC (OuteTTS)
"""
import io
import re
import wave
import struct... | 0 | unslothai/unsloth:studio/backend/core/inference/audio_codecs.py | unknown | unslothai/unsloth |
from __future__ import annotations
import logging
import pickle
import re
import warnings
from hashlib import sha256
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Iterator
from datetime import datetime
from... | 0 | paperless-ngx/paperless-ngx:src/documents/classifier.py | unknown | paperless-ngx/paperless-ngx |
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import connection
from django.db.models.signals import post_save
from django.utils.translation import gettext_lazy as _
from dcim.constants import LO... | 0 | netbox-community/netbox:netbox/dcim/forms/mixins.py | unknown | netbox-community/netbox |
# HumanEval/120
# Loki Mode Multi-Agent Solution
# Attempts: 1
# Passed: True
def maximum(arr, k):
"""
Given an array arr of integers and a positive integer k, return a sorted list
of length k with the maximum k numbers in arr.
Example 1:
Input: arr = [-3, -4, 5], k = 3
Output: [-4, ... | 1 | davila7/claude-code-templates:cli-tool/components/skills/ai-research/loki-mode/benchmarks/results/humaneval-loki-solutions/120.py | documentation | davila7/claude-code-templates |
"""Anthropic prompt caching middleware.
Requires:
- `langchain`: For agent middleware framework
- `langchain-anthropic`: For `ChatAnthropic` model (already a dependency)
"""
from collections.abc import Awaitable, Callable
from typing import Literal
from warnings import warn
from langchain_anthropic.chat_mode... | 1 | langchain-ai/langchain:libs/partners/anthropic/langchain_anthropic/middleware/prompt_caching.py | function_complex | langchain-ai/langchain |
from dataclasses import dataclass
from itertools import product
from operator import itemgetter
import numpy as np
import pytest
from numpy.testing import assert_allclose
from scipy.sparse import csc_array
from scipy.special import xlogy
from sklearn.metrics import mean_poisson_deviance
from sklearn.tree import (
... | 1 | scikit-learn/scikit-learn:sklearn/tree/tests/test_split.py | test | scikit-learn/scikit-learn |
"""Utils for built-in HTTP download handlers."""
from __future__ import annotations
from abc import ABC
from contextlib import contextmanager
from typing import TYPE_CHECKING, Any
from twisted.internet.defer import CancelledError
from twisted.internet.error import ConnectionRefusedError as TxConnectionRefusedError
f... | 1 | scrapy/scrapy:scrapy/utils/_download_handlers.py | function_complex | scrapy/scrapy |
import os
from pathlib import Path
import pytest
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
from tests.utils import workdir_lock
@pytest.fixture(scope="module")
def client():
static_dir: Path = Path(os.getcwd()) / "static"
static_dir.mkdir(exist_ok=True)
sample_file =... | 1 | fastapi/fastapi:tests/test_tutorial/test_static_files/test_tutorial001.py | test | fastapi/fastapi |
## taken from: https://github.com/yarikoptic/nitest-balls1/blob/2cd07d86e2cc2d3c612d5d4d659daccd7a58f126/NIFTI/T1.nii.gz
from pathlib import Path
import pyarrow as pa
import pytest
from datasets import Dataset, Features, Nifti, load_dataset
from src.datasets.features.nifti import encode_nibabel_image
from ..utils i... | 1 | huggingface/datasets:tests/features/test_nifti.py | test | huggingface/datasets |
#!/usr/bin/env python
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# 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
#
# ... | 0 | huggingface/lerobot:src/lerobot/datasets/sampler.py | unknown | huggingface/lerobot |
import os
import time
from dataclasses import dataclass
from enum import Enum
import mlx.core as mx
from anyio import WouldBlock
from mlx_lm.tokenizer_utils import TokenizerWrapper
from exo.shared.models.model_cards import ModelTask
from exo.shared.types.chunks import (
ErrorChunk,
TokenChunk,
ToolCallChu... | 0 | exo-explore/exo:src/exo/worker/runner/llm_inference/runner.py | unknown | exo-explore/exo |
"""
Tests for the pip binary provider plugin.
Tests cover:
1. Hook script execution
2. pip package detection
3. Virtual environment handling
4. JSONL output format
"""
import json
import os
import subprocess
import sys
import tempfile
from pathlib import Path
from unittest.mock import patch, MagicMock
import pytest
... | 1 | ArchiveBox/ArchiveBox:archivebox/plugins/pip/tests/test_pip_provider.py | test | ArchiveBox/ArchiveBox |
t = (
{"foo": "very long string", "bar": "another very long string", "baz": "we should run out of space by now"}, # fmt: skip
{"foo": "bar"},
)
t = (
{
"foo": "very long string",
"bar": "another very long string",
"baz": "we should run out of space by now",
}, # fmt: skip
... | 1 | psf/black:tests/data/cases/fmtskip13.py | test | psf/black |
from pathlib import Path
from lightrag.api.runtime_validation import (
RuntimeEnvironment,
validate_runtime_target,
validate_runtime_target_from_env_file,
)
def test_validate_runtime_target_skips_when_not_declared() -> None:
is_valid, error_message = validate_runtime_target(None)
assert is_valid... | 0 | HKUDS/LightRAG:tests/test_runtime_target_validation.py | unknown | HKUDS/LightRAG |
#!/usr/bin/env python3
""" Default configurations for models """
import gettext
import logging
import os
from dataclasses import dataclass
from lib.config import ConfigItem, FaceswapConfig, GlobalSection
from plugins.plugin_loader import PluginLoader
from plugins.train.trainer import trainer_config
# LOCALES
_LANG ... | 1 | deepfakes/faceswap:plugins/train/train_config.py | function_complex | deepfakes/faceswap |
"""
This file serves as a documentation example and CI test for autoscaling data parallel attention deployment.
Structure:
1. Monkeypatch setup: Ensures serve.run is non-blocking and removes accelerator requirements for CI testing.
2. Docs example (between __dp_autoscaling_example_start/end__): Embedded in Sphinx docs... | 0 | ray-project/ray:doc/source/llm/doc_code/serve/multi_gpu/dp_autoscaling_example.py | unknown | ray-project/ray |
"""File discovery and module import utilities for filesystem-based routing.
This module provides functions to:
1. Discover Python files in a directory tree
2. Import modules (as packages if __init__.py exists, else directly)
3. Extract decorated components (Tool, Resource, Prompt objects) from imported modules
"""
fr... | 0 | PrefectHQ/fastmcp:src/fastmcp/server/providers/filesystem_discovery.py | unknown | PrefectHQ/fastmcp |
from typing import Annotated
from annotated_doc import Doc
from fastapi.openapi.models import APIKey, APIKeyIn
from fastapi.security.base import SecurityBase
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.status import HTTP_401_UNAUTHORIZED
class APIKeyBase(Secur... | 0 | fastapi/fastapi:fastapi/security/api_key.py | unknown | fastapi/fastapi |
from textual.app import App, ComposeResult
from textual.containers import Grid
from textual.widgets import Footer, Markdown, Placeholder
HELP = """\
## Breakpoints
A demonstration of how to make an app respond to the dimensions of the terminal.
Try resizing the terminal, then have a look at the source to see how it ... | 1 | Textualize/textual:examples/breakpoints.py | documentation | Textualize/textual |
"""
Graph Traversal Algorithms
Provides DFS and BFS traversal of a graph represented as an adjacency
dictionary.
Complexity:
Time: O(V + E)
Space: O(V)
"""
from __future__ import annotations
from collections import deque
from typing import Any
def dfs_traverse(graph: dict[Any, list[Any]], start: Any) -> ... | 0 | keon/algorithms:algorithms/graph/traversal.py | unknown | keon/algorithms |
from typing_extensions import override
from comfy_api.latest import ComfyExtension, io
class ColorToRGBInt(io.ComfyNode):
@classmethod
def define_schema(cls) -> io.Schema:
return io.Schema(
node_id="ColorToRGBInt",
display_name="Color to RGB Int",
category="utils",
... | 1 | Comfy-Org/ComfyUI:comfy_extras/nodes_color.py | function_simple | Comfy-Org/ComfyUI |
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2026)
#
# 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... | 0 | streamlit/streamlit:lib/streamlit/elements/alert.py | unknown | streamlit/streamlit |
"""
EA-compatible analogue to np.putmask
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
from pandas._libs import lib
from pandas.core.dtypes.cast import infer_dtype_from
from pandas.core.dtypes.common import is_list_like
from pandas.core.arrays import ... | 0 | pandas-dev/pandas:pandas/core/array_algos/putmask.py | unknown | pandas-dev/pandas |
import math
import numpy as np
import torch
import genesis as gs
from genesis.repr_base import RBC
from genesis.constants import IMAGE_TYPE
from genesis.utils.misc import qd_to_torch
from .rasterizer_context import SegmentationColorMap
# Optional imports for platform-specific functionality
try:
from gs_madrona.... | 1 | Genesis-Embodied-AI/Genesis:genesis/vis/batch_renderer.py | function_complex | Genesis-Embodied-AI/Genesis |
import uuid
from dash import Dash, Input, Output, callback_context, State, MATCH
from dash_test_components import ComponentAsProp
from dash.dcc import Checklist, Dropdown
from dash.html import Button, Div, Span
from flaky import flaky
def opt(u):
return {
"label": [
Button(
... | 0 | plotly/dash:tests/integration/renderer/test_component_as_prop.py | unknown | plotly/dash |
# Copyright The Lightning AI team.
#
# 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 wri... | 1 | Lightning-AI/pytorch-lightning:tests/tests_pytorch/trainer/connectors/test_rich_integration.py | test | Lightning-AI/pytorch-lightning |
#!/usr/bin/env python3
"""Improve a skill description based on eval results.
Takes eval results (from run_eval.py) and generates an improved description
by calling `claude -p` as a subprocess (same auth pattern as run_eval.py —
uses the session's Claude Code auth, no separate ANTHROPIC_API_KEY needed).
"""
import arg... | 0 | davila7/claude-code-templates:cli-tool/components/skills/development/skill-creator/scripts/improve_description.py | unknown | davila7/claude-code-templates |
#!/usr/bin/env python3
"""
archivebox crawl <action> [args...] [--filters]
Manage Crawl records.
Actions:
create - Create Crawl jobs from URLs
list - List Crawls as JSONL (with optional filters)
update - Update Crawls from stdin JSONL
delete - Delete Crawls from stdin JSONL
Examples:
# Cre... | 1 | ArchiveBox/ArchiveBox:archivebox/cli/archivebox_crawl.py | function_complex | ArchiveBox/ArchiveBox |
"""Code copied from Django Software Foundation (https://djangoproject.com/) which is licensed under the BSD 3-Clause.
Original code: https://github.com/django/django/blob/001c2f546b4053acb04f16d6b704f7b4fbca1c45/django/core/handlers/asgi.py
Modifications: we added a fix for a memory leak
(https://code.djangoproject.c... | 1 | saleor/saleor:saleor/asgi/asgi_handler.py | function_complex | saleor/saleor |
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import weakref
import pytest
from tests.entrypoints.openai.chat_completion.test_vision import TEST_IMAGE_ASSETS
from vllm import LLM
from vllm.distributed import cleanup_dist_env_and_memory
from vllm.sampling_pa... | 0 | vllm-project/vllm:tests/entrypoints/llm/test_chat.py | unknown | vllm-project/vllm |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 12