From a8bc5f7904e136e5c8f8968dc873c50d9dbd689b Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 21 Jun 2024 23:00:13 -0700 Subject: [PATCH] ruff automatic fixes: `from __future__ import annotations` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ruff.....................................................................Failed - hook id: ruff - files were modified by this hook Fixed 44 errors: - tests/test_class_sh_basic.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_disowning.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_disowning_mi.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_factory_constructors.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_inheritance.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_mi_thunks.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_module_local.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_property.py: 1 × I002 (missing-required-import) - tests/test_class_sh_property_non_owning.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_shared_ptr_copy_move.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_trampoline_basic.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_trampoline_self_life_support.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_trampoline_shared_from_this.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_trampoline_unique_ptr.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_unique_ptr_custom_deleter.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_unique_ptr_member.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_class_sh_virtual_py_cpp_mix.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_classh_mock.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_descr_src_loc.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_exc_namespace_visibility.py: 1 × I002 (missing-required-import) - tests/test_type_caster_odr_guard_1.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) - tests/test_type_caster_odr_guard_2.py: 1 × I001 (unsorted-imports) 1 × I002 (missing-required-import) Found 44 errors (44 fixed, 0 remaining). ``` --- tests/test_class_sh_basic.py | 2 ++ tests/test_class_sh_disowning.py | 2 ++ tests/test_class_sh_disowning_mi.py | 2 ++ tests/test_class_sh_factory_constructors.py | 2 ++ tests/test_class_sh_inheritance.py | 2 ++ tests/test_class_sh_mi_thunks.py | 2 ++ tests/test_class_sh_module_local.py | 2 ++ tests/test_class_sh_property.py | 1 + tests/test_class_sh_property_non_owning.py | 2 ++ tests/test_class_sh_shared_ptr_copy_move.py | 2 ++ tests/test_class_sh_trampoline_basic.py | 2 ++ tests/test_class_sh_trampoline_self_life_support.py | 2 ++ tests/test_class_sh_trampoline_shared_from_this.py | 2 ++ tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py | 2 ++ tests/test_class_sh_trampoline_unique_ptr.py | 2 ++ tests/test_class_sh_unique_ptr_custom_deleter.py | 2 ++ tests/test_class_sh_unique_ptr_member.py | 2 ++ tests/test_class_sh_virtual_py_cpp_mix.py | 2 ++ tests/test_classh_mock.py | 2 ++ tests/test_descr_src_loc.py | 2 ++ tests/test_exc_namespace_visibility.py | 1 + tests/test_type_caster_odr_guard_1.py | 2 ++ tests/test_type_caster_odr_guard_2.py | 2 ++ 23 files changed, 44 insertions(+) diff --git a/tests/test_class_sh_basic.py b/tests/test_class_sh_basic.py index c7ff82c818..b82e53fc4d 100644 --- a/tests/test_class_sh_basic.py +++ b/tests/test_class_sh_basic.py @@ -1,4 +1,6 @@ # Importing re before pytest after observing a PyPy CI flake when importing pytest first. +from __future__ import annotations + import re import pytest diff --git a/tests/test_class_sh_disowning.py b/tests/test_class_sh_disowning.py index f4d2471815..63cdd4edb6 100644 --- a/tests/test_class_sh_disowning.py +++ b/tests/test_class_sh_disowning.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest from pybind11_tests import class_sh_disowning as m diff --git a/tests/test_class_sh_disowning_mi.py b/tests/test_class_sh_disowning_mi.py index 6fbc1f8e39..4a4beecce1 100644 --- a/tests/test_class_sh_disowning_mi.py +++ b/tests/test_class_sh_disowning_mi.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest import env # noqa: F401 diff --git a/tests/test_class_sh_factory_constructors.py b/tests/test_class_sh_factory_constructors.py index 9ebff96ed0..5d45db6fd5 100644 --- a/tests/test_class_sh_factory_constructors.py +++ b/tests/test_class_sh_factory_constructors.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest from pybind11_tests import class_sh_factory_constructors as m diff --git a/tests/test_class_sh_inheritance.py b/tests/test_class_sh_inheritance.py index eaf53a5c6f..cd9d6f47e2 100644 --- a/tests/test_class_sh_inheritance.py +++ b/tests/test_class_sh_inheritance.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from pybind11_tests import class_sh_inheritance as m diff --git a/tests/test_class_sh_mi_thunks.py b/tests/test_class_sh_mi_thunks.py index de2a9196b2..c1c8a30431 100644 --- a/tests/test_class_sh_mi_thunks.py +++ b/tests/test_class_sh_mi_thunks.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest from pybind11_tests import class_sh_mi_thunks as m diff --git a/tests/test_class_sh_module_local.py b/tests/test_class_sh_module_local.py index a88e3fc1c9..e504152a16 100644 --- a/tests/test_class_sh_module_local.py +++ b/tests/test_class_sh_module_local.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import class_sh_module_local_0 as m0 import class_sh_module_local_1 as m1 import class_sh_module_local_2 as m2 diff --git a/tests/test_class_sh_property.py b/tests/test_class_sh_property.py index 9dc2a19771..9aeef44e03 100644 --- a/tests/test_class_sh_property.py +++ b/tests/test_class_sh_property.py @@ -1,5 +1,6 @@ # The compact 4-character naming scheme (e.g. mptr, cptr, shcp) is explained at the top of # test_class_sh_property.cpp. +from __future__ import annotations import pytest diff --git a/tests/test_class_sh_property_non_owning.py b/tests/test_class_sh_property_non_owning.py index 8b6f5f4bd3..33a9d4503b 100644 --- a/tests/test_class_sh_property_non_owning.py +++ b/tests/test_class_sh_property_non_owning.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest from pybind11_tests import class_sh_property_non_owning as m diff --git a/tests/test_class_sh_shared_ptr_copy_move.py b/tests/test_class_sh_shared_ptr_copy_move.py index bc7198f2e4..067bb47d2a 100644 --- a/tests/test_class_sh_shared_ptr_copy_move.py +++ b/tests/test_class_sh_shared_ptr_copy_move.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from pybind11_tests import class_sh_shared_ptr_copy_move as m diff --git a/tests/test_class_sh_trampoline_basic.py b/tests/test_class_sh_trampoline_basic.py index dfd7ac10e8..eab82121fb 100644 --- a/tests/test_class_sh_trampoline_basic.py +++ b/tests/test_class_sh_trampoline_basic.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest from pybind11_tests import class_sh_trampoline_basic as m diff --git a/tests/test_class_sh_trampoline_self_life_support.py b/tests/test_class_sh_trampoline_self_life_support.py index 3bd12bc4f9..d4af2ab99a 100644 --- a/tests/test_class_sh_trampoline_self_life_support.py +++ b/tests/test_class_sh_trampoline_self_life_support.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest import pybind11_tests.class_sh_trampoline_self_life_support as m diff --git a/tests/test_class_sh_trampoline_shared_from_this.py b/tests/test_class_sh_trampoline_shared_from_this.py index eeb7bb8ac5..85fe7858f5 100644 --- a/tests/test_class_sh_trampoline_shared_from_this.py +++ b/tests/test_class_sh_trampoline_shared_from_this.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import sys import weakref diff --git a/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py b/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py index b9cde4f2cb..431edb7191 100644 --- a/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py +++ b/tests/test_class_sh_trampoline_shared_ptr_cpp_arg.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest import pybind11_tests.class_sh_trampoline_shared_ptr_cpp_arg as m diff --git a/tests/test_class_sh_trampoline_unique_ptr.py b/tests/test_class_sh_trampoline_unique_ptr.py index c598079e42..7799df6d61 100644 --- a/tests/test_class_sh_trampoline_unique_ptr.py +++ b/tests/test_class_sh_trampoline_unique_ptr.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pybind11_tests.class_sh_trampoline_unique_ptr as m diff --git a/tests/test_class_sh_unique_ptr_custom_deleter.py b/tests/test_class_sh_unique_ptr_custom_deleter.py index d9cf1d4508..34aa520682 100644 --- a/tests/test_class_sh_unique_ptr_custom_deleter.py +++ b/tests/test_class_sh_unique_ptr_custom_deleter.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from pybind11_tests import class_sh_unique_ptr_custom_deleter as m diff --git a/tests/test_class_sh_unique_ptr_member.py b/tests/test_class_sh_unique_ptr_member.py index 1a50a57b7b..a5d2ccd234 100644 --- a/tests/test_class_sh_unique_ptr_member.py +++ b/tests/test_class_sh_unique_ptr_member.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest from pybind11_tests import class_sh_unique_ptr_member as m diff --git a/tests/test_class_sh_virtual_py_cpp_mix.py b/tests/test_class_sh_virtual_py_cpp_mix.py index 552162d8ed..33133eb889 100644 --- a/tests/test_class_sh_virtual_py_cpp_mix.py +++ b/tests/test_class_sh_virtual_py_cpp_mix.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest from pybind11_tests import class_sh_virtual_py_cpp_mix as m diff --git a/tests/test_classh_mock.py b/tests/test_classh_mock.py index 7d0ffbe8b2..b05cd0c57c 100644 --- a/tests/test_classh_mock.py +++ b/tests/test_classh_mock.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from pybind11_tests import classh_mock as m diff --git a/tests/test_descr_src_loc.py b/tests/test_descr_src_loc.py index b13c4ad53f..cf16f7141c 100644 --- a/tests/test_descr_src_loc.py +++ b/tests/test_descr_src_loc.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest from pybind11_tests import descr_src_loc as m diff --git a/tests/test_exc_namespace_visibility.py b/tests/test_exc_namespace_visibility.py index 0f1cab9d5b..e94271a58c 100644 --- a/tests/test_exc_namespace_visibility.py +++ b/tests/test_exc_namespace_visibility.py @@ -10,6 +10,7 @@ # test_cross_module_exception_translator (test_exceptions.py) failure. This # test has to be imported (by pytest) before test_exceptions.py; pytest sorts # lexically. See https://github.com/pybind/pybind11/pull/4054 for more information. +from __future__ import annotations import itertools diff --git a/tests/test_type_caster_odr_guard_1.py b/tests/test_type_caster_odr_guard_1.py index 8b62490433..88a89bd0b6 100644 --- a/tests/test_type_caster_odr_guard_1.py +++ b/tests/test_type_caster_odr_guard_1.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest import pybind11_tests diff --git a/tests/test_type_caster_odr_guard_2.py b/tests/test_type_caster_odr_guard_2.py index b4f5ef6c41..29aeb832ec 100644 --- a/tests/test_type_caster_odr_guard_2.py +++ b/tests/test_type_caster_odr_guard_2.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import pytest import pybind11_tests.type_caster_odr_guard_2 as m