Skip to content

Make BaseValidationError base static in Python < 3.11 #379

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

Merged
merged 2 commits into from
Jun 10, 2023

Conversation

layday
Copy link
Contributor

@layday layday commented Jun 8, 2023

Unsure if this worked in MyPy but Pyright failed to resolve the base of BaseValidationError subclasses leading to hard to trace type errors in custom note attributes from failing to narrow Iterable and ClassValidationError unions.

Unsure if this worked in MyPy but Pyright failed to resolve
the base of `BaseValidationError` subclasses leading to
hard to trace type errors in custom note attributes
from failing to narrow Iterable and ClassValidationError unions.
@layday
Copy link
Contributor Author

layday commented Jun 8, 2023

Because str.index exists and it's a function on AttributeValidationNote iso of the IterableValidationNote's str | int, Pyright would expand note.index to ((__sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ..., /) -> int) | int | str 🙈

@codecov-commenter
Copy link

codecov-commenter commented Jun 8, 2023

Codecov Report

Merging #379 (356b82c) into main (116d25b) will decrease coverage by 1.42%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #379      +/-   ##
==========================================
- Coverage   95.80%   94.38%   -1.42%     
==========================================
  Files          26       26              
  Lines        2121     2120       -1     
==========================================
- Hits         2032     2001      -31     
- Misses         89      119      +30     
Impacted Files Coverage Δ
src/cattrs/_compat.py 95.17% <100.00%> (-0.90%) ⬇️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Tinche
Copy link
Member

Tinche commented Jun 10, 2023

Cool, thanks!

@Tinche Tinche merged commit 470b038 into python-attrs:main Jun 10, 2023
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.

3 participants