Skip to content

Commit daae60a

Browse files
fix: Parse pydantic version with regex (#218)
* fix: Parse pydantic version with regex Fixes parsing errors with Pydantic prereleases * style(pre-commit.ci): auto fixes [...] --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent fec18af commit daae60a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/useq/_base_model.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
from re import findall
23
from types import MappingProxyType
34
from typing import (
45
IO,
@@ -26,7 +27,7 @@
2627
_T = TypeVar("_T", bound="FrozenModel")
2728
_Y = TypeVar("_Y", bound="UseqModel")
2829

29-
PYDANTIC_VERSION = tuple(int(x) for x in pydantic.__version__.split(".")[:3])
30+
PYDANTIC_VERSION = tuple(int(x) for x in findall(r"\d_", pydantic.__version__)[:3])
3031
GET_DEFAULT_KWARGS: dict = {}
3132
if PYDANTIC_VERSION >= (2, 10):
3233
GET_DEFAULT_KWARGS = {"validated_data": {}}

0 commit comments

Comments
 (0)