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

Better-support mypy strict equality flag #8799

Merged
merged 3 commits into from Feb 13, 2024

Conversation

dmontagu
Copy link
Contributor

Closes #8773

Copy link

codspeed-hq bot commented Feb 13, 2024

CodSpeed Performance Report

Merging #8799 will not alter performance

Comparing dmontagu/strict-equality-type-checking (d15cbcd) with main (14ce997)

Summary

✅ 10 untouched benchmarks

Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

Approved, assuming tests pass

@sydney-runkle sydney-runkle added relnotes-fix Used for bugfixes. mypy related to mypy labels Feb 13, 2024
Copy link

cloudflare-pages bot commented Feb 13, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: d15cbcd
Status: ✅  Deploy successful!
Preview URL: https://1271a568.pydantic-docs2.pages.dev
Branch Preview URL: https://dmontagu-strict-equality-typ.pydantic-docs2.pages.dev

View logs

@@ -192,6 +193,8 @@ def test_mypy_results(config_filename: str, python_filename: str, request: pytes
if test_config.existing is not None:
existing_output_code = test_config.existing.output_path.read_text()
print(f'Comparing output with {test_config.existing.output_path}')
else:
print('Expecting no mypy errors')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

wasted some time confused by the lack of this message

Comment on lines +208 to +210
print('**** Merged Output ****')
print(merged_output)
print('***********************')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was helpful for debugging, and I don't see much reason not to include it

@@ -279,7 +285,7 @@ def merge_python_and_mypy_output(source_code: str, mypy_output: str) -> str:
if not line:
continue
try:
line_number, message = line.split(':', maxsplit=1)
line_number, message = re.split(r':(?:\d+:)?', line, maxsplit=1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if this is just a python 3.12 thing, but I was running into an issue where the messages had two numbers, like, 9:7: error: Non-overlapping equality check (left operand type: "User", right operand type: "Literal['test']") [comparison-overlap]. I think the second number is the character index. Considering this happened for me locally but I don't think it does in CI, it seems best to just prepare for it to be present in some cases and not others and split that off like this if present.

@sydney-runkle sydney-runkle merged commit 3c6bddb into main Feb 13, 2024
53 checks passed
@sydney-runkle sydney-runkle deleted the dmontagu/strict-equality-type-checking branch February 13, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mypy related to mypy relnotes-fix Used for bugfixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mypy pydantic plugin comparaison no error
2 participants