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

Add better representation for Color object #140

Open
jjeff07 opened this issue Feb 23, 2024 · 0 comments
Open

Add better representation for Color object #140

jjeff07 opened this issue Feb 23, 2024 · 0 comments

Comments

@jjeff07
Copy link

jjeff07 commented Feb 23, 2024

I am trying to print out data models that use the Color class however the repr unlike BaseModel is showing rgb=XXX which is not valid for initilization.

from devtools import debug
from pydantic_extra_types.color import Color
color = Color('red')
"""
debug(color)
<input>:1 <module> (no code context for debug call, code inspection impossible)
    Color(
        'red',
        rgb=(
            255,
            0,
            0,
        ),
    ) (Color)
Color('red', rgb=(255, 0, 0))
"""
Color('red', rgb=(255, 0, 0))
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2023.2.2\plugins\python\helpers-pro\pydevd_asyncio\pydevd_asyncio_utils.py", line 114, in _exec_async_code
    result = func()
  File "<input>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'rgb'
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

No branches or pull requests

1 participant