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

FixIncEx type alias definition#10339

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
sydney-runkle merged 4 commits intomainfrominc-ex-ann
Sep 7, 2024
Merged

FixIncEx type alias definition#10339

sydney-runkle merged 4 commits intomainfrominc-ex-ann
Sep 7, 2024

Conversation

Viicos
Copy link
Member

Change Summary

Fixes#10333
Requirespydantic/pydantic-core#1443

Ideally we would import_IncEx frompydantic-core, but some external tools requires these annotations to be available at runtime :/

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

@github-actionsgithub-actionsbot added the relnotes-fixUsed for bugfixes. labelSep 6, 2024
@cloudflare-workers-and-pagesCloudflare Workers and Pages
Copy link

cloudflare-workers-and-pagesbot commentedSep 6, 2024
edited
Loading

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit:5ab7f38
Status: ✅  Deploy successful!
Preview URL:https://fa7af8a1.pydantic-docs.pages.dev
Branch Preview URL:https://inc-ex-ann.pydantic-docs.pages.dev

View logs

# Keep these type aliases available at runtime:
TupleGenerator: TypeAlias = Generator[Tuple[str, Any], None, None]
# Keep this type alias in sync with the stub definition in `pydantic-core`:
IncEx: TypeAlias = 'set[int] | set[str] | dict[int, IncEx | bool] | dict[str, IncEx | bool]'
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I removed the| None and added it in the relevant method signatures, as it makes more sense imo to keep the type alias scoped to what it represents, and then have consumers of this type alias make it optional or not.

sydney-runkle reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

Good call.

@codspeed-hqCodSpeed HQ
Copy link

codspeed-hqbot commentedSep 6, 2024
edited
Loading

CodSpeed Performance Report

Merging#10339 willnot alter performance

Comparinginc-ex-ann (5ab7f38) withmain (e060425)

Summary

✅ 49 untouched benchmarks

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.

Looks good. What happened toModelT?

# Keep these type aliases available at runtime:
TupleGenerator: TypeAlias = Generator[Tuple[str, Any], None, None]
# Keep this type alias in sync with the stub definition in `pydantic-core`:
IncEx: TypeAlias = 'set[int] | set[str] | dict[int, IncEx | bool] | dict[str, IncEx | bool]'
Copy link
Contributor

Choose a reason for hiding this comment

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

Good call.

@Viicos
Copy link
MemberAuthor

Looks good. What happened toModelT?

I moved it just above thecreate_model definition, where it is used (so that it is more clear what it is for)

sydney-runkle reacted with thumbs up emoji

@sydney-runklesydney-runkleenabled auto-merge (squash)September 7, 2024 15:26
@sydney-runklesydney-runkle merged commitcdca7ae intomainSep 7, 2024
60 checks passed
@sydney-runklesydney-runkle deleted the inc-ex-ann branchSeptember 7, 2024 16:02
@github-actionsGitHub Actions
Copy link
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic/_internal
  _model_construction.py
Project Total 

This report was generated bypython-coverage-comment-action

sydney-runkle added a commit that referenced this pull requestSep 9, 2024
Co-authored-by: sydney-runkle <sydneymarierunkle@gmail.com>
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.

Type alias for model_dump include/exclude is broken
2 participants
@Viicos@sydney-runkle

[8]ページ先頭

©2009-2025 Movatter.jp