From 48c466f4d581e7ee4dbeaf183d59cba681803ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2=20?= =?UTF-8?q?=D0=98=D0=B2=D1=87=D0=B5=D0=BD=D0=BA=D0=BE=D0=B2?= Date: Sat, 27 Jun 2026 05:03:17 +0300 Subject: [PATCH] Added anottations for four classes --- stubs/behave/behave/runner.pyi | 62 ++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/stubs/behave/behave/runner.pyi b/stubs/behave/behave/runner.pyi index a3abfa2d0de2..a159abcd3317 100644 --- a/stubs/behave/behave/runner.pyi +++ b/stubs/behave/behave/runner.pyi @@ -1,9 +1,17 @@ from _typeshed import Incomplete from collections.abc import Callable from contextlib import AbstractContextManager -from typing import ClassVar, ParamSpec +from enum import Enum +from typing import Any, ClassVar, ParamSpec, TypeVar _P = ParamSpec("_P") +_T = TypeVar("_T") + +class ContextMaskWarning(UserWarning): ... + +class ContextMode(Enum): + BEHAVE = 1 + USER = 2 class Context: LAYER_NAMES: ClassVar[list[str]] @@ -26,7 +34,7 @@ class Context: def __delattr__(self, name: str) -> None: ... def __contains__(self, name: str) -> bool: ... def abort(self, reason: str | None = None) -> None: ... - def use_or_assign_param(self, name: str, value): ... + def use_or_assign_param(self, name: str, value: _T) -> _T | None: ... def use_or_create_param(self, name: str, factory_func: Callable[_P, Incomplete], *args: _P.args, **kwargs: _P.kwargs): ... def use_with_user_mode(self) -> AbstractContextManager[None]: ... def execute_steps(self, steps_text: str) -> bool: ... @@ -35,4 +43,54 @@ class Context: def captured(self): ... def attach(self, mime_type: str, data: bytes) -> None: ... +class ModelRunner: + config: Incomplete + features: Incomplete + hooks: Incomplete + formatters: Incomplete + step_registry: Incomplete + capture_controller: Incomplete + capture_sink: Incomplete + context: Incomplete + feature: Incomplete + hook_failures: int + def __init__(self, config, features: list[Incomplete] | None = None, step_registry=None) -> None: ... + @property + def undefined_steps(self) -> list[Incomplete]: ... + + @property + def aborted(self) -> bool: ... + @aborted.setter + def aborted(self, value) -> None: ... + + def abort(self, reason: str | None = None) -> None: ... + def should_run_hook(self, hook_name: str) -> bool: ... + def run_hook(self, hook_name: str, *args: Any) -> None: ... + def should_capture_hook(self, hook_name: str) -> bool: ... + def run_hook_with_capture(self, hook_name: str, *args: str, **kwargs: str) -> bool: ... + def run_hook_tags(self, hook_name: str, tags: list[str]) -> bool: ... + def run_hook_tags_with_capture(self, hook_name: str, tags: list[str], capture_sink=None) -> bool: ... + def setup_capture(self, name: str | None = None) -> None: ... + def start_capture(self) -> None: ... + def stop_capture(self) -> None: ... + def teardown_capture(self) -> None: ... + @property + def captured(self): ... + def run_model(self, features: list[Incomplete] | None = None) -> bool: ... + def run(self) -> bool: ... + +class Runner(ModelRunner): + DEFAULT_DIRECTORY: str + path_manager: Incomplete + base_dir: Incomplete + + def __init__(self, config) -> None: ... + def setup_paths(self) -> None: ... + def before_all_default_hook(self, context: Context) -> None: ... + def load_hooks(self, filename: str | None = None) -> None: ... + def load_step_definitions(self, extra_step_paths: list[str] | None = None) -> None: ... + def feature_locations(self) -> list[str]: ... + def run(self) -> bool: ... + def run_with_paths(self) -> bool: ... + def __getattr__(name: str) -> Incomplete: ...