sample_id stringlengths 21 196 | text stringlengths 105 936k | metadata dict | category stringclasses 6
values |
|---|---|---|---|
apache/airflow:providers/microsoft/azure/tests/system/microsoft/azure/example_powerbi_workspace_list.py | # 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 u... | {
"repo_id": "apache/airflow",
"file_path": "providers/microsoft/azure/tests/system/microsoft/azure/example_powerbi_workspace_list.py",
"license": "Apache License 2.0",
"lines": 75,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"templat... | test |
apache/airflow:providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_powerbi_list.py | # 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 u... | {
"repo_id": "apache/airflow",
"file_path": "providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_powerbi_list.py",
"license": "Apache License 2.0",
"lines": 202,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ... | test |
apache/airflow:providers/amazon/tests/unit/amazon/aws/queues/test_sqs.py | # 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 u... | {
"repo_id": "apache/airflow",
"file_path": "providers/amazon/tests/unit/amazon/aws/queues/test_sqs.py",
"license": "Apache License 2.0",
"lines": 56,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
apache/airflow:providers/fab/src/airflow/providers/fab/www/extensions/init_wsgi_middlewares.py | # 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 u... | {
"repo_id": "apache/airflow",
"file_path": "providers/fab/src/airflow/providers/fab/www/extensions/init_wsgi_middlewares.py",
"license": "Apache License 2.0",
"lines": 34,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
apache/airflow:task-sdk/tests/task_sdk/execution_time/test_lazy_sequence.py | # 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 u... | {
"repo_id": "apache/airflow",
"file_path": "task-sdk/tests/task_sdk/execution_time/test_lazy_sequence.py",
"license": "Apache License 2.0",
"lines": 144,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
apache/airflow:providers/exasol/tests/system/exasol/example_exasol.py | # 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 u... | {
"repo_id": "apache/airflow",
"file_path": "providers/exasol/tests/system/exasol/example_exasol.py",
"license": "Apache License 2.0",
"lines": 77,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
apache/airflow:helm-tests/tests/helm_tests/apiserver/test_ingress_apiserver.py | # 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 u... | {
"repo_id": "apache/airflow",
"file_path": "helm-tests/tests/helm_tests/apiserver/test_ingress_apiserver.py",
"license": "Apache License 2.0",
"lines": 229,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
assafelovic/gpt-researcher:backend/server/multi_agent_runner.py | import os
import sys
from typing import Any, Awaitable, Callable
RunResearchTask = Callable[..., Awaitable[Any]]
def _ensure_repo_root_on_path() -> None:
"""Ensure top-level repo root is importable for multi-agent modules."""
repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "backend/server/multi_agent_runner.py",
"license": "Apache License 2.0",
"lines": 25,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
assafelovic/gpt-researcher:multi_agents_ag2/agents/editor.py | from datetime import datetime
from typing import Dict, Optional, List
from multi_agents.agents.utils.views import print_agent_output
from multi_agents.agents.utils.llms import call_model
class EditorAgent:
"""Agent responsible for planning the research outline."""
def __init__(self, websocket=None, stream_o... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "multi_agents_ag2/agents/editor.py",
"license": "Apache License 2.0",
"lines": 78,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
assafelovic/gpt-researcher:multi_agents_ag2/agents/orchestrator.py | import asyncio
import datetime
import os
import time
from typing import Any, Dict, List, Optional
from autogen import ConversableAgent, GroupChat, GroupChatManager, UserProxyAgent
from multi_agents.agents.utils.views import print_agent_output
from multi_agents.agents.utils.utils import sanitize_filename
from .editor ... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "multi_agents_ag2/agents/orchestrator.py",
"license": "Apache License 2.0",
"lines": 184,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
assafelovic/gpt-researcher:multi_agents_ag2/main.py | import asyncio
from dotenv import load_dotenv
import os
import sys
import uuid
import json
from multi_agents_ag2.agents import ChiefEditorAgent
from gpt_researcher.utils.enum import Tone
load_dotenv()
def open_task() -> dict:
current_dir = os.path.dirname(os.path.abspath(__file__))
task_json_path = os.path... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "multi_agents_ag2/main.py",
"license": "Apache License 2.0",
"lines": 40,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
assafelovic/gpt-researcher:backend/server/report_store.py | import asyncio
import json
from pathlib import Path
from typing import Any, Dict, List
class ReportStore:
def __init__(self, path: Path):
self._path = path
self._lock = asyncio.Lock()
async def _ensure_parent_dir(self) -> None:
self._path.parent.mkdir(parents=True, exist_ok=True)
... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "backend/server/report_store.py",
"license": "Apache License 2.0",
"lines": 48,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
assafelovic/gpt-researcher:gpt_researcher/llm_provider/image/image_generator.py | """Image generation provider for GPT Researcher.
This module provides image generation capabilities using Google's Gemini/Imagen
models via the google.genai SDK.
Supported models:
- Gemini image models (free tier): models/gemini-2.5-flash-image
- Imagen models (requires billing): imagen-4.0-generate-001
"""
import a... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "gpt_researcher/llm_provider/image/image_generator.py",
"license": "Apache License 2.0",
"lines": 366,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
assafelovic/gpt-researcher:gpt_researcher/skills/image_generator.py | """Image generator skill for GPT Researcher.
This module provides the ImageGenerator class that handles generating
contextually relevant images for research reports using AI image generation.
"""
import asyncio
import json
import logging
import re
from typing import Any, Dict, List, Optional, Tuple
from ..actions.ut... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "gpt_researcher/skills/image_generator.py",
"license": "Apache License 2.0",
"lines": 634,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
assafelovic/gpt-researcher:tests/test_quick_search.py | import unittest
from unittest.mock import MagicMock, patch, AsyncMock
import asyncio
from gpt_researcher.agent import GPTResearcher
import os
class TestQuickSearch(unittest.TestCase):
@patch('gpt_researcher.agent.get_search_results', new_callable=AsyncMock)
@patch('gpt_researcher.agent.create_chat_completion'... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "tests/test_quick_search.py",
"license": "Apache License 2.0",
"lines": 36,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
assafelovic/gpt-researcher:gpt_researcher/utils/rate_limiter.py | """
Global rate limiter for scraper requests.
Ensures that SCRAPER_RATE_LIMIT_DELAY is enforced globally across ALL WorkerPools,
not just per-pool. This prevents multiple concurrent researchers from overwhelming
rate-limited APIs like Firecrawl.
"""
import asyncio
import time
from typing import ClassVar
class Global... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "gpt_researcher/utils/rate_limiter.py",
"license": "Apache License 2.0",
"lines": 70,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
assafelovic/gpt-researcher:gpt_researcher/utils/tools.py | """
Tool-enabled LLM utilities for GPT Researcher
This module provides provider-agnostic tool calling functionality using LangChain's
unified interface. It allows any LLM provider that supports function calling to use
tools seamlessly.
"""
import asyncio
import logging
from typing import Any, Dict, List, Tuple, Calla... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "gpt_researcher/utils/tools.py",
"license": "Apache License 2.0",
"lines": 268,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
assafelovic/gpt-researcher:backend/run_server.py | #!/usr/bin/env python3
"""
GPT-Researcher Backend Server Startup Script
Run this to start the research API server.
"""
import uvicorn
import os
import sys
# Add the backend directory to Python path
backend_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, backend_dir)
if __name__ == "__main__":
... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "backend/run_server.py",
"license": "Apache License 2.0",
"lines": 22,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
assafelovic/gpt-researcher:tests/test_security_fix.py | """
Security tests for path traversal vulnerability fix.
This module tests the security improvements made to file upload and deletion
operations to prevent path traversal attacks.
"""
import pytest
import tempfile
import os
import shutil
from unittest.mock import Mock, MagicMock
from fastapi import HTTPException
from... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "tests/test_security_fix.py",
"license": "Apache License 2.0",
"lines": 279,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
assafelovic/gpt-researcher:evals/hallucination_eval/evaluate.py | """
Evaluate model outputs for hallucination using the judges library.
"""
import logging
from pathlib import Path
from typing import Dict, List, Optional
from dotenv import load_dotenv
from judges.classifiers.hallucination import HaluEvalDocumentSummaryNonFactual
# Configure logging
logging.basicConfig(
level=lo... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "evals/hallucination_eval/evaluate.py",
"license": "Apache License 2.0",
"lines": 60,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
assafelovic/gpt-researcher:evals/hallucination_eval/run_eval.py | """
Script to run GPT-Researcher queries and evaluate them for hallucination.
"""
import json
import logging
import random
import asyncio
import argparse
import os
from pathlib import Path
from typing import Dict, List, Optional
from dotenv import load_dotenv
from gpt_researcher.agent import GPTResearcher
from gpt_res... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "evals/hallucination_eval/run_eval.py",
"license": "Apache License 2.0",
"lines": 187,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
assafelovic/gpt-researcher:gpt_researcher/mcp/client.py | """
MCP Client Management Module
Handles MCP client creation, configuration conversion, and connection management.
"""
import asyncio
import logging
from typing import List, Dict, Any, Optional
try:
from langchain_mcp_adapters.client import MultiServerMCPClient
HAS_MCP_ADAPTERS = True
except ImportError:
... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "gpt_researcher/mcp/client.py",
"license": "Apache License 2.0",
"lines": 141,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
assafelovic/gpt-researcher:gpt_researcher/mcp/research.py | """
MCP Research Execution Skill
Handles research execution using selected MCP tools as a skill component.
"""
import asyncio
import logging
from typing import List, Dict, Any
logger = logging.getLogger(__name__)
class MCPResearchSkill:
"""
Handles research execution using selected MCP tools.
Respo... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "gpt_researcher/mcp/research.py",
"license": "Apache License 2.0",
"lines": 230,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
assafelovic/gpt-researcher:gpt_researcher/mcp/streaming.py | """
MCP Streaming Utilities Module
Handles websocket streaming and logging for MCP operations.
"""
import asyncio
import logging
from typing import Any, Optional
logger = logging.getLogger(__name__)
class MCPStreamer:
"""
Handles streaming output for MCP operations.
Responsible for:
- Streaming... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "gpt_researcher/mcp/streaming.py",
"license": "Apache License 2.0",
"lines": 83,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
assafelovic/gpt-researcher:gpt_researcher/mcp/tool_selector.py | """
MCP Tool Selection Module
Handles intelligent tool selection using LLM analysis.
"""
import asyncio
import json
import logging
from typing import List, Dict, Any, Optional
logger = logging.getLogger(__name__)
class MCPToolSelector:
"""
Handles intelligent selection of MCP tools using LLM analysis.
... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "gpt_researcher/mcp/tool_selector.py",
"license": "Apache License 2.0",
"lines": 162,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
assafelovic/gpt-researcher:gpt_researcher/retrievers/mcp/retriever.py | """
MCP-Based Research Retriever
A retriever that uses Model Context Protocol (MCP) tools for intelligent research.
This retriever implements a two-stage approach:
1. Tool Selection: LLM selects 2-3 most relevant tools from all available MCP tools
2. Research Execution: LLM uses the selected tools to conduct intellige... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "gpt_researcher/retrievers/mcp/retriever.py",
"license": "Apache License 2.0",
"lines": 267,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
assafelovic/gpt-researcher:json_schema_generator.py | import json
from typing import Dict, Any
from pydantic import BaseModel
class UserSchema(BaseModel):
id: int
name: str
email: str
age: int
is_active: bool
def generate_structured_json(schema: BaseModel, data: Dict[str, Any]) -> str:
"""
Generate structured JSON output based on provided sch... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "json_schema_generator.py",
"license": "Apache License 2.0",
"lines": 37,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
assafelovic/gpt-researcher:tests/test_mcp.py | #!/usr/bin/env python3
"""
Test script for MCP integration in GPT Researcher
This script tests two MCP integration scenarios:
1. Web Search MCP (Tavily) - News and general web search queries
2. GitHub MCP - Code repository and technical documentation queries
Both tests verify:
- MCP server connection and tool usage
-... | {
"repo_id": "assafelovic/gpt-researcher",
"file_path": "tests/test_mcp.py",
"license": "Apache License 2.0",
"lines": 215,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
binary-husky/gpt_academic:crazy_functions/review_fns/prompts/adsabs_prompts.py | # ADS query optimization prompt
ADSABS_QUERY_PROMPT = """Analyze and optimize the following query for NASA ADS search.
If the query is not related to astronomy, astrophysics, or physics, return <query>none</query>.
If the query contains non-English terms, translate them to English first.
Query: {query}
Task: Transfor... | {
"repo_id": "binary-husky/gpt_academic",
"file_path": "crazy_functions/review_fns/prompts/adsabs_prompts.py",
"license": "GNU General Public License v3.0",
"lines": 59,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
binary-husky/gpt_academic:crazy_functions/review_fns/prompts/arxiv_prompts.py | # Basic type analysis prompt
ARXIV_TYPE_PROMPT = """Analyze the research query and determine if arXiv search is needed and its type.
Query: {query}
Task 1: Determine if this query requires arXiv search
- arXiv is suitable for:
* Computer science and AI/ML
* Physics and mathematics
* Quantitative biology and fin... | {
"repo_id": "binary-husky/gpt_academic",
"file_path": "crazy_functions/review_fns/prompts/arxiv_prompts.py",
"license": "GNU General Public License v3.0",
"lines": 261,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
binary-husky/gpt_academic:crazy_functions/review_fns/prompts/crossref_prompts.py | # Crossref query optimization prompt
CROSSREF_QUERY_PROMPT = """Analyze and optimize the query for Crossref search.
Query: {query}
Task: Transform the natural language query into an optimized Crossref search query.
Always generate English search terms regardless of the input language.
IMPORTANT: Ignore any requireme... | {
"repo_id": "binary-husky/gpt_academic",
"file_path": "crazy_functions/review_fns/prompts/crossref_prompts.py",
"license": "GNU General Public License v3.0",
"lines": 42,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
binary-husky/gpt_academic:crazy_functions/review_fns/prompts/pubmed_prompts.py | # PubMed search type prompt
PUBMED_TYPE_PROMPT = """Analyze the research query and determine the appropriate PubMed search type.
Query: {query}
Available search types:
1. basic: General keyword search for medical/biomedical topics
2. author: Search by author name
3. journal: Search within specific journals
4. none: Q... | {
"repo_id": "binary-husky/gpt_academic",
"file_path": "crazy_functions/review_fns/prompts/pubmed_prompts.py",
"license": "GNU General Public License v3.0",
"lines": 78,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
binary-husky/gpt_academic:crazy_functions/review_fns/prompts/semantic_prompts.py | # Search type prompt
SEMANTIC_TYPE_PROMPT = """Determine the most appropriate search type for Semantic Scholar.
Query: {query}
Task: Analyze the research query and select the most appropriate search type for Semantic Scholar API.
Available search types:
1. paper: General paper search
- Use for broad topic search... | {
"repo_id": "binary-husky/gpt_academic",
"file_path": "crazy_functions/review_fns/prompts/semantic_prompts.py",
"license": "GNU General Public License v3.0",
"lines": 206,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
binary-husky/gpt_academic:shared_utils/nltk_downloader.py | # Natural Language Toolkit: Corpus & Model Downloader
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
The NLTK corpus and module downloader. This module defines several
interfaces which can be used to dow... | {
"repo_id": "binary-husky/gpt_academic",
"file_path": "shared_utils/nltk_downloader.py",
"license": "GNU General Public License v3.0",
"lines": 2169,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | license |
black-forest-labs/flux:src/flux/cli_kontext.py | import os
import re
import time
from dataclasses import dataclass
from glob import iglob
import torch
from fire import Fire
from flux.content_filters import PixtralContentFilter
from flux.sampling import denoise, get_schedule, prepare_kontext, unpack
from flux.util import (
aspect_ratio_to_height_width,
check... | {
"repo_id": "black-forest-labs/flux",
"file_path": "src/flux/cli_kontext.py",
"license": "Apache License 2.0",
"lines": 325,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
black-forest-labs/flux:src/flux/content_filters.py | import torch
from einops import rearrange
from PIL import Image
from transformers import AutoProcessor, LlavaForConditionalGeneration, pipeline
PROMPT_IMAGE_INTEGRITY = """
Task: Analyze an image to identify potential copyright concerns or depictions of public figures.
Output: Respond with only "yes" or "no"
Criteri... | {
"repo_id": "black-forest-labs/flux",
"file_path": "src/flux/content_filters.py",
"license": "Apache License 2.0",
"lines": 142,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
black-forest-labs/flux:src/flux/trt/trt_config/base_trt_config.py | #
# SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# 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... | {
"repo_id": "black-forest-labs/flux",
"file_path": "src/flux/trt/trt_config/base_trt_config.py",
"license": "Apache License 2.0",
"lines": 228,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | license |
black-forest-labs/flux:src/flux/trt/trt_config/clip_trt_config.py | #
# SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# 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... | {
"repo_id": "black-forest-labs/flux",
"file_path": "src/flux/trt/trt_config/clip_trt_config.py",
"license": "Apache License 2.0",
"lines": 59,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | license |
black-forest-labs/flux:src/flux/trt/trt_config/t5_trt_config.py | #
# SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# 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... | {
"repo_id": "black-forest-labs/flux",
"file_path": "src/flux/trt/trt_config/t5_trt_config.py",
"license": "Apache License 2.0",
"lines": 72,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | license |
black-forest-labs/flux:src/flux/trt/trt_config/transformer_trt_config.py | #
# SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# 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... | {
"repo_id": "black-forest-labs/flux",
"file_path": "src/flux/trt/trt_config/transformer_trt_config.py",
"license": "Apache License 2.0",
"lines": 246,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | license |
black-forest-labs/flux:src/flux/trt/trt_config/vae_trt_config.py | #
# SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# 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... | {
"repo_id": "black-forest-labs/flux",
"file_path": "src/flux/trt/trt_config/vae_trt_config.py",
"license": "Apache License 2.0",
"lines": 235,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | license |
browser-use/browser-use:browser_use/browser/watchdogs/captcha_watchdog.py | """Captcha solver watchdog — monitors captcha events from the browser proxy.
Listens for BrowserUse.captchaSolverStarted/Finished CDP events and exposes a
wait_if_captcha_solving() method that the agent step loop uses to block until
a captcha is resolved (with a configurable timeout).
NOTE: Only a single captcha solv... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/browser/watchdogs/captcha_watchdog.py",
"license": "MIT License",
"lines": 174,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/browser/watchdogs/har_recording_watchdog.py | """HAR Recording Watchdog for Browser-Use sessions.
Captures HTTPS network activity via CDP Network domain and writes a HAR 1.2
file on browser shutdown. Respects `record_har_content` (omit/embed/attach)
and `record_har_mode` (full/minimal).
"""
from __future__ import annotations
import base64
import hashlib
import ... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/browser/watchdogs/har_recording_watchdog.py",
"license": "MIT License",
"lines": 690,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/__main__.py | """Entry point for: python -m browser_use.skill_cli"""
import sys
from browser_use.skill_cli.main import main
if __name__ == '__main__':
sys.exit(main())
| {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/__main__.py",
"license": "MIT License",
"lines": 5,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:browser_use/skill_cli/api_key.py | """API key management for browser-use CLI."""
import json
import os
import sys
from pathlib import Path
class APIKeyRequired(Exception):
"""Raised when API key is required but not provided."""
pass
def get_config_path() -> Path:
"""Get browser-use config file path."""
if sys.platform == 'win32':
base = Path... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/api_key.py",
"license": "MIT License",
"lines": 138,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/commands/agent.py | """Agent task command handler."""
import logging
import os
from typing import Any
from browser_use.skill_cli.api_key import APIKeyRequired, require_api_key
from browser_use.skill_cli.sessions import SessionInfo
logger = logging.getLogger(__name__)
# Cloud-only flags that only work in remote mode
CLOUD_ONLY_FLAGS = ... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/commands/agent.py",
"license": "MIT License",
"lines": 271,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/commands/browser.py | """Browser control commands."""
import asyncio
import base64
import logging
from pathlib import Path
from typing import Any
from browser_use.skill_cli.sessions import SessionInfo
logger = logging.getLogger(__name__)
COMMANDS = {
'open',
'click',
'type',
'input',
'scroll',
'back',
'screenshot',
'state',
'sw... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/commands/browser.py",
"license": "MIT License",
"lines": 614,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/commands/cloud_session.py | """Cloud session SDK wrappers and CLI handlers.
This module provides:
- SDK wrapper functions for the Browser-Use Cloud Session API
- CLI command handlers for `browser-use session <command>`
"""
import argparse
import json
import logging
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from ... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/commands/cloud_session.py",
"license": "MIT License",
"lines": 341,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/commands/cloud_task.py | """Cloud task SDK wrappers and CLI handlers.
This module provides:
- SDK wrapper functions for the Browser-Use Cloud Task API
- CLI command handlers for `browser-use task <command>`
"""
import argparse
import json
import logging
import sys
from typing import Any
from browser_use_sdk.types.task_created_response impor... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/commands/cloud_task.py",
"license": "MIT License",
"lines": 334,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/commands/doctor.py | """Doctor command - check installation and dependencies.
Validates that browser-use is properly installed and all dependencies
are available. Provides helpful diagnostic information and fixes.
"""
import logging
from typing import Any
logger = logging.getLogger(__name__)
COMMANDS = {'doctor'}
async def handle() -... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/commands/doctor.py",
"license": "MIT License",
"lines": 125,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/commands/profile.py | """Profile management command handlers.
Unified profile management that works with both local Chrome profiles and cloud profiles.
The behavior is determined by the browser mode (-b real or -b remote).
"""
import argparse
import json
import logging
import sys
import tempfile
from pathlib import Path
from typing import... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/commands/profile.py",
"license": "MIT License",
"lines": 558,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/commands/python_exec.py | """Python execution command handler."""
import asyncio
import logging
from pathlib import Path
from typing import Any
from browser_use.skill_cli.sessions import SessionInfo
logger = logging.getLogger(__name__)
async def handle(session: SessionInfo, params: dict[str, Any]) -> Any:
"""Handle python command.
Suppo... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/commands/python_exec.py",
"license": "MIT License",
"lines": 45,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:browser_use/skill_cli/commands/session.py | """Session management command handlers."""
import logging
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from browser_use.skill_cli.sessions import SessionRegistry
logger = logging.getLogger(__name__)
COMMANDS = {'sessions', 'close'}
async def handle(action: str, session_name: str, registry: 'SessionReg... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/commands/session.py",
"license": "MIT License",
"lines": 30,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:browser_use/skill_cli/commands/utils.py | """Shared utilities for CLI command handlers."""
from datetime import datetime, timezone
from browser_use_sdk import BrowserUse
_client: BrowserUse | None = None
def get_sdk_client() -> BrowserUse:
"""Get authenticated SDK client (singleton)."""
global _client
if _client is None:
from browser_use.skill_cli.ap... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/commands/utils.py",
"license": "MIT License",
"lines": 35,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:browser_use/skill_cli/direct.py | """Serverless CLI for browser-use - runs commands directly without a session server.
Each command reconnects to the browser via CDP WebSocket URL saved to a state file.
The browser process stays alive between commands; only the Python process exits.
Two-tier reconnection:
Tier 1 (Lightweight CDP, ~200ms): Most comm... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/direct.py",
"license": "MIT License",
"lines": 594,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/install_config.py | """Install configuration - tracks which browser modes are available.
This module manages the installation configuration that determines which browser
modes (chromium, real, remote) are available based on how browser-use was installed.
Config file: ~/.browser-use/install-config.json
When no config file exists (e.g., ... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/install_config.py",
"license": "MIT License",
"lines": 82,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:browser_use/skill_cli/main.py | #!/usr/bin/env python3
"""Fast CLI for browser-use. STDLIB ONLY - must start in <50ms.
This is the main entry point for the browser-use CLI. It uses only stdlib
imports to ensure fast startup, delegating heavy operations to the session
server which loads once and stays running.
"""
import argparse
import asyncio
impo... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/main.py",
"license": "MIT License",
"lines": 1034,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/protocol.py | """Wire protocol for CLI↔Server communication.
Uses JSON over Unix sockets (or TCP on Windows) with newline-delimited messages.
"""
import json
from dataclasses import asdict, dataclass, field
from typing import Any
@dataclass
class Request:
"""Command request from CLI to server."""
id: str
action: str
session... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/protocol.py",
"license": "MIT License",
"lines": 42,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:browser_use/skill_cli/python_session.py | """Jupyter-like persistent Python execution for browser-use CLI."""
import asyncio
import io
import traceback
from contextlib import redirect_stderr, redirect_stdout
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal
if TYPE_CHECKING:
from browser_use.bro... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/python_session.py",
"license": "MIT License",
"lines": 202,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/server.py | """Session server - keeps BrowserSession instances alive.
This server runs as a background process, managing browser sessions and
handling commands from the CLI. It uses Unix sockets (or TCP on Windows)
for IPC communication.
"""
import argparse
import asyncio
import json
import logging
import os
import signal
import... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/server.py",
"license": "MIT License",
"lines": 241,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/sessions.py | """Session registry - manages BrowserSession instances."""
import logging
from dataclasses import dataclass, field
from typing import Any
from browser_use.browser.session import BrowserSession
from browser_use.skill_cli.python_session import PythonSession
logger = logging.getLogger(__name__)
@dataclass
class Sessi... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/sessions.py",
"license": "MIT License",
"lines": 122,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/tunnel.py | """Cloudflared tunnel binary management.
This module manages the cloudflared binary for tunnel support.
Cloudflared must be installed via install.sh or manually by the user.
Tunnels are managed independently of browser sessions - they are purely
a network utility for exposing local ports via Cloudflare quick tunnels.... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/tunnel.py",
"license": "MIT License",
"lines": 256,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skill_cli/utils.py | """Platform utilities for CLI and server."""
import hashlib
import os
import platform
import signal
import subprocess
import sys
import tempfile
from pathlib import Path
from typing import IO
import portalocker
def get_socket_path(session: str) -> str:
"""Get socket path for session.
On Windows, returns a TCP ad... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skill_cli/utils.py",
"license": "MIT License",
"lines": 251,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/tools/extraction/schema_utils.py | """Converts a JSON Schema dict to a runtime Pydantic model for structured extraction."""
import logging
from typing import Any
from pydantic import BaseModel, ConfigDict, Field, create_model
logger = logging.getLogger(__name__)
# Keywords that indicate composition/reference patterns we don't support
_UNSUPPORTED_KE... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/tools/extraction/schema_utils.py",
"license": "MIT License",
"lines": 131,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/tools/extraction/views.py | """Pydantic models for the extraction subsystem."""
from typing import Any
from pydantic import BaseModel, ConfigDict, Field
class ExtractionResult(BaseModel):
"""Metadata about a structured extraction, stored in ActionResult.metadata."""
model_config = ConfigDict(extra='forbid')
data: dict[str, Any] = Field(d... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/tools/extraction/views.py",
"license": "MIT License",
"lines": 11,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:examples/browser/custom_headers.py | """
Custom HTTP Headers via a custom Watchdog.
Creates a custom watchdog that listens to TabCreatedEvent and injects
custom HTTP headers into every new tab using Network.setExtraHTTPHeaders.
Note: The CDP EventRegistry only supports one handler per event method,
so registering directly on Target.attachedToTarget woul... | {
"repo_id": "browser-use/browser-use",
"file_path": "examples/browser/custom_headers.py",
"license": "MIT License",
"lines": 78,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:examples/features/csv_file_generation.py | """
Generate CSV files with automatic normalization.
The agent's file system automatically normalizes CSV output using Python's csv module,
so fields containing commas, quotes, or empty values are properly handled per RFC 4180.
This means the agent doesn't need to worry about manual quoting — it's fixed at the
infrast... | {
"repo_id": "browser-use/browser-use",
"file_path": "examples/features/csv_file_generation.py",
"license": "MIT License",
"lines": 38,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:examples/features/save_as_pdf.py | """
Save any webpage as a PDF using the save_as_pdf action.
The agent can save the current page as a PDF at any point during a task.
Supports custom filenames, paper sizes (Letter, A4, Legal, A3, Tabloid),
landscape orientation, and background printing.
Setup:
1. Get your API key from https://cloud.browser-use.com/ne... | {
"repo_id": "browser-use/browser-use",
"file_path": "examples/features/save_as_pdf.py",
"license": "MIT License",
"lines": 33,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:tests/ci/browser/test_navigation_slow_pages.py | """
Test navigation on heavy/slow-loading pages (e.g. e-commerce PDPs).
Reproduces the issue where navigating to heavy pages like stevemadden.com PDPs
fails due to NavigateToUrlEvent timing out.
Usage:
uv run pytest tests/ci/browser/test_navigation_slow_pages.py -v -s
"""
import asyncio
import time
import pytest
f... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/browser/test_navigation_slow_pages.py",
"license": "MIT License",
"lines": 160,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/interactions/test_autocomplete_interaction.py | """Test autocomplete/combobox field detection, value readback, and input clearing.
Tests cover:
- Value mismatch detection when JS rewrites input value
- Combobox field detection (role=combobox + aria-autocomplete)
- Datalist field detection (input with list attribute)
- No false positives on plain inputs
- Sensitive ... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/interactions/test_autocomplete_interaction.py",
"license": "MIT License",
"lines": 318,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_action_loop_detection.py | """Tests for action loop detection — behavioral cycle breaking (PR #4)."""
from browser_use.agent.service import Agent
from browser_use.agent.views import (
ActionLoopDetector,
PageFingerprint,
compute_action_hash,
)
from browser_use.llm.messages import UserMessage
from tests.ci.conftest import create_mock_llm
de... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_action_loop_detection.py",
"license": "MIT License",
"lines": 303,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_action_save_as_pdf.py | import asyncio
import tempfile
import anyio
import pytest
from pytest_httpserver import HTTPServer
from browser_use.agent.views import ActionResult
from browser_use.browser import BrowserSession
from browser_use.browser.profile import BrowserProfile
from browser_use.filesystem.file_system import FileSystem
from brows... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_action_save_as_pdf.py",
"license": "MIT License",
"lines": 226,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_agent_planning.py | """Tests for inline task planning feature.
Covers: plan generation, step advancement, replanning, rendering,
disabled planning, replan nudge, flash mode schema, and edge cases.
"""
import json
from browser_use.agent.views import (
AgentOutput,
PlanItem,
)
from browser_use.tools.service import Tools
# ------------... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_agent_planning.py",
"license": "MIT License",
"lines": 277,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_budget_warning.py | """Tests for step budget warning injection (IMP-7a)."""
from browser_use.agent.service import Agent
from browser_use.agent.views import AgentStepInfo
from browser_use.llm.messages import UserMessage
from tests.ci.conftest import create_mock_llm
def _get_context_messages(agent: Agent) -> list[str]:
"""Extract text c... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_budget_warning.py",
"license": "MIT License",
"lines": 113,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_cli_coordinate_click.py | """Tests for CLI coordinate clicking support.
Verifies that the CLI correctly parses both index-based and coordinate-based
click commands, that the browser command handler dispatches the right events,
and that the direct CLI selector map cache works correctly.
"""
from __future__ import annotations
from typing impor... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_cli_coordinate_click.py",
"license": "MIT License",
"lines": 272,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_cli_headed_flag.py | """Tests for CLI argument parsing, specifically the --headed flag behavior."""
from browser_use.skill_cli.main import build_parser
def test_headed_flag_before_open_subcommand():
"""Test that --headed flag before 'open' subcommand is properly parsed.
Regression test for issue #3931: The open subparser had a duplic... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_cli_headed_flag.py",
"license": "MIT License",
"lines": 32,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_cli_install_init.py | """
Tests for browser-use CLI install and init commands.
These commands are handled early in the CLI before argparse, to avoid loading
heavy dependencies for simple setup tasks.
"""
import subprocess
import sys
def test_install_command_help():
"""Test that the install command is documented in help."""
result = su... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_cli_install_init.py",
"license": "MIT License",
"lines": 66,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_doctor_command.py | """Tests for doctor command."""
import pytest
from browser_use.skill_cli.commands import doctor
@pytest.mark.asyncio
async def test_doctor_handle_returns_valid_structure():
"""Test that doctor.handle() returns a valid result structure."""
result = await doctor.handle()
# Verify structure
assert 'status' in res... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_doctor_command.py",
"license": "MIT License",
"lines": 99,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_install_config.py | """Tests for install configuration module."""
import json
from pathlib import Path
from unittest.mock import patch
import pytest
class TestInstallConfig:
"""Tests for browser_use.skill_cli.install_config module."""
@pytest.fixture
def temp_config_dir(self, tmp_path: Path):
"""Create a temporary config directo... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_install_config.py",
"license": "MIT License",
"lines": 130,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_markdown_chunking.py | """Tests for structure-aware markdown chunking."""
from markdownify import markdownify as md
from pytest_httpserver import HTTPServer
from browser_use.dom.markdown_extractor import chunk_markdown_by_structure
# ---------------------------------------------------------------------------
# Unit tests — synchronous, no... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_markdown_chunking.py",
"license": "MIT License",
"lines": 285,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_multi_act_guards.py | """
Tests for multi_act() page-change guards.
Verifies:
1. Metadata: terminates_sequence flags are set correctly on built-in actions
2. Static guard: actions tagged terminates_sequence abort remaining queued actions
3. Runtime guard: URL/focus changes detected after click-on-link abort remaining actions
4. Safe chain:... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_multi_act_guards.py",
"license": "MIT License",
"lines": 221,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_search_find.py | """Tests for search_page and find_elements actions."""
import asyncio
import pytest
from pytest_httpserver import HTTPServer
from browser_use.agent.views import ActionResult
from browser_use.browser import BrowserProfile, BrowserSession
from browser_use.tools.service import Tools
# --- Fixtures ---
@pytest.fixtur... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_search_find.py",
"license": "MIT License",
"lines": 335,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_server_locking.py | """Tests for server locking to prevent race conditions."""
import os
import subprocess
import sys
import tempfile
import time
from pathlib import Path
import portalocker
import pytest
from browser_use.skill_cli.utils import (
cleanup_session_files,
get_lock_path,
get_pid_path,
is_server_running,
is_session_lock... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_server_locking.py",
"license": "MIT License",
"lines": 198,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_session_browser_mode.py | """Tests for session browser mode validation.
When a session is started with a specific browser mode (chromium, remote, real),
subsequent commands with a different mode should error with helpful guidance.
"""
import json
import tempfile
from pathlib import Path
from browser_use.skill_cli.main import get_session_meta... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_session_browser_mode.py",
"license": "MIT License",
"lines": 138,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_setup_command.py | """Tests for setup command.
These tests call real functions without mocking. They verify the
structure and logic of the setup command against actual system state.
"""
from browser_use.skill_cli.commands import setup
async def test_setup_local_mode():
"""Test setup with local mode runs without error."""
result = a... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_setup_command.py",
"license": "MIT License",
"lines": 169,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_structured_extraction.py | """Tests for schema-enforced structured extraction."""
import asyncio
import json
import tempfile
from unittest.mock import AsyncMock
import pytest
from pydantic import ValidationError
from pytest_httpserver import HTTPServer
from browser_use.agent.views import ActionResult
from browser_use.browser import BrowserPro... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_structured_extraction.py",
"license": "MIT License",
"lines": 543,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:tests/ci/test_tunnel.py | """Tests for tunnel module - cloudflared binary management."""
from unittest.mock import patch
import pytest
from browser_use.skill_cli.tunnel import TunnelManager, get_tunnel_manager
@pytest.fixture
def tunnel_manager():
"""Create a fresh TunnelManager instance for testing."""
return TunnelManager()
def test_... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/test_tunnel.py",
"license": "MIT License",
"lines": 61,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:browser_use/llm/mistral/chat.py | from __future__ import annotations
import json
import logging
import os
from collections.abc import Mapping
from dataclasses import dataclass
from typing import Any, TypeVar, cast, overload
import httpx
from pydantic import BaseModel
from browser_use.llm.base import BaseChatModel
from browser_use.llm.exceptions impo... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/llm/mistral/chat.py",
"license": "MIT License",
"lines": 183,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/llm/mistral/schema.py | """Schema optimizer for Mistral-compatible JSON schemas."""
from __future__ import annotations
from typing import Any
from pydantic import BaseModel
from browser_use.llm.schema import SchemaOptimizer
class MistralSchemaOptimizer:
"""Create JSON schemas that avoid Mistral's unsupported keywords."""
UNSUPPORTED_... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/llm/mistral/schema.py",
"license": "MIT License",
"lines": 25,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:browser_use/llm/openai/responses_serializer.py | """Serializer for converting messages to OpenAI Responses API input format."""
from typing import overload
from openai.types.responses.easy_input_message_param import EasyInputMessageParam
from openai.types.responses.response_input_image_param import ResponseInputImageParam
from openai.types.responses.response_input_... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/llm/openai/responses_serializer.py",
"license": "MIT License",
"lines": 119,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/llm/tests/test_mistral_schema.py | from pydantic import BaseModel, Field
from browser_use.llm.mistral.schema import MistralSchemaOptimizer
class NestedExample(BaseModel):
code: str = Field(..., min_length=2, max_length=4, pattern='[A-Z]+')
description: str
class RootExample(BaseModel):
item: NestedExample
email: str = Field(..., json_schema_ext... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/llm/tests/test_mistral_schema.py",
"license": "MIT License",
"lines": 19,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
browser-use/browser-use:browser_use/skills/service.py | """Skills service for fetching and executing skills from the Browser Use API"""
import logging
import os
from typing import Any, Literal
from browser_use_sdk import AsyncBrowserUse
from browser_use_sdk.types.execute_skill_response import ExecuteSkillResponse
from browser_use_sdk.types.skill_list_response import Skill... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skills/service.py",
"license": "MIT License",
"lines": 225,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skills/utils.py | """Utilities for skill schema conversion"""
from typing import Any
from pydantic import BaseModel, Field, create_model
from browser_use.skills.views import ParameterSchema
def convert_parameters_to_pydantic(parameters: list[ParameterSchema], model_name: str = 'SkillParameters') -> type[BaseModel]:
"""Convert a li... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skills/utils.py",
"license": "MIT License",
"lines": 110,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:browser_use/skills/views.py | """Skills views - wraps SDK types with helper methods"""
from typing import Any
from browser_use_sdk.types.parameter_schema import ParameterSchema
from browser_use_sdk.types.skill_response import SkillResponse
from pydantic import BaseModel, ConfigDict, Field
class MissingCookieException(Exception):
"""Raised when... | {
"repo_id": "browser-use/browser-use",
"file_path": "browser_use/skills/views.py",
"license": "MIT License",
"lines": 52,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
browser-use/browser-use:examples/features/fallback_model.py | """
Example: Using a fallback LLM model.
When the primary LLM fails with rate limits (429), authentication errors (401),
payment/credit errors (402), or server errors (500, 502, 503, 504), the agent
automatically switches to the fallback model and continues execution.
Note: The primary LLM will first exhaust its own ... | {
"repo_id": "browser-use/browser-use",
"file_path": "examples/features/fallback_model.py",
"license": "MIT License",
"lines": 39,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:examples/models/bu_oss.py | """
Setup:
1. Get your API key from https://cloud.browser-use.com/new-api-key
2. Set environment variable: export BROWSER_USE_API_KEY="your-key"
"""
from dotenv import load_dotenv
from browser_use import Agent, ChatBrowserUse
load_dotenv()
try:
from lmnr import Laminar
Laminar.initialize()
except ImportError:
p... | {
"repo_id": "browser-use/browser-use",
"file_path": "examples/models/bu_oss.py",
"license": "MIT License",
"lines": 23,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:examples/models/mistral.py | """
Simple agent run with Mistral.
You need to set MISTRAL_API_KEY in your environment (and optionally MISTRAL_BASE_URL).
"""
import asyncio
from dotenv import load_dotenv
from browser_use import Agent
from browser_use.llm.mistral import ChatMistral
load_dotenv()
llm = ChatMistral(model='mistral-small-2506', temp... | {
"repo_id": "browser-use/browser-use",
"file_path": "examples/models/mistral.py",
"license": "MIT License",
"lines": 18,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:examples/models/skills.py | import asyncio
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from dotenv import load_dotenv
from browser_use import Agent
load_dotenv()
async def run_search():
agent = Agent(
# llm=llm,
task='How many stars does the browser-use repo have?',... | {
"repo_id": "browser-use/browser-use",
"file_path": "examples/models/skills.py",
"license": "MIT License",
"lines": 17,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:examples/sandbox/structured_output.py | """Example of using structured output with sandbox execution
To run:
export BROWSER_USE_API_KEY=your_key
python examples/sandbox/structured_output.py
"""
import asyncio
import os
from pydantic import BaseModel, Field
from browser_use import Agent, Browser, ChatBrowserUse, sandbox
from browser_use.agent.view... | {
"repo_id": "browser-use/browser-use",
"file_path": "examples/sandbox/structured_output.py",
"license": "MIT License",
"lines": 42,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
browser-use/browser-use:tests/ci/browser/test_cdp_headers.py | """
Test that headers are properly passed to CDPClient for authenticated remote browser connections.
This tests the fix for: When using browser-use with remote browser services that require
authentication headers, these headers need to be included in the WebSocket handshake.
"""
from unittest.mock import AsyncMock, M... | {
"repo_id": "browser-use/browser-use",
"file_path": "tests/ci/browser/test_cdp_headers.py",
"license": "MIT License",
"lines": 124,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.