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

Make sureinspect.iscoroutinefunction works on coroutines decorated with@validate_call#10374

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 7 commits intopydantic:mainfromMovisLi:validate_call_patch
Sep 12, 2024

Conversation

MovisLi
Copy link
Contributor

@MovisLiMovisLi commentedSep 10, 2024
edited
Loading

Change Summary

Add judgement for validate_call decorator. Now we can getTrue return frominpect.iscoroutinefunction().

Related issue number

fix#10370

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

Selected Reviewer:@sydney-runkle

@github-actionsgithub-actionsbot added the relnotes-fixUsed for bugfixes. labelSep 10, 2024
@MovisLi
Copy link
ContributorAuthor

@sydney-runkle , please review.

pydantic-hooky[bot] reacted with thumbs up emoji

@codspeed-hqCodSpeed HQ
Copy link

codspeed-hqbot commentedSep 10, 2024
edited
Loading

CodSpeed Performance Report

Merging#10374 willnot alter performance

ComparingMovisLi:validate_call_patch (d152715) withmain (8b6d5fc)

Summary

✅ 49 untouched benchmarks

@github-actionsGitHub Actions
Copy link
Contributor

github-actionsbot commentedSep 10, 2024
edited
Loading

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  validate_call_decorator.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.

Looking good, could you please add a test as well? Thanks!

@pydantic-hookypydantic-hookybot added awaiting author revisionawaiting changes from the PR author and removed ready for review labelsSep 11, 2024
@MovisLi
Copy link
ContributorAuthor

Looking good, could you please add a test as well? Thanks!

I don't quite understand what changes need to be made to the test cases. I add some codes to check if it is a coroutine the async function under decorator. Please check it, thank you!

@Viicos
Copy link
Member

I don't quite understand what changes need to be made to the test cases. I add some codes to check if it is a coroutine the async function under decorator. Please check it, thank you!

Something like:

importinspect@validate_callasyncdeftest():passassertinspect.iscoroutinefunction(test)

@ViicosViicos changed the titlefix validate_call decorator #10370Make sureinspect.iscoroutinefunction works on coroutines decorated with@validate_callSep 12, 2024
@sydney-runkle
Copy link
Contributor

Happy to do another review here after we:

  • revert formatting changes
  • add a test like@Viicos sugested
  • Move the function definitions into the conditional blocks, see below:

currently:

# function definitionsif condition:    return func1else:    return func2

desired:

if condition:    # define func1    return func1else:    # define func2    return func2

Thanks, great work here!

@MovisLi
Copy link
ContributorAuthor

@Viicos@sydney-runkle I finish all@sydney-runkle mentioned. Please check it, thank you!

sydney-runkle reacted with thumbs up emoji

Copy link
ContributorAuthor

@MovisLiMovisLi left a comment

Choose a reason for hiding this comment

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

check

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.

Awesome job, thanks for the help here!!

MovisLi reacted with heart emoji
@sydney-runklesydney-runkle merged commit1cb0a8b intopydantic:mainSep 12, 2024
60 checks passed
@MovisLiMovisLi deleted the validate_call_patch branchSeptember 12, 2024 15:59
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

@ViicosViicosViicos approved these changes

Assignees

@MovisLiMovisLi

Labels
awaiting author revisionawaiting changes from the PR authorrelnotes-fixUsed for bugfixes.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Support async functions with@validate_call decorator
3 participants
@MovisLi@Viicos@sydney-runkle

[8]ページ先頭

©2009-2025 Movatter.jp