sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
PrefectHQ/prefect:src/integrations/prefect-kubernetes/prefect_kubernetes/_logging.py
import logging from typing import Any, Optional from pythonjsonlogger.core import RESERVED_ATTRS from pythonjsonlogger.json import JsonFormatter DEFAULT_JSON_REFKEY = "object" class KopfObjectJsonFormatter(JsonFormatter): """ Log formatter for kopf objects. This formatter will filter unserializable fie...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-kubernetes/prefect_kubernetes/_logging.py", "license": "Apache License 2.0", "lines": 47, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/integrations/prefect-kubernetes/tests/test_logging.py
import json import logging from typing import Any from prefect_kubernetes._logging import KopfObjectJsonFormatter class TestKopfObjectJsonFormatter: """Tests for the KopfObjectJsonFormatter""" def test_filters_unserializable_kopf_fields(self): """ Test that kopf-specific fields (k8s_skip, k8...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-kubernetes/tests/test_logging.py", "license": "Apache License 2.0", "lines": 183, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/_internal/pydantic/validated_func.py
""" Pure Pydantic v2 implementation of function argument validation. This module provides validation of function arguments without calling the function, compatible with Python 3.14+ (no Pydantic v1 dependency). """ from __future__ import annotations import inspect from typing import Any, Callable, ClassVar, Optional...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/_internal/pydantic/validated_func.py", "license": "Apache License 2.0", "lines": 311, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:tests/_internal/pydantic/test_validated_func.py
"""Tests for the pure Pydantic v2 validated function implementation.""" from unittest.mock import patch import pytest from pydantic import BaseModel, ValidationError from prefect._internal.pydantic.validated_func import ValidatedFunction class TestBasicValidation: """Test basic function argument validation."""...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/_internal/pydantic/test_validated_func.py", "license": "Apache License 2.0", "lines": 400, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/concurrency/_sync.py
from __future__ import annotations from contextlib import contextmanager from typing import Generator, Literal, Optional from uuid import UUID from prefect.client.schemas.objects import ConcurrencyLeaseHolder from prefect.client.schemas.responses import ( ConcurrencyLimitWithLeaseResponse, MinimalConcurrencyL...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/concurrency/_sync.py", "license": "Apache License 2.0", "lines": 132, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:examples/ai_data_analyst_with_pydantic_ai.py
# --- # title: AI-Powered Data Analyst # description: Build a resilient AI data analyst using Prefect and `pydantic-ai` to analyze datasets, detect anomalies, and generate insights. # icon: robot # dependencies: ["prefect", "pydantic-ai[prefect]", "pandas"] # keywords: ["ai", "agents", "pydantic-ai", "data-analysis", "...
{ "repo_id": "PrefectHQ/prefect", "file_path": "examples/ai_data_analyst_with_pydantic_ai.py", "license": "Apache License 2.0", "lines": 288, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/integrations/prefect-azure/prefect_azure/repository.py
"""Interact with files stored in Azure DevOps Git repositories. The `AzureDevopsRepository` class in this module is a storage block that lets Prefect agents pull Prefect flow code from Azure DevOps repositories. The `AzureDevopsRepository` block is ideally configured via the Prefect UI, but can also be used in Python...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-azure/prefect_azure/repository.py", "license": "Apache License 2.0", "lines": 176, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/integrations/prefect-azure/tests/test_repository.py
import urllib.parse from pathlib import Path from tempfile import TemporaryDirectory from unittest.mock import AsyncMock import pytest from prefect_azure.credentials import AzureDevopsCredentials from prefect_azure.repository import AzureDevopsRepository from pydantic import SecretStr class TestAzureDevopsRepository...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-azure/tests/test_repository.py", "license": "Apache License 2.0", "lines": 155, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/_experimental/plugins/apply.py
""" Safe application of plugin setup results with secret redaction. """ from __future__ import annotations import logging import os from prefect._experimental.plugins.spec import SetupResult REDACT_KEYS = ("SECRET", "TOKEN", "PASSWORD", "KEY") def redact(key: str, value: str) -> str: """ Redact sensitive ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/_experimental/plugins/apply.py", "license": "Apache License 2.0", "lines": 46, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
PrefectHQ/prefect:src/prefect/_experimental/plugins/diagnostics.py
""" Diagnostic data structures for plugin system. """ from __future__ import annotations from dataclasses import dataclass @dataclass class SetupSummary: """ Summary of a plugin's setup_environment execution. Attributes: plugin: Name of the plugin env_preview: Preview of environment var...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/_experimental/plugins/diagnostics.py", "license": "Apache License 2.0", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
PrefectHQ/prefect:src/prefect/_experimental/plugins/manager.py
""" Plugin manager using pluggy with async bridge. """ from __future__ import annotations import importlib.metadata as md import inspect import logging import sys from typing import Any import pluggy from packaging.specifiers import InvalidSpecifier, SpecifierSet from prefect._experimental.plugins.spec import PREFE...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/_experimental/plugins/manager.py", "license": "Apache License 2.0", "lines": 112, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/_experimental/plugins/spec.py
""" Experimental plugin API specification. This module defines the hook specification and data structures for Prefect's experimental plugin system. """ from __future__ import annotations import logging from dataclasses import dataclass from typing import Any, Callable, Mapping, Optional import pluggy # Bump this w...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/_experimental/plugins/spec.py", "license": "Apache License 2.0", "lines": 78, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
PrefectHQ/prefect:src/prefect/cli/experimental.py
""" Experimental command — native cyclopts implementation. Access experimental features (subject to change). """ import cyclopts import prefect.cli._app as _cli from prefect.cli._utilities import with_cli_exception_handling experimental_app: cyclopts.App = cyclopts.App( name="experimental", help="Access exp...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/experimental.py", "license": "Apache License 2.0", "lines": 121, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:tests/_experimental/plugins/test_plugins.py
""" Tests for the experimental plugin system. """ from __future__ import annotations import asyncio import logging import os import sys from unittest.mock import Mock, patch import pytest from prefect._experimental.plugins import run_startup_hooks from prefect._experimental.plugins.apply import redact, summarize_en...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/_experimental/plugins/test_plugins.py", "license": "Apache License 2.0", "lines": 489, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/cli/flow_runs_watching.py
""" Utilities for following flow runs with interleaved events and logs """ from __future__ import annotations from datetime import datetime from typing import TYPE_CHECKING from uuid import UUID import anyio from rich.console import Console from prefect.client.orchestration import get_client from prefect.client.sch...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/flow_runs_watching.py", "license": "Apache License 2.0", "lines": 151, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/events/subscribers.py
""" Flow run subscriber that interleaves events and logs from a flow run """ from __future__ import annotations import asyncio from types import TracebackType from typing import TYPE_CHECKING, Any, Optional, Union from uuid import UUID from typing_extensions import Self from prefect.client.schemas.filters import Lo...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/events/subscribers.py", "license": "Apache License 2.0", "lines": 156, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:tests/cli/test_flow_run_watching.py
"""Tests for flow run watching functionality""" from __future__ import annotations import asyncio import pytest from rich.console import Console from prefect import flow from prefect.cli.flow_runs_watching import watch_flow_run from prefect.client.orchestration import PrefectClient from prefect.exceptions import Fl...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/test_flow_run_watching.py", "license": "Apache License 2.0", "lines": 87, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/events/client/test_flow_run_subscriber.py
from __future__ import annotations import asyncio from datetime import datetime, timedelta, timezone from uuid import UUID, uuid4 import pytest from typing_extensions import Self import prefect.events.subscribers from prefect.client.schemas.objects import Log from prefect.events import Event, Resource from prefect.e...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/events/client/test_flow_run_subscriber.py", "license": "Apache License 2.0", "lines": 343, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/client/test_subscriptions.py
import ssl import pytest from prefect.client.schemas import TaskRun from prefect.client.subscriptions import Subscription from prefect.settings import ( PREFECT_API_TLS_INSECURE_SKIP_VERIFY, PREFECT_CLIENT_CUSTOM_HEADERS, temporary_settings, ) def test_subscription_uses_websocket_connect_with_ssl_for_ws...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/client/test_subscriptions.py", "license": "Apache License 2.0", "lines": 121, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/cli/api.py
""" API command — native cyclopts implementation. Make direct requests to the Prefect API. """ import json import sys from typing import Annotated, Any, Optional import cyclopts import prefect.cli._app as _cli from prefect.cli._utilities import ( exit_with_error, with_cli_exception_handling, ) api_app: cyc...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/api.py", "license": "Apache License 2.0", "lines": 223, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:tests/cli/test_api_command.py
import json from uuid import UUID import httpx import pytest from respx import MockRouter from prefect.settings import ( PREFECT_API_URL, PREFECT_CLIENT_CSRF_SUPPORT_ENABLED, PREFECT_CLOUD_API_URL, PREFECT_SERVER_ALLOW_EPHEMERAL_MODE, temporary_settings, ) from prefect.testing.cli import invoke_an...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/test_api_command.py", "license": "Apache License 2.0", "lines": 388, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/deploy/test_schedule_config.py
"""Tests for schedule configuration in deployment YAML.""" import pytest from prefect.cli.deploy._models import RawScheduleConfig from prefect.cli.deploy._schedules import _schedule_config_to_deployment_schedule from prefect.client.schemas.schedules import CronSchedule, IntervalSchedule def test_cron_schedule_with_...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/deploy/test_schedule_config.py", "license": "Apache License 2.0", "lines": 73, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:examples/atproto_dashboard_with_prefect_assets.py
# --- # title: Social Analytics Dashboard # description: Build a social media analytics dashboard using Prefect Assets, ATProto/Bluesky APIs, dbt transformations, and Streamlit visualization. # icon: chart-bar # dependencies: ["prefect", "prefect-aws"] # cmd: ["python", "atproto_dashboard_with_prefect_assets.py"] # tag...
{ "repo_id": "PrefectHQ/prefect", "file_path": "examples/atproto_dashboard_with_prefect_assets.py", "license": "Apache License 2.0", "lines": 196, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/types/_schema.py
"""Types for OpenAPI schemas.""" from typing import Annotated, Any from pydantic import BeforeValidator def _normalize_parameter_schema(value: Any) -> dict[str, Any]: """ Normalize empty or None parameter schemas to valid OpenAPI format. Ensures parameter_openapi_schema is always a valid OpenAPI object...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/types/_schema.py", "license": "Apache License 2.0", "lines": 16, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:tests/cli/deploy/test_format_validation_error.py
"""Tests for the _format_validation_error function.""" import uuid import pytest from pydantic import ValidationError from prefect.cli.deploy._config import _format_validation_error from prefect.cli.deploy._models import PrefectYamlModel def test_format_validation_error_with_invalid_schedule(): """Test error f...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/deploy/test_format_validation_error.py", "license": "Apache License 2.0", "lines": 210, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/events/test_events_text_search.py
"""Tests for text search functionality across events storage backends""" from datetime import datetime, timedelta, timezone from typing import Awaitable, Callable, Optional, Union from uuid import uuid4 import pytest from sqlalchemy.ext.asyncio import AsyncSession from prefect.events.schemas.events import Event, Res...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/events/test_events_text_search.py", "license": "Apache License 2.0", "lines": 508, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/server/api/test_logs_text_search.py
"""Tests for text search functionality across logs storage backends""" from datetime import datetime, timedelta, timezone from typing import Awaitable, Callable, Union from uuid import uuid4 import pytest from sqlalchemy.ext.asyncio import AsyncSession from prefect.server import models from prefect.server.models.log...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/server/api/test_logs_text_search.py", "license": "Apache License 2.0", "lines": 467, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/server/utilities/test_text_search_parser.py
"""Tests for text search query parser Tests the parsing of text search queries according to the following syntax: - Space-separated terms → OR logic (include) - Prefix with `-` or `!` → Exclude term - Prefix with `+` → Required term (AND logic, future) - Quote phrases → Match exact phrase - Case-insensitive, substrin...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/server/utilities/test_text_search_parser.py", "license": "Apache License 2.0", "lines": 523, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/server/orchestration/test_task_concurrency_v2_integration.py
""" Tests for V2 Global Concurrency Limits integration in task orchestration rules. These tests cover the integration between tag-based task concurrency (V1) and Global Concurrency Limits V2 in SecureTaskConcurrencySlots and ReleaseTaskConcurrencySlots. """ import contextlib from typing import Any, Callable from sql...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/server/orchestration/test_task_concurrency_v2_integration.py", "license": "Apache License 2.0", "lines": 564, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/_internal/compatibility/starlette.py
""" Compatibility wrapper for starlette status codes. Starlette 0.48.0 renamed several status codes per RFC 9110. This module provides backwards-compatible access to these codes. """ from starlette import status as _starlette_status class _StatusCompatibility: """ Compatibility wrapper that maintains old st...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/_internal/compatibility/starlette.py", "license": "Apache License 2.0", "lines": 38, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/prefect/cli/deploy/_models.py
from __future__ import annotations from datetime import timedelta from typing import Any, Dict, List, Optional, Union from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator from prefect._experimental.sla.objects import SlaTypes from prefect.client.schemas.actions import DeploymentSchedul...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/deploy/_models.py", "license": "Apache License 2.0", "lines": 111, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/prefect/cli/deploy/_actions.py
from __future__ import annotations import os from getpass import GetPassWarning from pathlib import Path from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional from prefect.blocks.system import Secret from prefect.cli._prompts import ( confirm, prompt, prompt_select_blob_storage_credentials...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/deploy/_actions.py", "license": "Apache License 2.0", "lines": 220, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/deploy/_commands.py
""" Deploy command — native cyclopts implementation. Reuses all business logic from prefect.cli.deploy.* modules, threading `console` and `is_interactive` as parameters. """ from __future__ import annotations from pathlib import Path from typing import Annotated, Any import cyclopts from rich.prompt import Prompt f...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/deploy/_commands.py", "license": "Apache License 2.0", "lines": 455, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/deploy/_config.py
from __future__ import annotations import json import re from copy import deepcopy from pathlib import Path from typing import TYPE_CHECKING, Any, Callable, Optional import yaml from pydantic import ValidationError from yaml.error import YAMLError from prefect.utilities.annotations import NotSet if TYPE_CHECKING: ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/deploy/_config.py", "license": "Apache License 2.0", "lines": 471, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/deploy/_core.py
from __future__ import annotations import inspect import os from copy import deepcopy from pathlib import Path from typing import TYPE_CHECKING, Any, Callable, Optional from rich.markup import escape from rich.panel import Panel from prefect.cli._prompts import ( confirm, prompt, prompt_build_custom_dock...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/deploy/_core.py", "license": "Apache License 2.0", "lines": 469, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/deploy/_schedules.py
from __future__ import annotations import json from datetime import timedelta from typing import TYPE_CHECKING, Any, Callable from prefect.cli._prompts import prompt_schedules from prefect.client.schemas.schedules import ( CronSchedule, IntervalSchedule, RRuleSchedule, ) from prefect.types._datetime impor...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/deploy/_schedules.py", "license": "Apache License 2.0", "lines": 82, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/deploy/_sla.py
from __future__ import annotations import json from typing import Any, List, Union from uuid import UUID from pydantic import TypeAdapter from prefect._experimental.sla.objects import SlaTypes from prefect.client.base import ServerType from prefect.client.orchestration import PrefectClient SlaAdapter: TypeAdapter[S...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/deploy/_sla.py", "license": "Apache License 2.0", "lines": 49, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/deploy/_storage.py
from __future__ import annotations from pathlib import Path from typing import Any class _PullStepStorage: """ A shim storage class that allows passing pull steps to a `RunnerDeployment`. """ def __init__(self, pull_steps: list[dict[str, Any]]): self._base_path = Path.cwd() self.pull...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/deploy/_storage.py", "license": "Apache License 2.0", "lines": 24, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/prefect/cli/deploy/_triggers.py
from __future__ import annotations import json from typing import Any from uuid import UUID from pydantic import TypeAdapter from prefect.client.orchestration import PrefectClient from prefect.events import DeploymentTriggerTypes, TriggerTypes from prefect.exceptions import PrefectHTTPStatusError DeploymentTriggerA...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/deploy/_triggers.py", "license": "Apache License 2.0", "lines": 55, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/types/_concurrency.py
from typing import ClassVar, Literal from uuid import UUID from pydantic import BaseModel, ConfigDict class ConcurrencyLeaseHolder(BaseModel): """Model for validating concurrency lease holder information.""" model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid") type: Literal["flow_run", "task...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/types/_concurrency.py", "license": "Apache License 2.0", "lines": 8, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:tests/events/client/test_automations_schema.py
"""Tests for client-side automation schema validation and deserialization.""" import uuid from prefect.events.schemas.automations import ( Automation, MetricTrigger, MetricTriggerQuery, Posture, ) def test_metric_trigger_deserialization(): """Test that metric triggers can be deserialized from AP...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/events/client/test_automations_schema.py", "license": "Apache License 2.0", "lines": 83, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/events/client/test_deployment_trigger_schedule_after.py
from datetime import timedelta import pytest from pydantic import ValidationError from prefect.events.schemas.deployment_triggers import DeploymentEventTrigger async def test_deployment_trigger_can_omit_schedule_after_field(): """Test that the schedule_after field defaults to timedelta(0)""" trigger = Deplo...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/events/client/test_deployment_trigger_schedule_after.py", "license": "Apache License 2.0", "lines": 52, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:scripts/prepare_integration_release_notes.py
#!/usr/bin/env python3 """ Prepare release notes for Prefect integration packages. This script generates release notes from commits since the last release. USAGE: ====== Run this script to generate release notes for any integration package: `just prepare-integration-release PACKAGE` or `python scripts/prepare_in...
{ "repo_id": "PrefectHQ/prefect", "file_path": "scripts/prepare_integration_release_notes.py", "license": "Apache License 2.0", "lines": 339, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py
"""ECS worker deployment commands.""" import json import pathlib from typing import Optional import click import typer from rich.table import Table from typing_extensions import Annotated from .utils import ( add_cli_tags, console, delete_stack, deploy_stack, display_stacks_table, get_aws_cli...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/prefect_aws/_cli/ecs_worker.py", "license": "Apache License 2.0", "lines": 457, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/integrations/prefect-aws/prefect_aws/_cli/main.py
"""Main CLI entry point for prefect-aws.""" import typer from .ecs_worker import ecs_worker_app app = typer.Typer( name="prefect-aws", help="CLI tool for deploying Prefect AWS infrastructure", no_args_is_help=True, ) # Add the ecs-worker subcommand group app.add_typer(ecs_worker_app, name="ecs-worker") ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/prefect_aws/_cli/main.py", "license": "Apache License 2.0", "lines": 20, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/integrations/prefect-aws/prefect_aws/_cli/utils.py
"""Utility functions for AWS operations and CLI helpers.""" from __future__ import annotations import json from datetime import datetime, timezone from typing import TYPE_CHECKING, Any, Literal import boto3 import typer from botocore.exceptions import ClientError, NoCredentialsError from rich.console import Console ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/prefect_aws/_cli/utils.py", "license": "Apache License 2.0", "lines": 491, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/integrations/prefect-aws/tests/cli/test_ecs_worker.py
"""Tests for ECS worker CLI commands.""" import json import uuid from unittest.mock import Mock, patch import boto3 import pytest from moto import mock_aws from prefect_aws._cli.main import app from prefect_aws.workers import ECSWorker from typer.testing import CliRunner import prefect from prefect.client.schemas.ac...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/tests/cli/test_ecs_worker.py", "license": "Apache License 2.0", "lines": 867, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/integrations/prefect-aws/infra/app.py
#!/usr/bin/env python3 import aws_cdk as cdk from worker.events_stack import EcsEventsStack from worker.service_stack import EcsServiceStack app = cdk.App() # Create stack variants for different deployment scenarios without bootstrap requirements EcsServiceStack( app, "PrefectEcsServiceStack", synthesizer...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/infra/app.py", "license": "Apache License 2.0", "lines": 17, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/integrations/prefect-aws/infra/tests/test_worker_stack.py
import aws_cdk as core import aws_cdk.assertions as assertions from ..worker.events_stack import EcsEventsStack from ..worker.service_stack import EcsServiceStack def test_service_stack(): """Test that service stack doesn't create cluster.""" app = core.App() stack = EcsServiceStack(app, "TestServiceStac...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/infra/tests/test_worker_stack.py", "license": "Apache License 2.0", "lines": 553, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/integrations/prefect-aws/infra/worker/events_stack.py
"""Events-only stack - sets up EventBridge and SQS for ECS task state changes.""" from aws_cdk import ( CfnOutput, CfnParameter, Duration, Stack, ) from aws_cdk import ( aws_events as events, ) from aws_cdk import ( aws_events_targets as events_targets, ) from aws_cdk import ( aws_iam as ia...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/infra/worker/events_stack.py", "license": "Apache License 2.0", "lines": 121, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/integrations/prefect-aws/infra/worker/service_stack.py
"""ECS worker service stack - deploys to existing cluster with event infrastructure.""" from aws_cdk import ( CfnCondition, CfnOutput, CfnParameter, Duration, Fn, RemovalPolicy, SecretValue, Stack, ) from aws_cdk import ( aws_ec2 as ec2, ) from aws_cdk import ( aws_ecs as ecs, )...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/infra/worker/service_stack.py", "license": "Apache License 2.0", "lines": 815, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/transfer/_dag.py
""" Execution DAG for managing resource transfer dependencies. This module provides a pure execution engine that: - Stores nodes by UUID for deduplication - Implements Kahn's algorithm for topological sorting - Manages concurrent execution with worker pools - Handles failure propagation (skip descendants) """ from __...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_dag.py", "license": "Apache License 2.0", "lines": 286, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/transfer/_exceptions.py
class TransferSkipped(Exception): """ Exception raised when a resource is skipped during transfer. """ def __init__(self, reason: str): self.reason = reason def __str__(self) -> str: return self.reason
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_exceptions.py", "license": "Apache License 2.0", "lines": 8, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/prefect/cli/transfer/_migratable_resources/automations.py
from __future__ import annotations import uuid from typing_extensions import Self from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources import construct_migratable_resource from prefect.cli.transfer._migratable_resources.base import ( MigratableProtocol, ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_migratable_resources/automations.py", "license": "Apache License 2.0", "lines": 242, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/transfer/_migratable_resources/base.py
from __future__ import annotations import abc import uuid from typing import Generic, Protocol, TypeVar, Union from prefect.client.schemas.objects import ( BlockDocument, BlockSchema, BlockType, Flow, Variable, WorkPool, WorkQueue, ) from prefect.client.schemas.responses import ( Deplo...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_migratable_resources/base.py", "license": "Apache License 2.0", "lines": 59, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/prefect/cli/transfer/_migratable_resources/blocks.py
from __future__ import annotations import uuid from typing import Any, cast from typing_extensions import Self from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources import construct_migratable_resource from prefect.cli.transfer._migratable_resources.base import ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_migratable_resources/blocks.py", "license": "Apache License 2.0", "lines": 356, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/transfer/_migratable_resources/concurrency_limits.py
from __future__ import annotations import uuid from typing_extensions import Self from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.base import ( MigratableProtocol, MigratableResource, ) from prefect.client.orchestration import get_client from prefe...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_migratable_resources/concurrency_limits.py", "license": "Apache License 2.0", "lines": 76, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/prefect/cli/transfer/_migratable_resources/deployments.py
from __future__ import annotations import uuid from typing_extensions import Self from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources import construct_migratable_resource from prefect.cli.transfer._migratable_resources.base import ( MigratableProtocol, ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_migratable_resources/deployments.py", "license": "Apache License 2.0", "lines": 207, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/transfer/_migratable_resources/flows.py
from __future__ import annotations import uuid from typing_extensions import Self from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.base import ( MigratableProtocol, MigratableResource, ) from prefect.client.orchestration import get_client from prefe...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_migratable_resources/flows.py", "license": "Apache License 2.0", "lines": 65, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/prefect/cli/transfer/_migratable_resources/variables.py
from __future__ import annotations import uuid from typing_extensions import Self from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.base import ( MigratableProtocol, MigratableResource, ) from prefect.client.orchestration import get_client from prefe...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_migratable_resources/variables.py", "license": "Apache License 2.0", "lines": 58, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/prefect/cli/transfer/_migratable_resources/work_pools.py
from __future__ import annotations import uuid from typing_extensions import Self from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources import construct_migratable_resource from prefect.cli.transfer._migratable_resources.base import ( MigratableProtocol, ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_migratable_resources/work_pools.py", "license": "Apache License 2.0", "lines": 124, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/cli/transfer/_migratable_resources/work_queues.py
from __future__ import annotations import uuid from typing_extensions import Self from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources import construct_migratable_resource from prefect.cli.transfer._migratable_resources.base import ( MigratableProtocol, ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/cli/transfer/_migratable_resources/work_queues.py", "license": "Apache License 2.0", "lines": 97, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:tests/cli/test_transfer.py
"""Tests for the prefect transfer CLI command.""" import uuid from unittest.mock import AsyncMock, MagicMock, patch import pytest from prefect.cli._transfer_utils import ( find_root_resources as _find_root_resources, ) from prefect.cli._transfer_utils import ( get_resource_display_name as _get_resource_displ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/test_transfer.py", "license": "Apache License 2.0", "lines": 308, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/transfer/test_automations.py
import uuid from datetime import timedelta from unittest.mock import AsyncMock, MagicMock, patch import pytest from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.automations import MigratableAutomation from prefect.events.actions import ( CallWebhook, ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/transfer/test_automations.py", "license": "Apache License 2.0", "lines": 670, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/transfer/test_blocks.py
import uuid from unittest.mock import AsyncMock, MagicMock, patch import pytest from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.blocks import ( MigratableBlockDocument, MigratableBlockSchema, MigratableBlockType, ) from prefect.client.schemas.ac...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/transfer/test_blocks.py", "license": "Apache License 2.0", "lines": 609, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/transfer/test_concurrency_limits.py
import uuid from unittest.mock import AsyncMock, MagicMock, patch import pytest from sqlalchemy.ext.asyncio import AsyncSession from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.concurrency_limits import ( MigratableGlobalConcurrencyLimit, ) from prefect....
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/transfer/test_concurrency_limits.py", "license": "Apache License 2.0", "lines": 299, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/transfer/test_dag.py
import asyncio import uuid from collections import defaultdict from typing import Optional from unittest.mock import patch from prefect.cli.transfer._dag import NodeState, TransferDAG from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.base import MigratableProt...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/transfer/test_dag.py", "license": "Apache License 2.0", "lines": 427, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/transfer/test_deployments.py
import uuid import warnings from unittest.mock import AsyncMock, MagicMock, patch import pytest from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.deployments import MigratableDeployment from prefect.client.schemas.actions import DeploymentScheduleCreate from ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/transfer/test_deployments.py", "license": "Apache License 2.0", "lines": 533, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/transfer/test_flows.py
import uuid from unittest.mock import AsyncMock, MagicMock, patch import pytest from sqlalchemy.ext.asyncio import AsyncSession from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.flows import MigratableFlow from prefect.client.schemas.actions import FlowCreate...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/transfer/test_flows.py", "license": "Apache License 2.0", "lines": 205, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/transfer/test_variables.py
import uuid from typing import Any from unittest.mock import AsyncMock, MagicMock, patch import pytest from sqlalchemy.ext.asyncio import AsyncSession from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.variables import MigratableVariable from prefect.client.sc...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/transfer/test_variables.py", "license": "Apache License 2.0", "lines": 216, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/transfer/test_work_pools.py
import uuid from unittest.mock import AsyncMock, MagicMock, patch import pytest from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.work_pools import MigratableWorkPool from prefect.client.base import ServerType from prefect.client.schemas.actions import WorkPo...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/transfer/test_work_pools.py", "license": "Apache License 2.0", "lines": 507, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:tests/cli/transfer/test_work_queues.py
import uuid from unittest.mock import AsyncMock, MagicMock, patch import pytest from prefect.cli.transfer._exceptions import TransferSkipped from prefect.cli.transfer._migratable_resources.work_queues import MigratableWorkQueue from prefect.client.schemas.filters import WorkQueueFilter, WorkQueueFilterName from prefe...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/cli/transfer/test_work_queues.py", "license": "Apache License 2.0", "lines": 327, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:scripts/generate_api_ref.py
""" Script to generate API reference documentation using mdxify. """ import subprocess import sys def main() -> None: """Generate API reference documentation.""" cmd = [ "uvx", "--with-editable", ".", "mdxify@latest", "--all", "--root-module", "prefect"...
{ "repo_id": "PrefectHQ/prefect", "file_path": "scripts/generate_api_ref.py", "license": "Apache License 2.0", "lines": 34, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:src/integrations/prefect-aws/prefect_aws/observers/ecs.py
from __future__ import annotations import asyncio import datetime import enum import json import logging import uuid from collections import deque from contextlib import AsyncExitStack from datetime import timedelta from functools import partial from types import TracebackType from typing import ( TYPE_CHECKING, ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/prefect_aws/observers/ecs.py", "license": "Apache License 2.0", "lines": 595, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/integrations/prefect-aws/prefect_aws/settings.py
from __future__ import annotations from typing import Optional from pydantic import Field from prefect.settings.base import PrefectBaseSettings, build_settings_config class EcsObserverSqsSettings(PrefectBaseSettings): model_config = build_settings_config( ("integrations", "aws", "ecs", "observer", "sqs...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/prefect_aws/settings.py", "license": "Apache License 2.0", "lines": 101, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/integrations/prefect-aws/tests/observers/test_ecs_observer.py
from __future__ import annotations import asyncio import json import uuid from datetime import datetime from typing import Any, AsyncGenerator from unittest.mock import AsyncMock, Mock, patch import pytest from cachetools import LRUCache from prefect_aws.observers.ecs import ( EcsObserver, EcsTaskTagsReader, ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-aws/tests/observers/test_ecs_observer.py", "license": "Apache License 2.0", "lines": 1116, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/integrations/prefect-redis/prefect_redis/lease_storage.py
from __future__ import annotations import json import logging from datetime import datetime, timedelta, timezone from typing import Any from uuid import UUID from redis.asyncio import Redis from redis.exceptions import RedisError from prefect.server.concurrency.lease_storage import ( ConcurrencyLeaseHolder, ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-redis/prefect_redis/lease_storage.py", "license": "Apache License 2.0", "lines": 310, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/integrations/prefect-redis/tests/test_lease_storage.py
import asyncio from datetime import datetime, timedelta, timezone from uuid import UUID, uuid4 import pytest from prefect_redis.lease_storage import ConcurrencyLeaseStorage from redis.asyncio import Redis from prefect.server.concurrency.lease_storage import ConcurrencyLimitLeaseMetadata from prefect.server.utilities....
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-redis/tests/test_lease_storage.py", "license": "Apache License 2.0", "lines": 397, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:scripts/backfill_release_notes.py
#!/usr/bin/env python3 """ Backfill release notes documentation from GitHub releases. This script generates release notes pages for all 3.x releases. PURPOSE: ======== This script is used to regenerate ALL historical release notes from GitHub. It should only be needed in these cases: 1. Initial setup of release notes ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "scripts/backfill_release_notes.py", "license": "Apache License 2.0", "lines": 348, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:scripts/prepare_release_notes.py
#!/usr/bin/env python3 """ Prepare release notes documentation for an upcoming release. This script generates release notes from merged PRs and adds them to the docs. USAGE: ====== Run this script before creating a new release to prepare the documentation: `just prepare-release VERSION [SUBTITLE]` or `python scr...
{ "repo_id": "PrefectHQ/prefect", "file_path": "scripts/prepare_release_notes.py", "license": "Apache License 2.0", "lines": 402, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:examples/hello_world.py
# --- # title: Hello, world! # description: Your first steps with Prefect – learn how to create a basic flow and understand core concepts. # icon: play # dependencies: ["prefect"] # keywords: ["getting_started", "basics"] # draft: false # order: 1 # --- # # Welcome to your first Prefect flow. In under a minute you will...
{ "repo_id": "PrefectHQ/prefect", "file_path": "examples/hello_world.py", "license": "Apache License 2.0", "lines": 84, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:examples/run_api_sourced_etl.py
# --- # title: API-sourced ETL # description: Build a small ETL pipeline that fetches JSON from a public API, transforms it with pandas, and writes a CSV – all orchestrated by Prefect. # icon: database # dependencies: ["prefect", "httpx", "pandas"] # keywords: ["getting_started", "etl", "pandas"] # draft: false # order...
{ "repo_id": "PrefectHQ/prefect", "file_path": "examples/run_api_sourced_etl.py", "license": "Apache License 2.0", "lines": 144, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:examples/run_dbt_with_prefect.py
# --- # title: dbt Model Orchestration # description: Orchestrate any dbt project with bullet-proof retries, observability, and a single Python file – no YAML or shell scripts required. # icon: database # dependencies: ["prefect", "prefect-dbt>=0.7.0rc1", "dbt-core", "dbt-duckdb"] # keywords: ["dbt", "materialization",...
{ "repo_id": "PrefectHQ/prefect", "file_path": "examples/run_dbt_with_prefect.py", "license": "Apache License 2.0", "lines": 216, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:examples/simple_web_scraper.py
# --- # title: Simple web scraper # description: Learn how to scrape article content from web pages with Prefect tasks, retries, and automatic logging. # icon: globe # dependencies: ["prefect", "requests", "beautifulsoup4"] # keywords: ["getting_started", "webscraping", "tasks", "retries"] # draft: false # order: 5 # -...
{ "repo_id": "PrefectHQ/prefect", "file_path": "examples/simple_web_scraper.py", "license": "Apache License 2.0", "lines": 110, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/server/events/ordering/memory.py
from __future__ import annotations import asyncio import logging from contextlib import asynccontextmanager from datetime import datetime, timedelta from typing import Any, AsyncGenerator from uuid import UUID import anyio from cachetools import TTLCache import prefect.types._datetime from prefect.logging import get...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/server/events/ordering/memory.py", "license": "Apache License 2.0", "lines": 261, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:tests/events/server/test_in_memory_ordering.py
import asyncio from datetime import timedelta from typing import Sequence from unittest.mock import patch from uuid import uuid4 import pytest from cachetools import TTLCache from prefect.server.events.ordering import ( MAX_DEPTH_OF_PRECEDING_EVENT, PRECEDING_EVENT_LOOKBACK, SEEN_EXPIRATION, EventArri...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/events/server/test_in_memory_ordering.py", "license": "Apache License 2.0", "lines": 501, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/integrations/prefect-gcp/tests/test_cloud_run_worker_v2_filtering.py
import uuid import pytest from prefect_gcp.credentials import GcpCredentials from prefect_gcp.models.cloud_run_v2 import SecretKeySelector from prefect_gcp.workers.cloud_run_v2 import CloudRunWorkerJobV2Configuration from prefect.client.schemas.objects import FlowRun @pytest.fixture def job_body(): return { ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/integrations/prefect-gcp/tests/test_cloud_run_worker_v2_filtering.py", "license": "Apache License 2.0", "lines": 416, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/_internal/installation.py
import importlib import subprocess import sys import prefect.utilities.processutils def install_packages( packages: list[str], stream_output: bool = False, upgrade: bool = False ): """ Install packages using uv if available, otherwise use pip. """ base_command = ["pip", "install", *packages] ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/_internal/installation.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:tests/_internal/test_installation.py
import subprocess import sys from unittest.mock import AsyncMock, MagicMock, Mock, patch from prefect._internal.installation import ainstall_packages, install_packages class TestInstallPackages: @patch("prefect._internal.installation.importlib.import_module") @patch("subprocess.check_call") def test_inst...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/_internal/test_installation.py", "license": "Apache License 2.0", "lines": 254, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/concurrency/_leases.py
import asyncio import concurrent.futures from contextlib import asynccontextmanager, contextmanager from typing import AsyncGenerator, Generator from uuid import UUID from prefect._internal.concurrency.api import create_call from prefect._internal.concurrency.cancellation import ( AsyncCancelScope, WatcherThre...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/concurrency/_leases.py", "license": "Apache License 2.0", "lines": 138, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:integration-tests/test_concurrency_leases.py
""" Test concurrency leases with filesystem lease storage. This test is designed to be run in a GitHub Actions workflow. If you want to run these tests locally, be sure to set these environment variables in the test process and the server process: PREFECT_SERVER_CONCURRENCY_LEASE_STORAGE=prefect.server.concurrency.l...
{ "repo_id": "PrefectHQ/prefect", "file_path": "integration-tests/test_concurrency_leases.py", "license": "Apache License 2.0", "lines": 225, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/server/concurrency/lease_storage/filesystem.py
from __future__ import annotations import json import os import tempfile from datetime import datetime, timedelta, timezone from pathlib import Path from typing import Any, TypedDict from uuid import UUID import anyio from prefect.server.concurrency.lease_storage import ( ConcurrencyLeaseHolder, ConcurrencyL...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/server/concurrency/lease_storage/filesystem.py", "license": "Apache License 2.0", "lines": 265, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/settings/models/server/concurrency.py
from typing import ClassVar from pydantic import Field from pydantic_settings import SettingsConfigDict from prefect.settings.base import PrefectBaseSettings, build_settings_config class ServerConcurrencySettings(PrefectBaseSettings): model_config: ClassVar[SettingsConfigDict] = build_settings_config( (...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/settings/models/server/concurrency.py", "license": "Apache License 2.0", "lines": 23, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:tests/server/concurrency/test_filesystem_lease_storage.py
import json import tempfile from datetime import datetime, timedelta, timezone from pathlib import Path from uuid import UUID, uuid4 import pytest from prefect.server.concurrency.lease_storage import ConcurrencyLimitLeaseMetadata from prefect.server.concurrency.lease_storage.filesystem import ( ConcurrencyLeaseSt...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/server/concurrency/test_filesystem_lease_storage.py", "license": "Apache License 2.0", "lines": 544, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/server/services/repossessor.py
""" The Repossessor service. Handles reconciliation of expired concurrency leases. """ from __future__ import annotations import logging from datetime import datetime, timedelta, timezone from typing import Annotated from uuid import UUID from docket import CurrentDocket, Depends, Docket, Logged, Perpetual from pre...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/server/services/repossessor.py", "license": "Apache License 2.0", "lines": 66, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
PrefectHQ/prefect:tests/server/services/test_repossessor.py
from datetime import timedelta from uuid import uuid4 import pytest from docket import Docket from sqlalchemy.ext.asyncio import AsyncSession from prefect.server.concurrency.lease_storage import ConcurrencyLimitLeaseMetadata from prefect.server.concurrency.lease_storage.memory import ( ConcurrencyLeaseStorage, ) ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/server/services/test_repossessor.py", "license": "Apache License 2.0", "lines": 222, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:src/prefect/server/concurrency/lease_storage/memory.py
from __future__ import annotations from datetime import datetime, timedelta, timezone from uuid import UUID from prefect.server.concurrency.lease_storage import ( ConcurrencyLeaseHolder, ConcurrencyLimitLeaseMetadata, ) from prefect.server.concurrency.lease_storage import ( ConcurrencyLeaseStorage as _Con...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/server/concurrency/lease_storage/memory.py", "license": "Apache License 2.0", "lines": 98, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
PrefectHQ/prefect:src/prefect/server/utilities/leasing.py
from __future__ import annotations from dataclasses import dataclass, field from datetime import datetime, timedelta, timezone from functools import partial from typing import Generic, Protocol, TypeVar from uuid import UUID, uuid4 T = TypeVar("T") @dataclass class ResourceLease(Generic[T]): resource_ids: list[...
{ "repo_id": "PrefectHQ/prefect", "file_path": "src/prefect/server/utilities/leasing.py", "license": "Apache License 2.0", "lines": 65, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
PrefectHQ/prefect:tests/server/concurrency/test_memory_lease_storage.py
from datetime import datetime, timedelta, timezone from uuid import UUID, uuid4 import pytest from prefect.server.concurrency.lease_storage import ConcurrencyLimitLeaseMetadata from prefect.server.concurrency.lease_storage.memory import ( ConcurrencyLeaseStorage, ) from prefect.server.utilities.leasing import Res...
{ "repo_id": "PrefectHQ/prefect", "file_path": "tests/server/concurrency/test_memory_lease_storage.py", "license": "Apache License 2.0", "lines": 286, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
PrefectHQ/prefect:integration-tests/test_serve_a_flow.py
import signal from datetime import timedelta from pathlib import Path from types import FrameType from prefect import flow from prefect.settings import PREFECT_RUNNER_POLL_FREQUENCY, temporary_settings @flow def may_i_take_your_hat_sir(item: str, counter_dir: Path): assert item == "hat", "I don't know how to do ...
{ "repo_id": "PrefectHQ/prefect", "file_path": "integration-tests/test_serve_a_flow.py", "license": "Apache License 2.0", "lines": 38, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test