Skip to content

Annotate braintree's MultipleValueNodeBuilder.in_list method - #16235

Open
cuu508 wants to merge 1 commit into
python:mainfrom
cuu508:annotate_braintree_in_list
Open

Annotate braintree's MultipleValueNodeBuilder.in_list method#16235
cuu508 wants to merge 1 commit into
python:mainfrom
cuu508:annotate_braintree_in_list

Conversation

@cuu508

@cuu508 cuu508 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

This adds type annotations for braintree.search.Search.MultipleValueNodeBuilder.in_list.

Looking at the source, the return value can only be Search.Node.

It's less clear what the type of *values elements can be, but grepping around the source it looked like it's only str.

@github-actions

Copy link
Copy Markdown
Contributor

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

@donbarbos donbarbos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you! Just one nit

whitelist: Incomplete
def __init__(self, name, whitelist=[]) -> None: ...
def in_list(self, *values): ...
def in_list(self, *values: str) -> Search.Node: ...

@donbarbos donbarbos Aug 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since a list can be used as such a sequence of values for the first argument, I think it might be worth adding an overload for this case.
(Please, import Unused from _typeshed)

Suggested change
def in_list(self, *values: str) -> Search.Node: ...
@overload
def in_list(self, value: list[str], *values: Unused) -> Search.Node: ...
@overload
def in_list(self, *values: str) -> Search.Node: ...

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