Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

HideBaseModel.__replace__ definition from type checkers#10979

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Viicos merged 1 commit intomainfromreplace-mypy
Nov 26, 2024

Conversation

Viicos
Copy link
Member

@ViicosViicos commentedNov 26, 2024
edited
Loading

Fixes#10970.

Because we make use of@dataclass_transform(), the method is synthesized by type checkers already. This fixes an issue with mypy and the Pydantic plugin, as the plugin removes thedataclass_transform spec fromBaseModel subclasses, but not forRootModel which uses a different metaclass, and led to override issues with the synthesized__replace__ for root models and theBaseModel.__replace__ definition.

Change Summary

Related issue number

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review,please add a comment including the phrase "please review" to assign reviewers

Because we make use of `@dataclass_transform()`, the method issynthesized by type checkers already. This fixes an issue withmypy and the Pydantic plugin, as the plugin removes the`dataclass_transform` spec from `BaseModel` subclasses,but not for `RootModel` that uses a different metaclass.
@ViicosViicosenabled auto-merge (squash)November 26, 2024 10:22
@github-actionsgithub-actionsbot added the relnotes-fixUsed for bugfixes. labelNov 26, 2024
@ViicosViicos mentioned this pull requestNov 26, 2024
36 tasks
@codspeed-hqCodSpeed HQ
Copy link

CodSpeed Performance Report

Merging#10979 willnot alter performance

Comparingreplace-mypy (86657f0) withmain (eec33b4)

Summary

✅ 46 untouched benchmarks

@github-actionsGitHub Actions
Copy link
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  main.py
Project Total 

This report was generated bypython-coverage-comment-action

Copy link
Contributor

@sydney-runklesydney-runkle left a comment

Choose a reason for hiding this comment

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

Thanks@Viicos :)

@ViicosViicos merged commit4fffffe intomainNov 26, 2024
55 checks passed
@ViicosViicos deleted the replace-mypy branchNovember 26, 2024 12:05
sydney-runkle pushed a commit that referenced this pull requestNov 26, 2024
Because we make use of `@dataclass_transform()`, the method is synthesized by type checkers already. This fixes an issue with mypy and the Pydantic plugin, as the plugin removes the `dataclass_transform` spec from `BaseModel` subclasses, but not for `RootModel` which uses a different metaclass, and led to override issues with the synthesized `__replace__` for root models and the `BaseModel.__replace__` definition.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sydney-runklesydney-runklesydney-runkle approved these changes

Assignees
No one assigned
Labels
relnotes-fixUsed for bugfixes.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Signature of "__replace__" incompatible - RootModel
2 participants
@Viicos@sydney-runkle

[8]ページ先頭

©2009-2025 Movatter.jp