Skip to content

[behave] Added anottations for four classes#15953

Open
Spider84pr wants to merge 3 commits into
python:mainfrom
Spider84pr:behave2
Open

[behave] Added anottations for four classes#15953
Spider84pr wants to merge 3 commits into
python:mainfrom
Spider84pr:behave2

Conversation

@Spider84pr

Copy link
Copy Markdown
Contributor

I'm working on fully annotating behave/behave/runner.pyi.

This first commit adds annotations for four classes (ModelRunner, Runner, ContextMaskWarning, ContextMode).

In the next commit I'll add the remaining annotations (standalone functions and the Context class, which was partially annotated before).

@github-actions

This comment has been minimized.

@Spider84pr Spider84pr changed the title Added anottations for four classes [behave] Added anottations for four classes Jun 27, 2026
@Spider84pr

Copy link
Copy Markdown
Contributor Author

I have added remaining annotation as much as can.
Later will try add more stubs for classes of this library - so will annotate missing annotations and Incomplete in this file too.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Comment thread stubs/behave/behave/runner.pyi
def execute_steps(self, steps_text: str) -> bool: ...
def add_cleanup(self, cleanup_func: Callable[_P, Incomplete], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
@property
def captured(self): ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here :)

@staticmethod
def ignore_cleanup_error(context, cleanup_func, exception: BaseException) -> None: ...
def use_with_user_mode(self) -> AbstractContextManager[None]: ...
def user_mode(self) -> Generator[Incomplete]: ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are refactoring this module, let's remove all Incomplete types as well. Or add a comment on why it is hard to do / impossible (if this is the case).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sobolevn I have already mentioned that this library missing most of classes stubs. When I create it I will update this file too.

def attach(self, mime_type: str, data: bytes) -> None: ...

@contextlib.contextmanager
def use_context_with_mode(context, mode) -> Generator[None]: ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When adding new annotations, it would be preferable to add types to them :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants