repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
spaCy | spacy/cli/profile.py | .py | import cProfile
import itertools
import pstats
import sys
from pathlib import Path
from typing import Iterator, Optional, Sequence, Union
import srsly
import tqdm
import typer
from wasabi import Printer, msg
from ..language import Language
from ..util import load_model
from ._util import NAME, Arg, Opt, app, debug_cl... | 100 | 3,533 |
spaCy | spacy/cli/init_pipeline.py | .py | import logging
from pathlib import Path
from typing import Optional
import srsly
import typer
from wasabi import msg
from .. import util
from ..language import Language
from ..training.initialize import convert_vectors, init_nlp
from ._util import (
Arg,
Opt,
import_code,
init_cli,
parse_config_ov... | 198 | 6,196 |
spaCy | spacy/cli/apply.py | .py | from itertools import chain
from pathlib import Path
from typing import Iterable, List, Optional, Union, cast
import srsly
import tqdm
from wasabi import msg
from ..tokens import Doc, DocBin
from ..util import ensure_path, load_model
from ..vocab import Vocab
from ._util import Arg, Opt, app, import_code, setup_gpu, ... | 146 | 4,881 |
spaCy | spacy/ml/extract_ngrams.py | .py | from thinc.api import Model
from ..attrs import LOWER
def extract_ngrams(ngram_size: int, attr: int = LOWER) -> Model:
model: Model = Model("extract_ngrams", forward)
model.attrs["ngram_size"] = ngram_size
model.attrs["attr"] = attr
return model
def forward(model: Model, docs, is_train: bool):
... | 33 | 1,119 |
spaCy | spacy/ml/_character_embed.py | .py | from typing import List
from thinc.api import Model
from thinc.types import Floats2d
from ..tokens import Doc
def CharacterEmbed(nM: int, nC: int) -> Model[List[Doc], List[Floats2d]]:
# nM: Number of dimensions per character. nC: Number of characters.
return Model(
"charembed",
forward,
... | 59 | 1,927 |
spaCy | spacy/ml/tb_framework.py | .py | from thinc.api import Model, noop
from .parser_model import ParserStepModel
def TransitionModel(
tok2vec, lower, upper, resize_output, dropout=0.2, unseen_classes=set()
):
"""Set up a stepwise transition-based model"""
if upper is None:
has_upper = False
upper = noop()
else:
h... | 50 | 1,392 |
spaCy | spacy/ml/featureextractor.py | .py | from typing import Callable, List, Tuple, Union
from thinc.api import Model
from thinc.types import Ints2d
from ..tokens import Doc
def FeatureExtractor(
columns: Union[List[str], List[int], List[Union[int, str]]],
) -> Model[List[Doc], List[Ints2d]]:
return Model("extract_features", forward, attrs={"column... | 31 | 950 |
spaCy | spacy/ml/extract_spans.py | .py | from typing import Callable, List, Tuple
from thinc.api import Model, to_numpy
from thinc.types import Ints1d, Ragged
def extract_spans() -> Model[Tuple[Ragged, Ragged], Ragged]:
"""Extract spans from a sequence of source arrays, as specified by an array
of (start, end) indices. The output is a ragged array ... | 65 | 2,232 |
spaCy | spacy/ml/_precomputable_affine.py | .py | from thinc.api import Model, normal_init
def PrecomputableAffine(nO, nI, nF, nP, dropout=0.1):
model = Model(
"precomputable_affine",
forward,
init=init,
dims={"nO": nO, "nI": nI, "nF": nF, "nP": nP},
params={"W": None, "b": None, "pad": None},
attrs={"dropout_rate"... | 162 | 5,756 |
spaCy | spacy/ml/callbacks.py | .py | import functools
import inspect
import types
import warnings
from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Set
from thinc.layers import with_nvtx_range
from thinc.util import use_nvtx_range
from ..errors import Warnings
if TYPE_CHECKING:
# This lets us add type hints for mypy etc. without cau... | 121 | 3,581 |
spaCy | spacy/ml/staticvectors.py | .py | import warnings
from typing import Callable, List, Optional, Tuple, cast
from thinc.api import Model, Ops
from thinc.initializers import glorot_uniform_init
from thinc.types import Floats1d, Floats2d, Ints1d, Ragged
from thinc.util import partial
from ..attrs import ORTH
from ..errors import Errors, Warnings
from ..t... | 125 | 4,187 |
spaCy | spacy/ml/models/parser.py | .py | from typing import List, Optional
from thinc.api import Linear, Model, chain, list2array, use_ops, zero_init
from thinc.types import Floats2d
from ...compat import Literal
from ...errors import Errors
from ...tokens import Doc
from .._precomputable_affine import PrecomputableAffine
from ..tb_framework import Transiti... | 174 | 6,804 |
spaCy | spacy/ml/models/multi_task.py | .py | from functools import partial
from typing import TYPE_CHECKING, Callable, Iterable, List, Optional, Tuple, cast
import numpy
from thinc.api import (
CosineDistance,
L2Distance,
LayerNorm,
Linear,
Maxout,
Model,
MultiSoftmax,
Softmax,
chain,
list2array,
to_categorical,
ze... | 271 | 9,141 |
spaCy | spacy/ml/models/span_finder.py | .py | from typing import Callable, List, Tuple
from thinc.api import Model, chain, with_array
from thinc.types import Floats1d, Floats2d
from ...tokens import Doc
InT = List[Doc]
OutT = Floats2d
def build_finder_model(
tok2vec: Model[InT, List[Floats2d]], scorer: Model[OutT, OutT]
) -> Model[InT, OutT]:
logisti... | 40 | 1,154 |
spaCy | spacy/ml/models/textcat.py | .py | from functools import partial
from typing import List, Optional, Tuple, cast
from thinc.api import (
Dropout,
Gelu,
LayerNorm,
Linear,
Logistic,
Maxout,
Model,
ParametricAttention,
ParametricAttention_v2,
Relu,
Softmax,
SparseLinear,
SparseLinear_v2,
chain,
c... | 364 | 12,758 |
spaCy | spacy/ml/models/tagger.py | .py | from typing import List, Optional
from thinc.api import Model, Softmax_v2, chain, with_array, zero_init
from thinc.types import Floats2d
from ...tokens import Doc
def build_tagger_model(
tok2vec: Model[List[Doc], List[Floats2d]], nO: Optional[int] = None, normalize=False
) -> Model[List[Doc], List[Floats2d]]:
... | 30 | 1,181 |
spaCy | spacy/ml/models/entity_linker.py | .py | from pathlib import Path
from typing import Callable, Iterable, List, Optional, Tuple
from thinc.api import (
Linear,
Maxout,
Model,
Ragged,
chain,
list2ragged,
reduce_mean,
residual,
tuplify,
)
from thinc.types import Floats2d
from ...errors import Errors
from ...kb import (
C... | 128 | 4,008 |
spaCy | spacy/ml/models/tok2vec.py | .py | from typing import List, Optional, Union, cast
from thinc.api import (
HashEmbed,
Maxout,
Mish,
Model,
PyTorchLSTM,
chain,
clone,
concatenate,
expand_window,
list2ragged,
noop,
ragged2list,
residual,
with_array,
with_padded,
)
from thinc.types import Floats2d... | 343 | 13,618 |
spaCy | spacy/ml/models/spancat.py | .py | from typing import List, Tuple, cast
from thinc.api import (
Linear,
Logistic,
Maxout,
Model,
chain,
concatenate,
glorot_uniform_init,
list2ragged,
reduce_first,
reduce_last,
reduce_max,
reduce_mean,
with_getitem,
)
from thinc.types import Floats2d, Ragged
from ...t... | 74 | 2,215 |
spaCy | spacy/training/iob_utils.py | .py | import warnings
from typing import Dict, Iterable, Iterator, List, Tuple, Union, cast
from ..errors import Errors, Warnings
from ..tokens import Doc, Span
def iob_to_biluo(tags: Iterable[str]) -> List[str]:
out: List[str] = []
tags = list(tags)
while tags:
out.extend(_consume_os(tags))
ou... | 241 | 9,075 |
spaCy | spacy/training/alignment.py | .py | from dataclasses import dataclass
from typing import List
from .align import get_alignments
from .alignment_array import AlignmentArray
@dataclass
class Alignment:
x2y: AlignmentArray
y2x: AlignmentArray
@classmethod
def from_indices(cls, x2y: List[List[int]], y2x: List[List[int]]) -> "Alignment":
... | 23 | 614 |
spaCy | spacy/training/augment.py | .py | import itertools
import random
from functools import partial
from typing import TYPE_CHECKING, Callable, Dict, Iterator, List, Optional, Tuple
from .example import Example
from .iob_utils import _doc_to_biluo_tags_with_partial, split_bilu_label
if TYPE_CHECKING:
from ..language import Language # noqa: F401
def... | 345 | 13,090 |
spaCy | spacy/training/initialize.py | .py | import gzip
import tarfile
import warnings
import zipfile
from itertools import islice
from pathlib import Path
from typing import IO, TYPE_CHECKING, Any, Dict, Optional, Union
import numpy
import srsly
import tqdm
from thinc.api import Config, ConfigValidationError, fix_random_seed, set_gpu_allocator
from ..errors i... | 362 | 14,149 |
spaCy | spacy/training/__init__.py | .py | from .alignment import Alignment # noqa: F401
from .augment import dont_augment, orth_variants_augmenter # noqa: F401
from .batchers import minibatch_by_padded_size, minibatch_by_words # noqa: F401
from .callbacks import create_copy_from_base_model # noqa: F401
from .corpus import Corpus, JsonlCorpus, PlainTextCorp... | 44 | 1,302 |
spaCy | spacy/training/callbacks.py | .py | from typing import TYPE_CHECKING, Callable, Optional
from ..errors import Errors
from ..util import load_model, logger
if TYPE_CHECKING:
from ..language import Language
def create_copy_from_base_model(
tokenizer: Optional[str] = None,
vocab: Optional[str] = None,
) -> Callable[["Language"], "Language"]:... | 35 | 1,249 |
spaCy | spacy/training/pretrain.py | .py | import re
import time
from collections import Counter
from pathlib import Path
from typing import Callable, Iterable, List, Optional, Union
import srsly
from thinc.api import (
Config,
Model,
Optimizer,
fix_random_seed,
set_dropout_rate,
set_gpu_allocator,
)
from thinc.config import ConfigValid... | 261 | 9,736 |
spaCy | spacy/training/loop.py | .py | import random
import shutil
import sys
from pathlib import Path
from timeit import default_timer as timer
from typing import (
IO,
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Tuple,
Union,
)
from thinc.api import Config, Optimizer, constant, fix_random_seed, se... | 387 | 15,056 |
spaCy | spacy/training/corpus.py | .py | import random
import warnings
from pathlib import Path
from typing import TYPE_CHECKING, Callable, Iterable, Iterator, List, Optional, Union
import srsly
from .. import util
from ..errors import Errors, Warnings
from ..tokens import Doc, DocBin
from ..vocab import Vocab
from .augment import dont_augment
from .example... | 332 | 12,012 |
spaCy | spacy/training/loggers.py | .py | import sys
from pathlib import Path
from typing import IO, TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
import srsly
import tqdm
from wasabi import Printer
from .. import util
from ..errors import Errors
if TYPE_CHECKING:
from ..language import Language # noqa: F401
def setup_table(
*,... | 197 | 7,706 |
spaCy | spacy/training/batchers.py | .py | import itertools
from functools import partial
from typing import (
Any,
Callable,
Iterable,
Iterator,
List,
Optional,
Sequence,
TypeVar,
Union,
)
from ..util import minibatch
Sizing = Union[Sequence[int], int]
ItemT = TypeVar("ItemT")
BatcherT = Callable[[Iterable[ItemT]], Iterabl... | 238 | 8,978 |
spaCy | spacy/training/converters/iob_to_docs.py | .py | from wasabi import Printer
from ...errors import Errors
from ...tokens import Doc, Span
from ...training import iob_to_biluo, tags_to_entities
from ...util import minibatch
from ...vocab import Vocab
from .conll_ner_to_docs import n_sents_info
def iob_to_docs(input_data, n_sents=10, no_print=False, *args, **kwargs):... | 63 | 2,356 |
spaCy | spacy/training/converters/json_to_docs.py | .py | import srsly
from ...lang.xx import MultiLanguage
from ...util import load_model
from ..example import (
_fix_legacy_dict_data,
_parse_example_dict_data,
annotations_to_doc,
)
from ..gold_io import json_iterate, json_to_annotations
def json_to_docs(input_data, model=None, **kwargs):
nlp = load_model(... | 25 | 880 |
spaCy | spacy/training/converters/conllu_to_docs.py | .py | import re
from wasabi import Printer
from ...tokens import Doc, Span, Token
from ...training import biluo_tags_to_spans, iob_to_biluo
from ...vocab import Vocab
from .conll_ner_to_docs import n_sents_info
def conllu_to_docs(
input_data,
n_sents=10,
append_morphology=False,
ner_map=None,
merge_su... | 307 | 10,277 |
spaCy | spacy/training/converters/conll_ner_to_docs.py | .py | from wasabi import Printer
from ...errors import Errors
from ...tokens import Doc, Span
from ...training import iob_to_biluo
from ...util import get_lang_class, load_model
from .. import tags_to_entities
def conll_ner_to_docs(
input_data, n_sents=10, seg_sents=False, model=None, no_print=False, **kwargs
):
"... | 171 | 6,162 |
spaCy | extra/example_data/textcat_example_data/textcatjsonl_to_trainjson.py | .py | from pathlib import Path
import plac
import spacy
from spacy.training import docs_to_json
import srsly
import sys
@plac.annotations(
model=("Model name. Defaults to 'en'.", "option", "m", str),
input_file=("Input file (jsonl)", "positional", None, Path),
output_dir=("Output directory", "positional", None,... | 56 | 1,554 |
QwenPaw | setup.py | .py | # -*- coding: utf-8 -*-
from setuptools import setup
setup()
| 5 | 62 |
QwenPaw | tests/conftest.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
# pylint: disable=reimported,unused-argument,unnecessary-pass
"""
Global pytest fixtures for CoPaw test suite.
This module provides shared fixtures for testing CoPaw components.
All fixtures are designed to be isolated, safe, and easy to use.
"""
import l... | 468 | 15,036 |
QwenPaw | tests/contract/__init__.py | .py | # -*- coding: utf-8 -*-
"""
Contract Test Framework
Provides abstract contract tests that enforce all subclasses follow
the same interface contract. When a base class changes, all subclass
tests automatically validate they still satisfy the contract.
Example:
class MyBaseContract(BaseContractTest):
@abstr... | 92 | 2,523 |
QwenPaw | tests/contract/security/test_guardian_contract.py | .py | # -*- coding: utf-8 -*-
"""Contract tests for BaseToolGuardian subclasses.
Verifies the BaseToolGuardian contract:
- guard() returns list[GuardFinding]
- Unknown tool names don't cause crashes
- Empty params are handled gracefully
- Finding fields are populated correctly
"""
# pylint: disable=redefined-outer-name,unus... | 290 | 10,645 |
QwenPaw | tests/contract/runner/test_control_command_contract.py | .py | # -*- coding: utf-8 -*-
"""Contract tests for :class:`BaseControlCommandHandler` subclasses.
These tests pin down the contract that anything registered into the
control-command dispatch table must satisfy. When a future handler is
added (or the base interface drifts) these tests fail before integration
tests get a ch... | 177 | 5,902 |
QwenPaw | tests/contract/browser/__init__.py | .py | # -*- coding: utf-8 -*-
"""Browser contract tests."""
| 3 | 54 |
QwenPaw | tests/contract/browser/test_track_isolation.py | .py | # -*- coding: utf-8 -*-
"""Two-track isolation contract: deprecated browser remains deletable."""
import re
from pathlib import Path
SRC = Path(__file__).resolve().parents[3] / "src" / "qwenpaw"
FORK = SRC / "agents" / "tools" / "__init__.py"
DEPRECATED = SRC / "agents" / "tools" / "deprecated_browser"
UNIFIED = SRC ... | 55 | 1,499 |
QwenPaw | tests/contract/browser/test_manual_surface.py | .py | # -*- coding: utf-8 -*-
"""Every locator call named in the manual must exist on LocatorView."""
import re
from qwenpaw.browser.sdk import facade
from qwenpaw.browser.sdk.contracts import LocatorView
_MANUAL = "".join(
value
for name in dir(facade)
if name.startswith("_BLOCK")
for value in [getattr(fac... | 60 | 1,410 |
QwenPaw | tests/contract/providers/test_provider_contract.py | .py | # -*- coding: utf-8 -*-
"""
Provider Contract Tests
Ensures all Provider subclasses satisfy the base interface.
Usage:
class TestOpenAIProviderContract(ProviderContractTest):
def create_instance(self):
return OpenAIProvider(id="openai", name="OpenAI", ...)
"""
from __future__ import annotatio... | 97 | 3,630 |
QwenPaw | tests/contract/providers/__init__.py | .py | # -*- coding: utf-8 -*-
"""
Provider Contract Tests
For LLM Provider subclasses.
Example:
from tests.contract import BaseContractTest
class ProviderContractTest(BaseContractTest):
def test_has_chat_method(self, instance):
assert hasattr(instance, "chat")
assert callable(getatt... | 23 | 589 |
QwenPaw | tests/contract/channels/test_imessage_contract.py | .py | # -*- coding: utf-8 -*-
"""
iMessage Channel Contract Test
Ensures IMessageChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates IMessageChannel still complies.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock
from qwenp... | 48 | 1,398 |
QwenPaw | tests/contract/channels/test_discord_contract.py | .py | # -*- coding: utf-8 -*-
"""
Discord Channel Contract Test
Ensures DiscordChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates DiscordChannel still complies.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock
from qwenpaw.... | 48 | 1,336 |
QwenPaw | tests/contract/channels/test_console_contract.py | .py | # -*- coding: utf-8 -*-
"""
Example: Console Channel Contract Test
Demonstrates how to implement contract tests for channel subclasses.
When BaseChannel changes, these tests ensure ConsoleChannel still complies.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMo... | 115 | 3,661 |
QwenPaw | tests/contract/channels/test_mqtt_contract.py | .py | # -*- coding: utf-8 -*-
"""
MQTT Channel Contract Test
Ensures MQTTChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates MQTTChannel still complies.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock
from qwenpaw.app.chann... | 53 | 1,496 |
QwenPaw | tests/contract/channels/test_feishu_contract.py | .py | # -*- coding: utf-8 -*-
"""
Feishu Channel Contract Test
Ensures FeishuChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates FeishuChannel still complies.
Usage:
pytest tests/contract/channels/test_feishu_contract.py -v
"""
from __future__ import annotations
from typing impo... | 104 | 3,396 |
QwenPaw | tests/contract/channels/test_mattermost_contract.py | .py | # -*- coding: utf-8 -*-
"""
Mattermost Channel Contract Test
Ensures MattermostChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates MattermostChannel still complies.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock
from... | 48 | 1,432 |
QwenPaw | tests/contract/channels/test_matrix_contract.py | .py | # -*- coding: utf-8 -*-
"""
Matrix Channel Contract Test
Ensures MatrixChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates MatrixChannel still complies.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock
from qwenpaw.app... | 45 | 1,298 |
QwenPaw | tests/contract/channels/__init__.py | .py | # -*- coding: utf-8 -*-
"""
Channel Contract Tests
Contract tests for BaseChannel subclasses.
When BaseChannel changes, these tests ensure ALL channels still comply.
This prevents "fix Console, break DingTalk" regressions.
Usage:
from tests.contract.channels import ChannelContractTest
class TestMyChannelCon... | 323 | 12,991 |
QwenPaw | tests/contract/channels/test_dingtalk_contract.py | .py | # -*- coding: utf-8 -*-
"""
DingTalk Channel Contract Test
Ensures DingTalkChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates DingTalkChannel still complies.
Run:
pytest tests/contract/channels/test_dingtalk_contract.py -v
pytest tests/contract/channels/ -v # Run all c... | 191 | 6,919 |
QwenPaw | tests/contract/channels/test_voice_contract.py | .py | # -*- coding: utf-8 -*-
"""
Voice Channel Contract Test
Ensures VoiceChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates VoiceChannel still complies.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock
from qwenpaw.app.ch... | 45 | 1,258 |
QwenPaw | tests/contract/channels/test_slack_contract.py | .py | # -*- coding: utf-8 -*-
"""Slack Channel Contract Test.
Ensures SlackChannel satisfies all BaseChannel contracts.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock
from tests.contract.channels import ChannelContractTest
if TYPE_CHECKING:
from qwenpaw.ap... | 65 | 1,926 |
QwenPaw | tests/contract/channels/test_telegram_contract.py | .py | # -*- coding: utf-8 -*-
"""
Telegram Channel Contract Test
Ensures TelegramChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates TelegramChannel still complies.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock
from qwenp... | 48 | 1,349 |
QwenPaw | tests/contract/channels/test_qq_contract.py | .py | # -*- coding: utf-8 -*-
"""
QQ Channel Contract Test
Ensures QQChannel satisfies all BaseChannel contracts.
When BaseChannel changes, this test validates QQChannel still complies.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock
from qwenpaw.app.channels.re... | 48 | 1,304 |
QwenPaw | tests/integration/test_workspace_files.py | .py | # -*- coding: utf-8 -*-
"""HTTP smoke tests for workspace file APIs (working/memory + zip up/down)."""
from __future__ import annotations
import io
import zipfile
import pytest
@pytest.mark.integration
@pytest.mark.p1
def test_api_workspace_working_file_list_put_get(app_server) -> None:
"""Test purpose:
- V... | 593 | 19,695 |
QwenPaw | tests/integration/test_plugin_types.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
# -*- coding: utf-8 -*-
"""Integration tests for the 7 plugin types via mock sample plugins
(Sprint 3.2).
Each test builds an in-memory zip with a minimal manifest + backend.py
that exercises one PluginType registration path:
A. Provider plugin — api.r... | 1,063 | 34,692 |
QwenPaw | tests/integration/test_providers.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for LLM provider/model APIs."""
from __future__ import annotations
import pytest
from helpers import default_http_timeout
_PROVIDERS_HTTP_TIMEOUT = default_http_timeout(15.0)
@pytest.mark.integration
@pytest.mark.p0
def test_providers_list_returns_baseline_providers(app_... | 128 | 4,120 |
QwenPaw | tests/integration/test_console_metadata.py | .py | # -*- coding: utf-8 -*-
"""Integration smoke tests for console-adjacent read-only JSON APIs.
No API keys, no LLM calls. Covers plugin list, backup list, token usage
summary/details, auth status (disabled CI profile), and agent statistics
with explicit ``X-Agent-Id``.
"""
from __future__ import annotations
import pyte... | 168 | 5,437 |
QwenPaw | tests/integration/test_chrome_service_worker.py | .py | # -*- coding: utf-8 -*-
"""Chrome plugin integration contracts grouped by runtime boundary."""
from __future__ import annotations
import importlib.util
import json
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
SCRIPTS = Path("plugins/bundle/chrome/assets/scripts")
def _load(nam... | 162 | 4,227 |
QwenPaw | tests/integration/test_acp_runner.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
# -*- coding: utf-8 -*-
"""Integration tests for ACP runner interoperability (Sprint 3.1-A).
Drive the full chain:
Mock LLM emits tool_call(delegate_external_agent)
→ agent runtime executes the tool
→ ACPService spawns the stdio mock ru... | 619 | 20,685 |
QwenPaw | tests/integration/test_multi_agent_config_isolation.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for multi-agent configuration isolation.
Verifies that agent-scoped configuration changes do not leak between
agents or pollute the global config. Covers inheritance from global
defaults, bidirectional isolation, config persistence across agent
lifecycle events, and securit... | 850 | 25,825 |
QwenPaw | tests/integration/test_console_header.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for the Console header (default-agent) endpoints.
These cover ``/api/console/*`` endpoints that resolve the active agent
via ``get_agent_for_request`` (header variant) rather than the
``/api/agents/{agentId}/console/*`` scoped variant. The inbox subset
of the same prefix is... | 195 | 6,730 |
QwenPaw | tests/integration/test_workspace_running_config.py | .py | # -*- coding: utf-8 -*-
"""HTTP smoke tests for workspace running_config (global + agent-scoped)."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p0
def test_api_workspace_running_config_put_get_roundtrip(app_server) -> None:
"""Test purpose:
- Verify workspace runn... | 151 | 5,181 |
QwenPaw | tests/integration/test_console.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for console routes (no LLM / no external API keys)."""
from __future__ import annotations
import io
import uuid
import pytest
from helpers import default_http_timeout
_CONSOLE_HTTP_TIMEOUT = default_http_timeout(30.0)
@pytest.mark.integration
@pytest.mark.p0
def test_ag... | 126 | 4,074 |
QwenPaw | tests/integration/test_access_control.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for /api/access-control/* (Sprint 4.2).
Target router: src/qwenpaw/app/routers/access_control.py (13 routes)
Backing store: src/qwenpaw/app/channels/access_control.py
(AccessControlStore, per-workspace JSON file)
Coverage strategy (happy path first):
- whi... | 483 | 15,529 |
QwenPaw | tests/integration/test_frontend_plugin.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for the public frontend-plugin router.
These endpoints intentionally bypass authentication so an unauthenticated
login page can fetch the plugin list and load plugin bundles.
"""
from __future__ import annotations
import pytest
from helpers import default_http_timeout
_FR... | 69 | 2,282 |
QwenPaw | tests/integration/test_driver_mcp_env_ref_flow.py | .py | # -*- coding: utf-8 -*-
from pathlib import Path
import pytest
from qwenpaw.drivers.capabilities import DriverInvocation
from qwenpaw.drivers.contracts import CredentialRef, DriverCard, PolicyRule
from qwenpaw.drivers.credentials.store import AsyncCredentialStore
from qwenpaw.drivers.handlers.mcp import MCPDriverHand... | 74 | 2,548 |
QwenPaw | tests/integration/test_version.py | .py | # -*- coding: utf-8 -*-
"""Integrated tests for QwenPaw version."""
from __future__ import annotations
import subprocess
import sys
import pytest
from packaging.version import Version
@pytest.mark.integration
@pytest.mark.p2
def test_version_import() -> None:
"""Test purpose:
- Verify the version module can... | 85 | 2,269 |
QwenPaw | tests/integration/test_auth_real.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
# -*- coding: utf-8 -*-
"""Auth=true real-link integration tests — Sprint 3.4-A.
Spawns a dedicated subprocess with QWENPAW_AUTH_ENABLED=true and
seeded credentials, then exercises:
A1 GET /api/auth/status reflects auth enabled + has_users
A2 POST /api... | 309 | 8,910 |
QwenPaw | tests/integration/test_skills_agent_scoped.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for agent-scoped /api/agents/{id}/skills endpoints.
Covers active-skill CRUD (create, save, upload, channels, config, tags)
and their error branches, all through ``/api/agents/{agentId}/skills/*``.
"""
from __future__ import annotations
import io
import zipfile
import pyt... | 1,050 | 33,016 |
QwenPaw | tests/integration/test_app_startup.py | .py | # -*- coding: utf-8 -*-
"""Integration smoke tests for app startup and console."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p0
def test_api_version_ok(app_server) -> None:
"""Test purpose:
- Verify the basic version endpoint is available after startup, as the
... | 65 | 2,218 |
QwenPaw | tests/integration/test_inbox.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for the Console inbox header APIs.
These hit ``/api/console/inbox/*`` (header routes, not agent-scoped). The
backing stores are file-based:
- events: ``<working_dir>/inbox_events.json`` (json list, asyncio.Lock)
- traces: ``<working_dir>/inbox_traces/<run_id>.json`` (o... | 500 | 16,704 |
QwenPaw | tests/integration/test_voice.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for the Twilio-facing voice router.
Note: voice_router is mounted at the app root (no /api prefix), so the
test paths are ``/voice/...`` rather than ``/api/voice/...``.
"""
from __future__ import annotations
import pytest
from helpers import default_http_timeout
_VOICE_HT... | 72 | 2,352 |
QwenPaw | tests/integration/test_mcp_oauth.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for the MCP OAuth 2.1 router."""
from __future__ import annotations
import pytest
from helpers import default_http_timeout
_MCP_OAUTH_HTTP_TIMEOUT = default_http_timeout(15.0)
@pytest.mark.integration
@pytest.mark.p2
def test_mcp_oauth_status_returns_404_for_missing_clie... | 95 | 3,218 |
QwenPaw | tests/integration/test_fork_and_coding_mode.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for /api/coding-mode, /api/fork, agent-status
(Sprint 4.2).
Target routers:
- src/qwenpaw/app/routers/coding_mode.py (GET + POST /api/coding-mode)
- src/qwenpaw/app/routers/fork.py (POST /api/fork/agent)
- src/qwenpaw/app/routers/agent_status.py (GET agent-sco... | 383 | 12,171 |
QwenPaw | tests/integration/test_cron_header.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for the cron header (default-agent) endpoints.
The cron router is mounted twice — once under ``/api/agents/{agentId}/cron``
(scoped, covered by test_cron.py) and once under ``/api/cron`` (header,
covered here). Both share the same code path; the header tests verify
the defa... | 529 | 18,822 |
QwenPaw | tests/integration/test_driver_mcp_oauth_flow.py | .py | # -*- coding: utf-8 -*-
from pathlib import Path
import pytest
from qwenpaw.drivers.capabilities import DriverInvocation
from qwenpaw.drivers.contracts import CredentialRef, DriverCard, PolicyRule
from qwenpaw.drivers.credentials.store import AsyncCredentialStore
from qwenpaw.drivers.credentials.types import Credenti... | 153 | 4,972 |
QwenPaw | tests/integration/test_chrome_native_host_install.py | .py | # -*- coding: utf-8 -*-
"""Chrome plugin integration contracts grouped by runtime boundary."""
from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
from plugins.bundle.chrome import extension_setup
# test_chrome_host_launcher.py
# pylint: disable=protected-access,unused... | 330 | 9,117 |
QwenPaw | tests/integration/test_workspace_agent_settings.py | .py | # -*- coding: utf-8 -*-
"""Smoke tests for agent-scoped workspace settings."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p1
def test_agent_scoped_workspace_language_put_get_roundtrip(app_server) -> None:
"""Test purpose:
- Verify scoped workspace language GET/PUT... | 355 | 12,289 |
QwenPaw | tests/integration/test_chrome_plugin_bundle.py | .py | # -*- coding: utf-8 -*-
"""Chrome plugin integration contracts grouped by runtime boundary."""
from __future__ import annotations
import json
from pathlib import Path
import pytest
# test_chrome_selfcontained_plugin.py
PLUGIN = Path("plugins/bundle/chrome")
def _python_files() -> list[Path]:
return [
... | 65 | 1,762 |
QwenPaw | tests/integration/test_console_chat_task.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for /api/console/chat/task* (Sprint 4.1).
Target routes (added by PR #5687 for the v2.0.0 background-task model):
- POST /api/console/chat/task
- GET /api/console/chat/task/{task_id}
The task_id is opaque (``task-<12hex>``), fresh per POST, and stored in a
module-leve... | 228 | 7,780 |
QwenPaw | tests/integration/test_backup.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for backup APIs (list/get/restore/create/delete/
export/import).
"""
from __future__ import annotations
import io
import json
import zipfile
import pytest
from helpers import default_http_timeout
_BACKUP_HTTP_TIMEOUT = default_http_timeout(30.0)
# ----------------------... | 601 | 20,494 |
QwenPaw | tests/integration/test_cross_cutting_defense.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
# -*- coding: utf-8 -*-
"""Cross-cutting defense integration tests — Sprint 3.4.
Covers (13 of 18 cases; auth=true cases are in test_auth_real.py):
- B. Concurrency (4)
- C. File size limits (2 — others duplicated in test_console_header.py)
- D. Unicode / ... | 536 | 16,055 |
QwenPaw | tests/integration/test_tool_calls_lifecycle.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for /api/tool-calls/* router (Sprint 4.1).
Target routes (7):
- GET /api/tool-calls/{session_id}
- GET /api/tool-calls/{session_id}/{tool_call_id}
- POST /api/tool-calls/{session_id}/{tool_call_id}/offload
- POST /api/tool-calls/{session_id}/{tool_call_id}... | 863 | 29,445 |
QwenPaw | tests/integration/test_memory_context.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for memory, system-prompt-files, running-config,
and inbox event lifecycle.
Sprint 2.3 — Memory & Context. All tests use the real ``qwenpaw app``
subprocess. A/B classes are pure HTTP; C class covers inbox event
lifecycle driven entirely by Mock LLM heartbeat runs.
Exist... | 968 | 29,529 |
QwenPaw | tests/integration/test_cron_execution.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for cron job *execution* (text and agent types).
Sprint 2.1/2.2 covered cron CRUD lifecycle (create, pause, resume,
delete, history seeding). This module covers the **execution** path:
POST /run triggers real ``CronExecutor.execute()`` and we verify
history records, inbox ... | 628 | 18,648 |
QwenPaw | tests/integration/test_console_chat_updated_at.py | .py | # -*- coding: utf-8 -*-
"""Regression test for issue #6131.
After the 2.x migration, sending a message in an existing chat did not
refresh ``ChatSpec.updated_at``. The console session list sorts by
``updated_at`` (descending) and polls the backend, so a stale timestamp
meant the chat never re-surfaced as the most rece... | 136 | 4,500 |
QwenPaw | tests/integration/test_security_config.py | .py | # -*- coding: utf-8 -*-
"""HTTP smoke tests for security guards (file/tool guard + skill scanner)."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p0
def test_global_sandbox_put_get_roundtrip(app_server) -> None:
"""Test purpose:
- Verify the global sandbox switch su... | 564 | 19,697 |
QwenPaw | tests/integration/test_local_models.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for the local-model (llama.cpp) router."""
from __future__ import annotations
import pytest
from helpers import default_http_timeout
_LOCAL_MODELS_HTTP_TIMEOUT = default_http_timeout(15.0)
@pytest.mark.integration
@pytest.mark.p1
def test_local_models_server_status_retur... | 176 | 5,790 |
QwenPaw | tests/integration/test_channel_config.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for channel configuration HTTP API.
Covers global ``/api/config/channels/*`` endpoints: channel type
listing, per-channel config CRUD, health checks, and restart.
The existing ``test_channels_config.py`` focuses on agent-scoped
channel config + restart; this module covers t... | 626 | 18,830 |
QwenPaw | tests/integration/test_agent_scoped_routing.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for agent-scoped URL routing.
Verifies that ``/api/agents/{agentId}/...`` paths route correctly to
the same handlers as global ``/api/...`` paths (alias endpoints) and
that real agent-scoped endpoints resolve agent context properly.
Covers 13 P0 endpoints across five domai... | 659 | 22,469 |
QwenPaw | tests/integration/test_skills_pool.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for skill pool CRUD endpoints.
Pool endpoints (``/api/skills/pool/*``) use ``SkillPoolService()`` — a
global singleton that ignores the ``agentId`` path parameter when
reached via agent-scoped routing. Tests here hit the global
``/api/skills/pool/*`` paths directly.
Agent... | 847 | 25,747 |
QwenPaw | tests/integration/test_channels_config.py | .py | # -*- coding: utf-8 -*-
"""Smoke tests for channels config (global/scoped + health/restart)."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p1
def test_agent_scoped_channels_put_get_roundtrip(app_server) -> None:
"""Test purpose:
- Verify agent-scoped /config/channe... | 354 | 13,008 |
QwenPaw | tests/integration/driver_mcp_fakes.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
from typing import Any
class Tool:
def __init__(self, name: str) -> None:
self.name = name
self.description = f"{name} description"
self.inputSchema = {"type": "object"}
class FakeStdIOClient:
instances: list["FakeStdIOClien... | 74 | 2,249 |
QwenPaw | tests/integration/test_approval.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for tool-guard approval APIs."""
from __future__ import annotations
import pytest
from helpers import default_http_timeout
_APPROVAL_HTTP_TIMEOUT = default_http_timeout(15.0)
@pytest.mark.integration
@pytest.mark.p0
def test_approval_approve_returns_404_for_missing_reque... | 122 | 3,915 |
QwenPaw | tests/integration/test_tool_config.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for tool configuration HTTP API.
Covers GET /tools (list), PATCH /tools/{name}/toggle, and
GET /tools/{name}/config endpoints. Verifies that builtin tools
(e.g. get_current_time) appear in the list and can be toggled.
"""
from __future__ import annotations
import pytest
... | 186 | 5,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.