Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing problem for validator collections #1244

Open
AdrianSosic opened this issue Feb 21, 2024 · 0 comments
Open

Typing problem for validator collections #1244

AdrianSosic opened this issue Feb 21, 2024 · 0 comments

Comments

@AdrianSosic
Copy link

This is a copy of the second issue collected in #1206 to enable separate tracking of the bug.

The issue

Consider the following piece of code:

@define
class A:
    x: List[str] = field(
        validator=deep_iterable(
            member_validator=[instance_of(str), min_len(1)],
            iterable_validator=and_(instance_of(list), min_len(1)),
        ),
    )

When a list of validators is passed for member_validator, mypy complains about the type, as already pointed out in #1197. However, when a tuple is used instead, mypy is happy.

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

No branches or pull requests

1 participant