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

Reports warning when creating model with IPvAnyAddress field #933

Open
chbndrhnns opened this issue May 3, 2024 · 0 comments
Open

Reports warning when creating model with IPvAnyAddress field #933

chbndrhnns opened this issue May 3, 2024 · 0 comments

Comments

@chbndrhnns
Copy link

Describe the bug
PyCharm creates a warning but the model works fine. I do not know how to specify the field values without creating a warning.

To Reproduce

from ipaddress import IPv4Address

from pydantic import BaseModel, IPvAnyAddress


class M(BaseModel):
    ip: IPvAnyAddress


def test_():
    assert str(M(ip=IPv4Address("10.0.0.1")).ip) == "10.0.0.1"
    assert str(M(ip=IPvAnyAddress("10.0.0.1")).ip) == "10.0.0.1"
    assert str(M(ip="10.0.0.1").ip) == "10.0.0.1"

Expected behavior
PyCharm accepts values which are valid

Screenshots

Environments (please complete the following information):

  • IDE: [e.g. PyCharm Community 2022.1 ]: 2024.1.1
  • OS: [e.g. macOS 12.2.0 ]: macOS 14.3.6
  • Pydantic Version [e.g. 1.9.0 ]: 0.4.13
  • Plugin version [e.g. 0.3.11 ]

Additional context
Add any other context about the problem here.

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