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

allow int and float root types #77

Merged
merged 1 commit into from
May 27, 2022
Merged

allow int and float root types #77

merged 1 commit into from
May 27, 2022

Conversation

azaroth42
Copy link
Contributor

e.g. for duration or other wrapped types

Copy link
Member

@digitaldogsbody digitaldogsbody left a comment

Choose a reason for hiding this comment

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

I am not sure that Pydantic uses the native float type, so you might need to import its custom one:

class Duration(Base):
    __root__: confloat(ge=0.0)

@azaroth42
Copy link
Contributor Author

It does use native float:

>>> c = Canvas()
>>> c.duration = 1.2
>>> c.duration
1.2
>>> type(c.duration)
<class 'float'>

@digitaldogsbody
Copy link
Member

Ah great!

@giacomomarchioro
Copy link
Contributor

It seems working fine now! I think we can merge!

@azaroth42 azaroth42 merged commit ee8b397 into main May 27, 2022
@azaroth42 azaroth42 deleted the fix_getatttr_again branch May 27, 2022 18:09
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.

3 participants