Merge updates from master

This commit is contained in:
Repository mirror & CI
2024-07-08 19:33:43 +00:00
11 changed files with 289 additions and 17 deletions
+3 -3
View File
@@ -8,8 +8,8 @@ DIST meson-1.4.0.tar.gz 2224663 BLAKE2B 7f742ef870c182e552c1ff3508d65f251009d610
DIST meson-1.4.0.tar.gz.asc 833 BLAKE2B 6e4002303da16bcaa3d1d3c76a3485b23174074de2d29bd34347a4671d7fb0f1c0767559ed9267e0f0b52c02638b85a11a5980f4ee188e7e4d35c733b0821c62 SHA512 ea73e72d929bf30d28c033f103fd1d26bac7cef175aabbf9b3a24c7b336682c28f5aae184e04d2189731cf80dd7571939cb02de642bb5b412cea996ca30dfdad
DIST meson-1.4.1.tar.gz 2235558 BLAKE2B 1eb83ad34d9e0a80eaf667a5edf04cf40ff043c0b9e8c78c5bd553eb2dae372b4c0dc8e30760da0321b7c33d331304c21c7f51d2133681c9fa66d551039952f3 SHA512 2616bcca70d5554407d4852aa3494e05e53aa8a33f58859ada42750221922fcb6ea7f3452844883f4800d77eed4a7289b061324871218f052219b3caa02dcc9e
DIST meson-1.4.1.tar.gz.asc 833 BLAKE2B cbdac6620111acbb8c1e07a017a9f5f1cea2cfee62dc7ebf77a9dba7a578e43f8706923e4054ae8458c27a43112c634811c1a0d698f693f2e40744288ce586ea SHA512 bfc4f52a5e21684012aeef95dafba74a6d730efe88bc81bc410c183c253605f119dacd9684c3742ce1d3abf798a4443172526e535523531443beb0ca8c1c3633
DIST meson-1.5.0rc2.tar.gz 2255834 BLAKE2B e3bd5cb22676b69576698faa955eaaa14af9b891efd6853180eb9824a9a75e102af1b1c7c3c9cfc27581605720536e569911697ea1248cb1328d72169f270fb1 SHA512 39a1aa84a9aa219358f34dcd485a3788731f3325a2cd6bbbbb19b6b24a33852fa68fff9d6a0ad3a18e3fbf58a880839a6f54cfa3e2bf779c1212cd36f3b45a79
DIST meson-1.5.0rc2.tar.gz.asc 833 BLAKE2B 69a865a872a8e0dd47081be6a5456d475c13b636fb8699a83ca82b870f1917ca7608910236fe2d77b8e45838cf0a61466ee176408e89c87c6643f3881d49adcd SHA512 3101e759fc205d73434de71b56fb17ac3076691d6bdeb7f038b5d2983ed29680a54578fe8180d74809c4ec63c2e71dcff9d7d911c187c2fc7d7f7651972dce6e
DIST meson-1.5.0rc3.tar.gz 2261804 BLAKE2B 19475e84099a2652dc94c08c69b1b889281eba554ca7d4bf089ff80d5b56f6199b4d0fc0dd37d42adcd6d77d087f655eab0be1b6a03566f74ad2a5e267f19185 SHA512 3941f62ce9c2cace78fb8daa85dba375eda16e3fbf1822a1af4e7c478b99c6c29d4135214a592d2d394a16261c8cd3198a8f1ed1102359dbbf78ff41c1f8e5a1
DIST meson-1.5.0rc3.tar.gz.asc 833 BLAKE2B b05ad7927e6618afa6c41e0471d4b3118c4c91515272059d8a75e5770a19b7870147c44e1d68606ba3c98449f7c91929d351ba0c807943ab1410c65cf282fea4 SHA512 bb0c315ae5d59123fa06f530c779bc843c57f262867143d1f44feac6c8958f3638e59ee1900163d28a4adb95243445e5cc60d9efbdcfd55cefdec80d3774eca2
DIST meson-reference-1.4.0.3 339324 BLAKE2B 8ad24592c1a9100832dead97a55d4cb358892fc1cd6aee641f9610cb6a5df211831e6cfc42e047d5e835ed53de1bb9c7d711dd1a0a8cfe18a0f85e92a1a3f925 SHA512 8df06f63db6db01a6c8c0a5b4a8b26c868bb027f26580d290288b1067429a526fb654fae01a45085c1f20ee8dab1b5325e8b2fd285faf175d2fcfc2c704b4768
DIST meson-reference-1.4.1.3 339324 BLAKE2B a0ea6a1dd599c0a559dae64772f730ac7cad7df3ea63acc8355ff933152873567803efff012e6ea0a4c75ef9c8be023a8d927411a49e43de20bbfc69b1263488 SHA512 fc94aa95df3cd04af49ab2f27050c3ef206407a2ccb3b61d9c8660deba55eae3fb627d83713de62f3e1216a1a33a88e989bf5b557b7e17adbb73a57d5f2ad11a
DIST meson-reference-1.5.0rc2.3 341787 BLAKE2B 70e07aa724d6e46a1679178c7e34b05ec0cf825d0f163981f70e25f8e914a5746156e2c2169d68f0ad482a813f77bc6a2343009f84f0aa4746c0f47e65ae6dfe SHA512 37ba1c1a6655cadcb155bc2b1ae46d850f46b49209ddcd319a190d3e1579dc2bfd92528e7ab737206f0b212fcb58355b9ba8de4c60ceae8f044712746b6db4f4
DIST meson-reference-1.5.0rc3.3 341114 BLAKE2B 7b6b5e672a4cdf42531d6b33abb0c41d1d8b13bbcb6740587f07a40a782c1bcf031c44894f9ece50e815599a3e6565a6272ea40cbcc5d7330009a9723b08bf60 SHA512 210d77bd45518dcdf5a36a2df4b69685dddcc72ba958326ba70c81ed5d7fef973297afc5f4ebf169c4a3db85a6ca6107d47c925ddf6a327a37f92182b498f294
@@ -0,0 +1,86 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( pypy3 python3_{10..13} )
inherit distutils-r1
DESCRIPTION="Abstract Syntax Tree for logilab packages"
HOMEPAGE="
https://github.com/pylint-dev/astroid/
https://pypi.org/project/astroid/
"
SRC_URI="
https://github.com/pylint-dev/astroid/archive/v${PV}.tar.gz
-> ${P}.gh.tar.gz
"
LICENSE="LGPL-2.1+"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
# Version specified in pyproject.toml
RDEPEND="
$(python_gen_cond_dep '
>=dev-python/typing-extensions-4.0.0[${PYTHON_USEDEP}]
' 3.10)
"
# dev-python/regex isn't available for pypy
BDEPEND="
dev-python/setuptools-scm[${PYTHON_USEDEP}]
test? (
dev-python/attrs[${PYTHON_USEDEP}]
>=dev-python/numpy-1.17.0[${PYTHON_USEDEP}]
dev-python/python-dateutil[${PYTHON_USEDEP}]
$(python_gen_cond_dep '
dev-python/regex[${PYTHON_USEDEP}]
' 'python*')
)
"
distutils_enable_tests pytest
export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
PATCHES=(
# https://github.com/pylint-dev/astroid/pull/2424 (rebased)
"${FILESDIR}/${P}-py313.patch"
)
python_test() {
local EPYTEST_DESELECT=(
# no clue why they're broken
tests/test_modutils.py::GetModulePartTest::test_known_values_get_builtin_module_part
tests/test_regrtest.py::NonRegressionTests::test_numpy_distutils
# pydantic-2?
tests/brain/test_dataclasses.py::test_pydantic_field
# requires urllib3 with bundled six (skipped with urllib3>=2)
tests/test_modutils.py::test_file_info_from_modpath__SixMetaPathImporter
# hangs
tests/test_nodes.py::AsStringTest::test_recursion_error_trapped
# TODO
tests/test_builder.py::BuilderTest::test_data_build_error_filename
# numpy-2 (https://github.com/pylint-dev/astroid/issues/2442)
tests/brain/numpy/test_core_einsumfunc.py::test_numpy_function_calls_inferred_as_ndarray
tests/brain/numpy/test_core_fromnumeric.py::BrainNumpyCoreFromNumericTest::test_numpy_function_calls_inferred_as_ndarray
tests/brain/numpy/test_core_multiarray.py::BrainNumpyCoreMultiarrayTest::test_numpy_function_calls_inferred_as_ndarray
tests/brain/numpy/test_core_numerictypes.py::NumpyBrainCoreNumericTypesTest::test_datetime_astype_return
tests/brain/numpy/test_core_numerictypes.py::NumpyBrainCoreNumericTypesTest::test_generic_types_are_subscriptables
tests/brain/numpy/test_core_umath.py::NumpyBrainCoreUmathTest::test_numpy_core_umath_functions_return_type
tests/brain/numpy/test_core_umath.py::NumpyBrainCoreUmathTest::test_numpy_core_umath_functions_return_type_tuple
)
case ${EPYTHON} in
pypy3)
EPYTEST_DESELECT+=(
tests/test_transforms.py::TestTransforms::test_transform_aborted_if_recursion_limited
)
;;
esac
local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
epytest
}
@@ -0,0 +1,177 @@
diff --git a/astroid/brain/brain_dataclasses.py b/astroid/brain/brain_dataclasses.py
index 88a4385f..743dfe96 100644
--- a/astroid/brain/brain_dataclasses.py
+++ b/astroid/brain/brain_dataclasses.py
@@ -19,7 +19,7 @@ from typing import Literal, Tuple, Union
from astroid import bases, context, nodes
from astroid.builder import parse
-from astroid.const import PY39_PLUS, PY310_PLUS
+from astroid.const import PY39_PLUS, PY310_PLUS, PY313_PLUS
from astroid.exceptions import AstroidSyntaxError, InferenceError, UseInferenceDefault
from astroid.inference_tip import inference_tip
from astroid.manager import AstroidManager
@@ -503,6 +503,15 @@ def _looks_like_dataclass_field_call(
return inferred.name == FIELD_NAME and inferred.root().name in DATACLASS_MODULES
+def _looks_like_dataclasses(node: nodes.Module) -> bool:
+ return node.qname() == "dataclasses"
+
+
+def _resolve_private_replace_to_public(node: nodes.Module) -> None:
+ if "_replace" in node.locals:
+ node.locals["replace"] = node.locals["_replace"]
+
+
def _get_field_default(field_call: nodes.Call) -> _FieldDefaultReturn:
"""Return a the default value of a field call, and the corresponding keyword
argument name.
@@ -618,6 +627,13 @@ def _infer_instance_from_annotation(
def register(manager: AstroidManager) -> None:
+ if PY313_PLUS:
+ manager.register_transform(
+ nodes.Module,
+ _resolve_private_replace_to_public,
+ _looks_like_dataclasses,
+ )
+
manager.register_transform(
nodes.ClassDef, dataclass_transform, is_decorated_with_dataclass
)
diff --git a/astroid/brain/brain_pathlib.py b/astroid/brain/brain_pathlib.py
index 116cd2ee..d0f53132 100644
--- a/astroid/brain/brain_pathlib.py
+++ b/astroid/brain/brain_pathlib.py
@@ -8,6 +8,7 @@ from collections.abc import Iterator
from astroid import bases, context, inference_tip, nodes
from astroid.builder import _extract_single_node
+from astroid.const import PY313_PLUS
from astroid.exceptions import InferenceError, UseInferenceDefault
from astroid.manager import AstroidManager
@@ -27,10 +28,11 @@ def _looks_like_parents_subscript(node: nodes.Subscript) -> bool:
value = next(node.value.infer())
except (InferenceError, StopIteration):
return False
+ parents = "builtins.tuple" if PY313_PLUS else "pathlib._PathParents"
return (
isinstance(value, bases.Instance)
and isinstance(value._proxied, nodes.ClassDef)
- and value.qname() == "pathlib._PathParents"
+ and value.qname() == parents
)
diff --git a/astroid/brain/brain_typing.py b/astroid/brain/brain_typing.py
index 9965abc2..7a7c7183 100644
--- a/astroid/brain/brain_typing.py
+++ b/astroid/brain/brain_typing.py
@@ -15,7 +15,7 @@ from typing import Final
from astroid import context, extract_node, inference_tip
from astroid.brain.helpers import register_module_extender
from astroid.builder import AstroidBuilder, _extract_single_node
-from astroid.const import PY39_PLUS, PY312_PLUS
+from astroid.const import PY39_PLUS, PY312_PLUS, PY313_PLUS
from astroid.exceptions import (
AstroidSyntaxError,
AttributeInferenceError,
@@ -168,6 +168,15 @@ def infer_typing_attr(
# If typing subscript belongs to an alias handle it separately.
raise UseInferenceDefault
+ if (
+ PY313_PLUS
+ and isinstance(value, FunctionDef)
+ and value.qname() == "typing.Annotated"
+ ):
+ # typing.Annotated is a FunctionDef on 3.13+
+ node._explicit_inference = lambda node, context: iter([value])
+ return iter([value])
+
if isinstance(value, ClassDef) and value.qname() in {
"typing.Generic",
"typing.Annotated",
diff --git a/tests/brain/test_brain.py b/tests/brain/test_brain.py
index b8bc84e3..78b6f8b3 100644
--- a/tests/brain/test_brain.py
+++ b/tests/brain/test_brain.py
@@ -647,7 +647,7 @@ class TypingBrain(unittest.TestCase):
@test_utils.require_version(minver="3.9")
def test_typing_annotated_subscriptable(self):
- """Test typing.Annotated is subscriptable with __class_getitem__"""
+ """typing.Annotated is subscriptable with __class_getitem__ below 3.13."""
node = builder.extract_node(
"""
import typing
@@ -655,8 +655,13 @@ class TypingBrain(unittest.TestCase):
"""
)
inferred = next(node.infer())
- assert isinstance(inferred, nodes.ClassDef)
- assert isinstance(inferred.getattr("__class_getitem__")[0], nodes.FunctionDef)
+ if PY313_PLUS:
+ assert isinstance(inferred, nodes.FunctionDef)
+ else:
+ assert isinstance(inferred, nodes.ClassDef)
+ assert isinstance(
+ inferred.getattr("__class_getitem__")[0], nodes.FunctionDef
+ )
def test_typing_generic_slots(self):
"""Test slots for Generic subclass."""
diff --git a/tests/brain/test_pathlib.py b/tests/brain/test_pathlib.py
index d935d964..5aea8d37 100644
--- a/tests/brain/test_pathlib.py
+++ b/tests/brain/test_pathlib.py
@@ -5,7 +5,7 @@
import astroid
from astroid import bases
-from astroid.const import PY310_PLUS
+from astroid.const import PY310_PLUS, PY313_PLUS
from astroid.util import Uninferable
@@ -23,7 +23,10 @@ def test_inference_parents() -> None:
inferred = name_node.inferred()
assert len(inferred) == 1
assert isinstance(inferred[0], bases.Instance)
- assert inferred[0].qname() == "pathlib._PathParents"
+ if PY313_PLUS:
+ assert inferred[0].qname() == "builtins.tuple"
+ else:
+ assert inferred[0].qname() == "pathlib._PathParents"
def test_inference_parents_subscript_index() -> None:
@@ -40,7 +43,10 @@ def test_inference_parents_subscript_index() -> None:
inferred = path.inferred()
assert len(inferred) == 1
assert isinstance(inferred[0], bases.Instance)
- assert inferred[0].qname() == "pathlib.Path"
+ if PY313_PLUS:
+ assert inferred[0].qname() == "pathlib._local.Path"
+ else:
+ assert inferred[0].qname() == "pathlib.Path"
def test_inference_parents_subscript_slice() -> None:
diff --git a/tests/test_inference.py b/tests/test_inference.py
index ec8fc71b..95f00821 100644
--- a/tests/test_inference.py
+++ b/tests/test_inference.py
@@ -4458,8 +4458,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
# and reraise it as a TypeError in Class.getitem
node = extract_node(
"""
- def test():
- yield
+ def test(): ...
test()
"""
)
+2 -2
View File
@@ -1,10 +1,10 @@
# Copyright 2020-2023 Gentoo Authors
# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( pypy3 python3_{10..12} )
PYTHON_COMPAT=( pypy3 python3_{10..13} )
inherit distutils-r1
@@ -4,13 +4,19 @@
EAPI=8
DISTUTILS_USE_PEP517="setuptools"
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_COMPAT=( python3_{10..13} )
inherit distutils-r1
DESCRIPTION="A python implementation for Noise Protocol Framework"
HOMEPAGE="https://github.com/tgalal/dissononce"
SRC_URI="https://github.com/tgalal/${PN}/archive/${PV}.tar.gz -> ${P}.gh.tar.gz"
HOMEPAGE="
https://github.com/tgalal/dissononce/
https://pypi.org/project/dissononce/
"
SRC_URI="
https://github.com/tgalal/dissononce/archive/${PV}.tar.gz
-> ${P}.gh.tar.gz
"
LICENSE="MIT"
SLOT="0"
@@ -21,10 +27,13 @@ RDEPEND="
dev-python/cryptography[${PYTHON_USEDEP}]
dev-python/transitions[${PYTHON_USEDEP}]
"
BDEPEND="
${RDEPEND}
"
DEPEND="${RDEPEND}"
PATCHES=( "${FILESDIR}/${P}-fix-test-requirements.patch" )
PATCHES=(
"${FILESDIR}/${P}-fix-test-requirements.patch"
)
distutils_enable_tests pytest
@@ -1,11 +1,11 @@
# Copyright 1999-2023 Gentoo Authors
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYPI_NO_NORMALIZE=1
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_COMPAT=( python3_{10..13} )
inherit distutils-r1 pypi
@@ -4,7 +4,7 @@
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{10..12} pypy3 )
PYTHON_COMPAT=( python3_{10..13} pypy3 )
inherit distutils-r1 pypi
@@ -4,7 +4,7 @@
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_COMPAT=( python3_{10..13} )
inherit distutils-r1
@@ -5,7 +5,7 @@ EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYPI_NO_NORMALIZE=1
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_COMPAT=( python3_{10..13} )
inherit distutils-r1 pypi
@@ -4,7 +4,7 @@
EAPI=8
DISTUTILS_USE_PEP517="setuptools"
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_COMPAT=( python3_{10..13} )
inherit distutils-r1