summaryrefslogtreecommitdiff
path: root/dev-python/pydantic
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-08-17 11:36:49 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-08-17 11:36:49 +0100
commite2db47eaae00ec33f8971db44b68645c5d3b9590 (patch)
tree3ec0cf16ddb5854017e134fabebe14bf8cb94a34 /dev-python/pydantic
parent616579b5d773c50af31ee56f00105d96ce641ca2 (diff)
gentoo resync : 17.08.2021
Diffstat (limited to 'dev-python/pydantic')
-rw-r--r--dev-python/pydantic/Manifest3
-rw-r--r--dev-python/pydantic/files/pydantic-1.8.2_p20210719-update-py3.10rc1.patch174
-rw-r--r--dev-python/pydantic/pydantic-1.8.2_p20210719.ebuild45
3 files changed, 222 insertions, 0 deletions
diff --git a/dev-python/pydantic/Manifest b/dev-python/pydantic/Manifest
index 1341129c2c4f..f7599679be85 100644
--- a/dev-python/pydantic/Manifest
+++ b/dev-python/pydantic/Manifest
@@ -1,3 +1,6 @@
+AUX pydantic-1.8.2_p20210719-update-py3.10rc1.patch 5461 BLAKE2B 991dc2438ebe9db73313761c59a1fc854a11990cf32b08cb98f07857a21a4123642ce280b7054071659ac3dad7c6400be83d62c990ce53dafba028d42389d84b SHA512 77dd1770c194c94dd27a9bd4ab044e02cd3f6716febd95b66b78ea043ea1b519beb896a2452c6281723cd8aef3d32f6f3db48fa08f83d6380ab7f602a74bdf16
DIST pydantic-1.8.2.tar.gz 301802 BLAKE2B f02fca273c356dd0ab177de73d21da7749e1a9ea1ead92f4e82b44285b97e8b8431961b2c30d230cbec817698791e4b0cdf8498615b7a0639fa739b09f1b58e8 SHA512 0a28c64b97678b932092e546da877a4a6d104fc7d3b7cb043b3494f0b7c6900cdc1ab8a83bdbd1879956a81da1b28ca27578b1a003bdca3e08f0f107e5690e06
+DIST pydantic-1.8.2_p20210719.tar.gz 310729 BLAKE2B 1905ddd100e3a40b48eadc7beb75542f4a59ff8ef55115105041b0c06249ee67df1ca91003bc01f828c543c757ec8931ff2d31663d33ca16f356f62f71a61474 SHA512 c9d91788b3143b211755806e533ae0ccafa2ab101159f98eeba921ec9370956e8f8b0f210e6ddddcef2345ea391d2e1011ea5498d2f7985bd711f48d025e30d5
EBUILD pydantic-1.8.2.ebuild 1013 BLAKE2B 54ae89c0eb96fb0b4691f5cbcc5cf7d9825a27ebe839f2e5555f54345c48b3cfe0b814d7d69b88d64a4dfc8dc95e20b0d6ba0ad10102fea040ee66e78cccf255 SHA512 821f5466d0dd21d98dbb9bd32ae96e3aacb3b390ecb3f6b541c9a1e0f1953ebd784e2a2516473fa9fd7f3238d29cacf06a9038f451a0068955a2c397492354d6
+EBUILD pydantic-1.8.2_p20210719.ebuild 1036 BLAKE2B b05d9a54f856c719aa437bd5405454630ea4f16aef1e984ddffbeb9748e9e3d1e8d57ff1c6dba1b62ff4a34d97bf94562128b8e5e6e39cd50fb0e0c5f55f72e2 SHA512 3a9d283eaaba1268708a4512a343768f3b8bfd5d52be79d29aac6bca5394d15682bfec5ce375cd6a31a4521b0916c8e3900125ef734d138eeec29ad4b7ff93fb
MISC metadata.xml 491 BLAKE2B 1c17cf9901705ce6aa44e87902e2d52dbebf6c465ce3210b005ce0a2a69df04f91f90d3f8bfb3f44c1ce804bdb02bfd959920564b5e496ea58089fa77b4ccb22 SHA512 f7fd4fa24b1df7ecb7260f74569413af570c75df6e2c52fa59a8e01d030e4c0bbef120e53f6c3a6b0ad8100d8797c86dd8c1586f86f02c3a740362f6f0b96479
diff --git a/dev-python/pydantic/files/pydantic-1.8.2_p20210719-update-py3.10rc1.patch b/dev-python/pydantic/files/pydantic-1.8.2_p20210719-update-py3.10rc1.patch
new file mode 100644
index 000000000000..d4700a7e33b7
--- /dev/null
+++ b/dev-python/pydantic/files/pydantic-1.8.2_p20210719-update-py3.10rc1.patch
@@ -0,0 +1,174 @@
+From: PrettyWood <em.jolibois@gmail.com>
+Date: Tue, 10 Aug 2021 18:00:16 +0200
+Subject: [PATCH 1/2] refactor: rename `is_union` into `is_union_origin`
+https://github.com/samuelcolvin/pydantic/pull/3085
+
+--- a/pydantic/fields.py
++++ b/pydantic/fields.py
+@@ -41,7 +41,7 @@
+ is_literal_type,
+ is_new_type,
+ is_typeddict,
+- is_union,
++ is_union_origin,
+ new_type_supertype,
+ )
+ from .utils import PyObjectStr, Representation, ValueItems, lenient_issubclass, sequence_like, smart_deepcopy
+@@ -557,7 +557,7 @@ def _type_analysis(self) -> None: # noqa: C901 (ignore complexity)
+ return
+ if origin is Callable:
+ return
+- if is_union(origin):
++ if is_union_origin(origin):
+ types_ = []
+ for type_ in get_args(self.type_):
+ if type_ is NoneType:
+--- a/pydantic/main.py
++++ b/pydantic/main.py
+@@ -38,7 +38,7 @@
+ get_origin,
+ is_classvar,
+ is_namedtuple,
+- is_union,
++ is_union_origin,
+ resolve_annotations,
+ update_field_forward_refs,
+ )
+@@ -176,7 +176,7 @@ def is_untouched(v: Any) -> bool:
+ elif is_valid_field(ann_name):
+ validate_field_name(bases, ann_name)
+ value = namespace.get(ann_name, Undefined)
+- allowed_types = get_args(ann_type) if is_union(get_origin(ann_type)) else (ann_type,)
++ allowed_types = get_args(ann_type) if is_union_origin(get_origin(ann_type)) else (ann_type,)
+ if (
+ is_untouched(value)
+ and ann_type != PyObject
+--- a/pydantic/schema.py
++++ b/pydantic/schema.py
+@@ -71,7 +71,7 @@
+ is_callable_type,
+ is_literal_type,
+ is_namedtuple,
+- is_union,
++ is_union_origin,
+ )
+ from .utils import ROOT_KEY, get_model, lenient_issubclass, sequence_like
+
+@@ -966,7 +966,7 @@ def go(type_: Any) -> Type[Any]:
+
+ if origin is Annotated:
+ return go(args[0])
+- if is_union(origin):
++ if is_union_origin(origin):
+ return Union[tuple(go(a) for a in args)] # type: ignore
+
+ if issubclass(origin, List) and (field_info.min_items is not None or field_info.max_items is not None):
+--- a/pydantic/typing.py
++++ b/pydantic/typing.py
+@@ -191,14 +191,14 @@ def get_args(tp: Type[Any]) -> Tuple[Any, ...]:
+
+ if sys.version_info < (3, 10):
+
+- def is_union(tp: Type[Any]) -> bool:
++ def is_union_origin(tp: Type[Any]) -> bool:
+ return tp is Union
+
+
+ else:
+ import types
+
+- def is_union(tp: Type[Any]) -> bool:
++ def is_union_origin(tp: Type[Any]) -> bool:
+ return tp is Union or tp is types.Union
+
+
+@@ -251,7 +251,7 @@ def is_union(tp: Type[Any]) -> bool:
+ 'get_origin',
+ 'typing_base',
+ 'get_all_type_hints',
+- 'is_union',
++ 'is_union_origin',
+ )
+
+
+
+From: PrettyWood <em.jolibois@gmail.com>
+Date: Tue, 10 Aug 2021 18:02:57 +0200
+Subject: [PATCH 2/2] fix: "new" union and generic types are not the same as
+ `typing.GenericAlias`
+
+--- a/pydantic/typing.py
++++ b/pydantic/typing.py
+@@ -28,10 +28,10 @@
+ from typing import _Final as typing_base # type: ignore
+
+ try:
+- from typing import GenericAlias # type: ignore
++ from typing import GenericAlias as TypingGenericAlias # type: ignore
+ except ImportError:
+ # python < 3.9 does not have GenericAlias (list[int], tuple[str, ...] and so on)
+- GenericAlias = ()
++ TypingGenericAlias = ()
+
+
+ if sys.version_info < (3, 7):
+@@ -194,12 +194,16 @@ def get_args(tp: Type[Any]) -> Tuple[Any, ...]:
+ def is_union_origin(tp: Type[Any]) -> bool:
+ return tp is Union
+
++ WithArgsTypes = (TypingGenericAlias,)
+
+ else:
+ import types
++ import typing
+
+ def is_union_origin(tp: Type[Any]) -> bool:
+- return tp is Union or tp is types.Union
++ return tp is Union or tp is types.UnionType # type: ignore # noqa: E721
++
++ WithArgsTypes = (typing._GenericAlias, types.GenericAlias, types.UnionType) # type: ignore
+
+
+ if TYPE_CHECKING:
+@@ -246,7 +250,7 @@ def is_union_origin(tp: Type[Any]) -> bool:
+ 'CallableGenerator',
+ 'ReprArgs',
+ 'CallableGenerator',
+- 'GenericAlias',
++ 'WithArgsTypes',
+ 'get_args',
+ 'get_origin',
+ 'typing_base',
+@@ -260,10 +264,10 @@ def is_union_origin(tp: Type[Any]) -> bool:
+
+
+ def display_as_type(v: Type[Any]) -> str:
+- if not isinstance(v, typing_base) and not isinstance(v, GenericAlias) and not isinstance(v, type):
++ if not isinstance(v, typing_base) and not isinstance(v, WithArgsTypes) and not isinstance(v, type):
+ v = v.__class__
+
+- if isinstance(v, GenericAlias):
++ if isinstance(v, WithArgsTypes):
+ # Generic alias are constructs like `list[int]`
+ return str(v).replace('typing.', '')
+
+--- a/pydantic/utils.py
++++ b/pydantic/utils.py
+@@ -23,7 +23,7 @@
+ Union,
+ )
+
+-from .typing import GenericAlias, NoneType, display_as_type
++from .typing import NoneType, WithArgsTypes, display_as_type
+ from .version import version_info
+
+ if TYPE_CHECKING:
+@@ -152,7 +152,7 @@ def lenient_issubclass(cls: Any, class_or_tuple: Union[Type[Any], Tuple[Type[Any
+ try:
+ return isinstance(cls, type) and issubclass(cls, class_or_tuple)
+ except TypeError:
+- if isinstance(cls, GenericAlias):
++ if isinstance(cls, WithArgsTypes):
+ return False
+ raise # pragma: no cover
+
diff --git a/dev-python/pydantic/pydantic-1.8.2_p20210719.ebuild b/dev-python/pydantic/pydantic-1.8.2_p20210719.ebuild
new file mode 100644
index 000000000000..5ea79549742d
--- /dev/null
+++ b/dev-python/pydantic/pydantic-1.8.2_p20210719.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit distutils-r1
+
+COMMIT=0c26c1c4e288e0d41d2c3890d5b3befa7579455c
+
+DESCRIPTION="Data parsing and validation using Python type hints"
+HOMEPAGE="https://github.com/samuelcolvin/pydantic"
+# No tests on PyPI: https://github.com/samuelcolvin/pydantic/pull/1976
+SRC_URI="
+ https://github.com/samuelcolvin/pydantic/archive/${COMMIT}.tar.gz
+ -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-${COMMIT}"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="
+ dev-python/typing-extensions[${PYTHON_USEDEP}]
+"
+BDEPEND="
+ dev-python/cython[${PYTHON_USEDEP}]
+ test? (
+ dev-python/hypothesis[${PYTHON_USEDEP}]
+ dev-python/pytest-mock[${PYTHON_USEDEP}]
+ dev-python/python-email-validator[${PYTHON_USEDEP}]
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-update-py3.10rc1.patch"
+)
+
+distutils_enable_tests --install pytest
+
+src_prepare() {
+ # seriously?
+ sed -i -e '/CFLAGS/d' setup.py || die
+ distutils-r1_src_prepare
+}