Skip to content

Commit

Permalink
Merge branch 'dev' into unify_decorated_func_meta
Browse files Browse the repository at this point in the history
  • Loading branch information
eonu committed Dec 28, 2024
2 parents 3382215 + 9ac7c10 commit 71c6cf4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/sections/typing/pydantic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Path types
- :py:obj:`pydantic.types.DirectoryPath` (``>= 2.0.3``)
- :py:obj:`pydantic.types.FilePath` (``>= 2.0.3``)
- :py:obj:`pydantic.types.NewPath` (``>= 2.0.3``)
- :py:obj:`pydantic.types.SocketPath` (``>= 2.10.0``)

Decimal type
------------
Expand Down
5 changes: 5 additions & 0 deletions feud/typing/pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,9 @@

__all__.extend(types)

if version >= packaging.version.parse("2.10.0"):
types: list[str] = ["SocketPath"]

__all__.extend(types)

globals().update({attr: getattr(pydantic, attr) for attr in __all__})
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@
(t.conset(int, max_length=1), click.INT),
(t.constr(max_length=1), click.STRING),
(t.Annotated[int, pyd.AfterValidator(lambda x: x + 1)], click.INT),
(t.Base64UrlBytes, None),
(t.Base64UrlStr, click.STRING),
(t.JsonValue, None),
(t.NatsDsn, None),
(t.ClickHouseDsn, None),
(t.FtpUrl, None),
(t.WebsocketUrl, None),
(t.AnyWebsocketUrl, None),
(t.SnowflakeDsn, None),
(t.SocketPath, lambda x: isinstance(x, click.Path)),
],
)
def test_pydantic(
Expand Down

0 comments on commit 71c6cf4

Please sign in to comment.