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

Make signature class only #1466

Merged
merged 2 commits into from May 18, 2020

Conversation

Bobronium
Copy link
Contributor

@Bobronium Bobronium commented Apr 30, 2020

Change Summary

Make __signature__ attribute class-only

Related issue number

Closes #1419

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)

@codecov
Copy link

codecov bot commented Apr 30, 2020

Codecov Report

Merging #1466 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1466   +/-   ##
=======================================
  Coverage   99.94%   99.94%           
=======================================
  Files          21       21           
  Lines        3761     3770    +9     
  Branches      748      749    +1     
=======================================
+ Hits         3759     3768    +9     
  Misses          1        1           
  Partials        1        1           
Impacted Files Coverage Δ
pydantic/utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 881df8b...a29fda9. Read the comment docs.

@samuelcolvin
Copy link
Member

Very clever solution. LGTM 👍

@JrooTJunior @PrettyWood does this work for you?

@PrettyWood
Copy link
Member

PrettyWood commented May 1, 2020

Yes I already said it was a way nicer and efficient solution on the PR I closed ! Thanks

@JrooTJunior
Copy link

Looks good

@basnijholt
Copy link

In case someone else finds this issue when investigating why the signature of

from pydantic import BaseModel

class FooModel(BaseModel):
    id: int
    name: str = None
    description: str = 'Foo'

is Init signature: FooModel(__pydantic_self__, **data: typing.Any) -> None.

You might be running into this bug napari/napari#2264, which is a strange interaction between PySide2 and Pydantic.

Just leaving this here because it took me a long time to find out what's happening.

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.

Incorrect signature for instances of models
5 participants