diff options
1415 files changed, 3100 insertions, 932 deletions
diff --git a/build_scripts/__init__.py b/build_scripts/__init__.py index 128bb2394..bcad88b14 100644 --- a/build_scripts/__init__.py +++ b/build_scripts/__init__.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations PYSIDE = 'pyside6' PYSIDE_MODULE = 'PySide6' diff --git a/build_scripts/build_info_collector.py b/build_scripts/build_info_collector.py index 30ce187c8..62ec77dde 100644 --- a/build_scripts/build_info_collector.py +++ b/build_scripts/build_info_collector.py @@ -1,5 +1,6 @@ # Copyright (C) 2021 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import platform diff --git a/build_scripts/config.py b/build_scripts/config.py index 0a6eebf78..5f58fd923 100644 --- a/build_scripts/config.py +++ b/build_scripts/config.py @@ -1,5 +1,6 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys from .log import log, LogLevel @@ -65,6 +66,7 @@ class Config(object): 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', ] self.setup_script_dir = None @@ -203,9 +205,9 @@ class Config(object): _pyside_tools = available_pyside_tools(qt_tools_path=qt_install_path) # replacing pyside6-android_deploy by pyside6-android-deploy for consistency - # Also, the tool should not exist in any other platform than Linux + # Also, the tool should not exist in any other platform than Linux and macOS _console_scripts = [] - if ("android_deploy" in _pyside_tools) and sys.platform.startswith("linux"): + if ("android_deploy" in _pyside_tools) and sys.platform in ["linux", "darwin"]: _console_scripts = [(f"{PYSIDE}-android-deploy =" " PySide6.scripts.pyside_tool:android_deploy")] _pyside_tools.remove("android_deploy") diff --git a/build_scripts/log.py b/build_scripts/log.py index c9ccf3fb9..dfff76a06 100644 --- a/build_scripts/log.py +++ b/build_scripts/log.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import logging diff --git a/build_scripts/main.py b/build_scripts/main.py index 9a8d4fb3f..a7e31e02e 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import importlib import os @@ -508,7 +509,11 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): log.info("-" * 3) if sys.platform == 'win32': log.info(f"OpenSSL dll directory: {OPTION['OPENSSL']}") - if sys.platform == 'darwin': + # for cross-compilation it is possible to use a macOS host, but + # pyside_macos_deployment_target is not relevant for the target. + # The only exception here is when we are trying to cross-compile from intel mac to m1 mac. + # This case is not supported yet. + if sys.platform == 'darwin' and not self.is_cross_compile: pyside_macos_deployment_target = (macos_pyside_min_deployment_target()) log.info(f"MACOSX_DEPLOYMENT_TARGET set to: {pyside_macos_deployment_target}") log.info("=" * 30) @@ -745,7 +750,9 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): cmake_cmd += platform_cmake_options() - if sys.platform == 'darwin': + # for a macOS host, cross-compilation is possible, but for the host system as such + # we only build shiboken. Hence the following code can be skipped. + if sys.platform == 'darwin' and not self.is_cross_compile: if OPTION["MACOS_ARCH"]: # also tell cmake which architecture to use cmake_cmd.append(f"-DCMAKE_OSX_ARCHITECTURES:STRING={OPTION['MACOS_ARCH']}") diff --git a/build_scripts/options.py b/build_scripts/options.py index 806d4a8a3..5465d5026 100644 --- a/build_scripts/options.py +++ b/build_scripts/options.py @@ -1,5 +1,6 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from setuptools import Command diff --git a/build_scripts/platforms/__init__.py b/build_scripts/platforms/__init__.py index 853aaad7b..498a6e52b 100644 --- a/build_scripts/platforms/__init__.py +++ b/build_scripts/platforms/__init__.py @@ -1,2 +1,3 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations diff --git a/build_scripts/platforms/linux.py b/build_scripts/platforms/linux.py index b4c66d94e..32ad9daca 100644 --- a/build_scripts/platforms/linux.py +++ b/build_scripts/platforms/linux.py @@ -1,5 +1,6 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from pathlib import Path diff --git a/build_scripts/platforms/macos.py b/build_scripts/platforms/macos.py index dbe60d343..31d552786 100644 --- a/build_scripts/platforms/macos.py +++ b/build_scripts/platforms/macos.py @@ -1,5 +1,6 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import fnmatch from pathlib import Path @@ -21,7 +22,7 @@ def _macos_patch_executable(name, _vars=None): macos_add_rpath(rpath, binary) -def prepare_standalone_package_macos(pyside_build, _vars): +def prepare_standalone_package_macos(pyside_build, _vars, is_android=False): built_modules = _vars['built_modules'] constrain_modules = None @@ -119,7 +120,11 @@ def prepare_standalone_package_macos(pyside_build, _vars): ignored_modules = [] if not pyside_build.is_webengine_built(built_modules): ignored_modules.extend(['libQt6WebEngine*.dylib']) + accepted_modules = ['libQt6*.6.dylib'] + if is_android: + accepted_modules = ['libQt6*.so', '*-android-dependencies.xml'] + if constrain_modules: accepted_modules = [f"libQt6{module}*.6.dylib" for module in constrain_modules] @@ -156,6 +161,8 @@ def prepare_standalone_package_macos(pyside_build, _vars): # <qt>/plugins/* -> <setup>/{st_package_name}/Qt/plugins plugins_target = destination_qt_dir / "plugins" filters = ["*.dylib"] + if is_android: + filters = ["*.so"] copydir("{qt_plugins_dir}", plugins_target, _filter=filters, recursive=True, diff --git a/build_scripts/platforms/unix.py b/build_scripts/platforms/unix.py index 3333f5f96..5604636c2 100644 --- a/build_scripts/platforms/unix.py +++ b/build_scripts/platforms/unix.py @@ -1,5 +1,6 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys from pathlib import Path @@ -124,7 +125,7 @@ def prepare_packages_posix(pyside_build, _vars, cross_build=False): script_dirs = ["qtpy2cpp_lib", "deploy_lib", "project"] - if sys.platform.startswith("linux"): + if sys.platform in ["linux", "darwin"]: scripts.append("android_deploy.py") scripts.append("requirements-android.txt") script_dirs.extend(["deploy_lib/android", @@ -237,7 +238,7 @@ def prepare_packages_posix(pyside_build, _vars, cross_build=False): if config.is_internal_pyside_build() or config.is_internal_shiboken_generator_build(): _vars['built_modules'] = generated_config['built_modules'] if sys.platform == 'darwin': - prepare_standalone_package_macos(pyside_build, _vars) + prepare_standalone_package_macos(pyside_build, _vars, is_android=is_android) else: prepare_standalone_package_linux(pyside_build, _vars, cross_build, is_android=is_android) diff --git a/build_scripts/platforms/windows_desktop.py b/build_scripts/platforms/windows_desktop.py index 9c29953be..8dbfd6698 100644 --- a/build_scripts/platforms/windows_desktop.py +++ b/build_scripts/platforms/windows_desktop.py @@ -1,5 +1,6 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import functools import os diff --git a/build_scripts/qfp_tool.py b/build_scripts/qfp_tool.py index abaf48fc8..153712d89 100644 --- a/build_scripts/qfp_tool.py +++ b/build_scripts/qfp_tool.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import datetime import os @@ -11,7 +12,6 @@ import warnings from argparse import ArgumentParser, RawTextHelpFormatter from enum import Enum, auto from pathlib import Path -from typing import List DESC = """ Utility script for working with Qt for Python. @@ -101,14 +101,14 @@ def which(needle: str): return None -def command_log_string(args: List[str], directory: Path): +def command_log_string(args: list[str], directory: Path): result = f'[{directory.name}]' for arg in args: result += f' "{arg}"' if ' ' in arg else f' {arg}' return result -def execute(args: List[str]): +def execute(args: list[str]): """Execute a command and print to log""" log_string = command_log_string(args, Path.cwd()) print(log_string) diff --git a/build_scripts/qtinfo.py b/build_scripts/qtinfo.py index 1eb7c4909..f78f1f9ff 100644 --- a/build_scripts/qtinfo.py +++ b/build_scripts/qtinfo.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import subprocess diff --git a/build_scripts/setup_runner.py b/build_scripts/setup_runner.py index 5d0466247..e8b97afcb 100644 --- a/build_scripts/setup_runner.py +++ b/build_scripts/setup_runner.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import sys diff --git a/build_scripts/utils.py b/build_scripts/utils.py index 74d9e6fc5..0aeee256f 100644 --- a/build_scripts/utils.py +++ b/build_scripts/utils.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import errno import fnmatch diff --git a/build_scripts/wheel_files.py b/build_scripts/wheel_files.py index d34ada113..ef5f2b74a 100644 --- a/build_scripts/wheel_files.py +++ b/build_scripts/wheel_files.py @@ -1,11 +1,11 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import json import sys from dataclasses import Field, dataclass, field -from typing import Dict, List _pyside_package_path = None @@ -49,23 +49,23 @@ class ModuleData: name: str ext: str = "" # Libraries not related to Qt modules - lib: List[str] = field(default_factory=list) + lib: list[str] = field(default_factory=list) # Libraries related to Qt modules - qtlib: List[str] = field(default_factory=list) + qtlib: list[str] = field(default_factory=list) # Files from the Qt/qml directory - qml: List[str] = field(default_factory=list) - pyi: List[str] = field(default_factory=list) - translations: List[str] = field(default_factory=list) - typesystems: List[str] = field(default_factory=list) - include: List[str] = field(default_factory=list) - glue: List[str] = field(default_factory=list) - metatypes: List[str] = field(default_factory=list) - plugins: List[str] = field(default_factory=list) + qml: list[str] = field(default_factory=list) + pyi: list[str] = field(default_factory=list) + translations: list[str] = field(default_factory=list) + typesystems: list[str] = field(default_factory=list) + include: list[str] = field(default_factory=list) + glue: list[str] = field(default_factory=list) + metatypes: list[str] = field(default_factory=list) + plugins: list[str] = field(default_factory=list) # For special cases when a file/directory doesn't fall into # the previous categories. - extra_dirs: List[str] = field(default_factory=list) - extra_files: List[str] = field(default_factory=list) + extra_dirs: list[str] = field(default_factory=list) + extra_files: list[str] = field(default_factory=list) # Once the object is created, this method will be executed # and automatically will initialize some of the files that are @@ -130,7 +130,7 @@ class ModuleData: return f"{s}.*{self.ext}*" @classmethod - def get_fields(cls) -> Dict[str, Field]: + def get_fields(cls) -> dict[str, Field]: return cls.__dataclass_fields__ @staticmethod @@ -150,7 +150,7 @@ class ModuleData: # for each module that will be included in the wheel. # PySide wheel -def wheel_files_pyside_essentials() -> List[ModuleData]: +def wheel_files_pyside_essentials() -> list[ModuleData]: files = [ module_QtCore(), module_QtGui(), @@ -186,7 +186,7 @@ def wheel_files_pyside_essentials() -> List[ModuleData]: # PySide Addons wheel -def wheel_files_pyside_addons() -> List[ModuleData]: +def wheel_files_pyside_addons() -> list[ModuleData]: files = [ module_Qt3DAnimation(), module_Qt3DCore(), @@ -997,6 +997,8 @@ def module_QtSerialBus() -> ModuleData: def module_QtVirtualKeyboard() -> ModuleData: data = ModuleData("VirtualKeyboard") data.plugins.append("virtualkeyboard") + data.qtlib.append("libQt6VirtualKeyboardSettings") + return data diff --git a/build_scripts/wheel_override.py b/build_scripts/wheel_override.py index f3f9f17a9..b389bb87d 100644 --- a/build_scripts/wheel_override.py +++ b/build_scripts/wheel_override.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import platform @@ -47,7 +48,7 @@ class PysideBuildWheel(_bdist_wheel, CommandMixin): def finalize_options(self): CommandMixin.mixin_finalize_options(self) - if sys.platform == 'darwin': + if sys.platform == 'darwin' and not self.is_cross_compile: # Override the platform name to contain the correct # minimum deployment target. # This is used in the final wheel name. diff --git a/build_scripts/wheel_utils.py b/build_scripts/wheel_utils.py index 5ec26c742..aa4ef02cd 100644 --- a/build_scripts/wheel_utils.py +++ b/build_scripts/wheel_utils.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import time from pathlib import Path diff --git a/coin/instructions/common_environment.yaml b/coin/instructions/common_environment.yaml index 441a01803..16aac3527 100644 --- a/coin/instructions/common_environment.yaml +++ b/coin/instructions/common_environment.yaml @@ -140,8 +140,8 @@ instructions: variableValue: "/Users/qt/.local/bin/:" enable_if: condition: property - property: host.osVersion - equals_value: MacOS_11_00 + property: host.os + equals_value: MacOS - type: PrependToEnvironmentVariable variableName: PATH variableValue: "/Users/qt/work/install/bin:" diff --git a/coin/instructions/execute_test_instructions.yaml b/coin/instructions/execute_test_instructions.yaml index 780b27ec7..60c051d32 100644 --- a/coin/instructions/execute_test_instructions.yaml +++ b/coin/instructions/execute_test_instructions.yaml @@ -22,8 +22,8 @@ instructions: condition: and conditions: - condition: property - property: host.osVersion - equals_value: MacOS_11_00 + property: host.os + equals_value: MacOS - condition: property property: host.arch equals_value: ARM64 diff --git a/coin/module_config.yaml b/coin/module_config.yaml index f97971ca9..52e89a033 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -25,6 +25,9 @@ accept_configuration: - condition: property # Windows on Arm property: target.arch not_equals_value: ARM64 + - condition: property # Windows on Arm host build + property: target.arch + not_equals_value: AARCH64 - condition: property property: features not_contains_value: DebianPackaging @@ -48,21 +51,25 @@ accept_configuration: - condition: property property: target.os not_contains_value: IOS - - condition: and + - condition: property + property: host.osVersion + not_equals_value: MacOS_12 + - condition: and # Restore LoA config conditions: - condition: property property: host.osVersion - equals_value: MacOS_11_00 + equals_value: Debian_11_6 - condition: property property: host.arch - equals_value: ARM64 + equals_value: AARCH64 - condition: property property: features - contains_value: TestOnly + not_contains_value: DebianPackaging - condition: property property: features contains_value: Packaging + machine_type: Build: cores: 8 diff --git a/coin_build_instructions.py b/coin_build_instructions.py index 83d46977e..30c3836fb 100644 --- a/coin_build_instructions.py +++ b/coin_build_instructions.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import calendar import datetime import logging diff --git a/coin_test_instructions.py b/coin_test_instructions.py index b0e71fba7..afac50c38 100644 --- a/coin_test_instructions.py +++ b/coin_test_instructions.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import logging import site diff --git a/create_wheels.py b/create_wheels.py index 063b59c45..e7fbc52cf 100644 --- a/create_wheels.py +++ b/create_wheels.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import platform @@ -10,7 +11,6 @@ from argparse import ArgumentParser, Namespace from dataclasses import dataclass from pathlib import Path from shutil import copy, rmtree, copytree -from typing import List, Optional, Tuple import build # type: ignore import pyproject_hooks @@ -32,7 +32,7 @@ class SetupData: version: str description: str readme: str - console_scripts: List[str] + console_scripts: list[str] def get_version_from_package(name: str, package_path: Path) -> str: @@ -46,7 +46,7 @@ def get_version_from_package(name: str, package_path: Path) -> str: return version, f"{name}.__init__.__version__" -def create_module_plugin_json(wheel_name: str, data: List[ModuleData], package_path: Path): +def create_module_plugin_json(wheel_name: str, data: list[ModuleData], package_path: Path): all_plugins = {} for module in data: @@ -60,7 +60,7 @@ def create_module_plugin_json(wheel_name: str, data: List[ModuleData], package_p json.dump(all_plugins, fp, indent=4) -def get_manifest(wheel_name: str, data: List[ModuleData], package_path: Path) -> str: +def get_manifest(wheel_name: str, data: list[ModuleData], package_path: Path) -> str: lines = [] for module in data: @@ -221,7 +221,7 @@ def generate_setup_py(artifacts: Path, setup: SetupData): return content -def wheel_shiboken_generator(package_path: Path) -> Tuple[SetupData, None]: +def wheel_shiboken_generator(package_path: Path) -> tuple[SetupData, None]: setup = SetupData( name="shiboken6_generator", version=get_version_from_package("shiboken6_generator", package_path), @@ -236,7 +236,7 @@ def wheel_shiboken_generator(package_path: Path) -> Tuple[SetupData, None]: return setup, None -def wheel_shiboken_module(package_path: Path) -> Tuple[SetupData, None]: +def wheel_shiboken_module(package_path: Path) -> tuple[SetupData, None]: setup = SetupData( name="shiboken6", version=get_version_from_package("shiboken6", package_path), @@ -248,15 +248,15 @@ def wheel_shiboken_module(package_path: Path) -> Tuple[SetupData, None]: return setup, None -def wheel_pyside6_essentials(package_path: Path) -> Tuple[SetupData, List[ModuleData]]: +def wheel_pyside6_essentials(package_path: Path) -> tuple[SetupData, list[ModuleData]]: packaged_qt_tools_path = package_path / "PySide6" set_pyside_package_path(packaged_qt_tools_path) _pyside_tools = available_pyside_tools(packaged_qt_tools_path, package_for_wheels=True) # replacing pyside6-android_deploy by pyside6-android-deploy for consistency - # Also, the tool should not exist in any other platform than Linux + # Also, the tool should not exist in any other platform than Linux and macOS _console_scripts = [] - if ("android_deploy" in _pyside_tools) and sys.platform.startswith("linux"): + if ("android_deploy" in _pyside_tools) and sys.platform in ("linux", "darwin"): _console_scripts = ['pyside6-android-deploy = "PySide6.scripts.pyside_tool:android_deploy"'] _pyside_tools.remove("android_deploy") @@ -276,7 +276,7 @@ def wheel_pyside6_essentials(package_path: Path) -> Tuple[SetupData, List[Module return setup, data -def wheel_pyside6_addons(package_path: Path) -> Tuple[SetupData, List[ModuleData]]: +def wheel_pyside6_addons(package_path: Path) -> tuple[SetupData, list[ModuleData]]: setup = SetupData( name="PySide6_Addons", version=get_version_from_package("PySide6", package_path), # we use 'PySide6' here @@ -290,7 +290,7 @@ def wheel_pyside6_addons(package_path: Path) -> Tuple[SetupData, List[ModuleData return setup, data -def wheel_pyside6(package_path: Path) -> Tuple[SetupData, Optional[List[ModuleData]]]: +def wheel_pyside6(package_path: Path) -> tuple[SetupData, list[ModuleData] | None]: setup = SetupData( name="PySide6", version=get_version_from_package("PySide6", package_path), @@ -302,7 +302,7 @@ def wheel_pyside6(package_path: Path) -> Tuple[SetupData, Optional[List[ModuleDa return setup, None -def wheel_pyside6_examples(package_path: Path) -> Tuple[SetupData, Optional[List[ModuleData]]]: +def wheel_pyside6_examples(package_path: Path) -> tuple[SetupData, list[ModuleData] | None]: setup = SetupData( name="PySide6_Examples", version=get_version_from_package("PySide6", package_path), @@ -481,7 +481,7 @@ if __name__ == "__main__": print("-- Copy configuration files to create the wheel") if name == "PySide6_Examples": copy_examples_for_wheel(package_path) - _files: List[Path] = base_files + [Path(setup.readme)] + _files: list[Path] = base_files + [Path(setup.readme)] for fname in _files: copy(fname, package_path) diff --git a/doc/changelogs/changes-6.7.2 b/doc/changelogs/changes-6.7.2 new file mode 100644 index 000000000..44015f2c5 --- /dev/null +++ b/doc/changelogs/changes-6.7.2 @@ -0,0 +1,50 @@ +Qt for Python 6.7.2 is a bug-fix release. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qtforpython/ + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* PySide6 * +**************************************************************************** + + - [PYSIDE-1612] Android Deployment now used the development branch of p4a. + - [PYSIDE-2712] Type hints: Modified types are no longer considered + as eligible implicit conversions. + - [PYSIDE-2745] Exceptions occurring in a slot connected to a + 0-delay singleShot timer signal are no longer suppressed. + - [PYSIDE-2747] Running on Fedora 40 with Python 3.12.3-2 has been fixed. + - [PYSIDE-2748] Type hints: QTranslator.translate() has been fixed. + - [PYSIDE-2749] Lazy Load: A performance regression showing in Qt event + filters has been fixed. + - [PYSIDE-2750] Qt6VirtualKeyboardSettings have been added to the wheel. + - [PYSIDE-2756] Type hints: The return type of QItemSelection.__init__() + has been fixed. + - [PYSIDE-2758] QQuickWebEngineProfile.setUrlRequestInterceptor() + has been added. + - [PYSIDE-2759] The ownership of cache object passed to + QNetworkAccessManager.setCache() has been fixed. + - [PYSIDE-2762] Type hints: The return type of + QModelIndex.internalPointer() has been fixed. + - [PYSIDE-2767] Type hints: An error checking the property decorator + has been fixed. + - [PYSIDE-2768] Type hints: smart pointer signatures have been fixed. + +**************************************************************************** +* Shiboken6 * +**************************************************************************** + + - [PYSIDE-2764] The missing declaration of the deprecated variable + cppApiVariableNameOld has been added to the generated + headers. + - [PYSIDE-2769] Finding the clang include directories on + manylinux_2_28_x86_64 has been fixed. diff --git a/examples/3d/simple3d/simple3d.py b/examples/3d/simple3d/simple3d.py index eef0dca5d..23ceae854 100644 --- a/examples/3d/simple3d/simple3d.py +++ b/examples/3d/simple3d/simple3d.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qt3d/simple-cpp example from Qt v5.x""" diff --git a/examples/async/eratosthenes/eratosthenes_asyncio.py b/examples/async/eratosthenes/eratosthenes_asyncio.py index c5d7fc2fe..54378daae 100644 --- a/examples/async/eratosthenes/eratosthenes_asyncio.py +++ b/examples/async/eratosthenes/eratosthenes_asyncio.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import (Qt, QObject, Signal, Slot) from PySide6.QtGui import (QColor, QFont, QPalette) diff --git a/examples/async/eratosthenes/eratosthenes_trio.py b/examples/async/eratosthenes/eratosthenes_trio.py index 89d3d1ce6..9530077e8 100644 --- a/examples/async/eratosthenes/eratosthenes_trio.py +++ b/examples/async/eratosthenes/eratosthenes_trio.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import (Qt, QEvent, QObject, QTimer, Signal, Slot) from PySide6.QtGui import (QColor, QFont, QPalette) diff --git a/examples/async/minimal/minimal_asyncio.py b/examples/async/minimal/minimal_asyncio.py index a6c4708b3..7ffd5030f 100644 --- a/examples/async/minimal/minimal_asyncio.py +++ b/examples/async/minimal/minimal_asyncio.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt from PySide6.QtWidgets import (QApplication, QLabel, QMainWindow, QPushButton, QVBoxLayout, QWidget) diff --git a/examples/async/minimal/minimal_trio.py b/examples/async/minimal/minimal_trio.py index 5ae19fa36..5d331c109 100644 --- a/examples/async/minimal/minimal_trio.py +++ b/examples/async/minimal/minimal_trio.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import (Qt, QEvent, QObject, Signal, Slot) from PySide6.QtWidgets import (QApplication, QLabel, QMainWindow, QPushButton, QVBoxLayout, QWidget) diff --git a/examples/axcontainer/axviewer/axviewer.py b/examples/axcontainer/axviewer/axviewer.py index bcd4c2714..a591b1689 100644 --- a/examples/axcontainer/axviewer/axviewer.py +++ b/examples/axcontainer/axviewer/axviewer.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 Active Qt Viewer example""" diff --git a/examples/bluetooth/btscanner/device.py b/examples/bluetooth/btscanner/device.py index c75f5b8a1..f5a361fa9 100644 --- a/examples/bluetooth/btscanner/device.py +++ b/examples/bluetooth/btscanner/device.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QPoint, Qt, Slot from PySide6.QtGui import QColor diff --git a/examples/bluetooth/btscanner/main.py b/examples/bluetooth/btscanner/main.py index a54a862a2..cab83de28 100644 --- a/examples/bluetooth/btscanner/main.py +++ b/examples/bluetooth/btscanner/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the bluetooth/btscanner example from Qt v6.x""" diff --git a/examples/bluetooth/btscanner/service.py b/examples/bluetooth/btscanner/service.py index 31df8a9ea..928c8cde2 100644 --- a/examples/bluetooth/btscanner/service.py +++ b/examples/bluetooth/btscanner/service.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtWidgets import QDialog diff --git a/examples/bluetooth/heartrate_game/bluetoothbaseclass.py b/examples/bluetooth/heartrate_game/bluetoothbaseclass.py index cc5c9dbd0..6278b0418 100644 --- a/examples/bluetooth/heartrate_game/bluetoothbaseclass.py +++ b/examples/bluetooth/heartrate_game/bluetoothbaseclass.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal, Slot diff --git a/examples/bluetooth/heartrate_game/connectionhandler.py b/examples/bluetooth/heartrate_game/connectionhandler.py index 7bf60bbc5..17b1500d9 100644 --- a/examples/bluetooth/heartrate_game/connectionhandler.py +++ b/examples/bluetooth/heartrate_game/connectionhandler.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/bluetooth/heartrate_game/devicefinder.py b/examples/bluetooth/heartrate_game/devicefinder.py index e581d12ec..5c00e7c94 100644 --- a/examples/bluetooth/heartrate_game/devicefinder.py +++ b/examples/bluetooth/heartrate_game/devicefinder.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtBluetooth import (QBluetoothDeviceDiscoveryAgent, diff --git a/examples/bluetooth/heartrate_game/devicehandler.py b/examples/bluetooth/heartrate_game/devicehandler.py index df34052b8..67dae024f 100644 --- a/examples/bluetooth/heartrate_game/devicehandler.py +++ b/examples/bluetooth/heartrate_game/devicehandler.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import struct diff --git a/examples/bluetooth/heartrate_game/deviceinfo.py b/examples/bluetooth/heartrate_game/deviceinfo.py index 5fd5c3270..136bbbacb 100644 --- a/examples/bluetooth/heartrate_game/deviceinfo.py +++ b/examples/bluetooth/heartrate_game/deviceinfo.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/bluetooth/heartrate_game/heartrate_global.py b/examples/bluetooth/heartrate_game/heartrate_global.py index de5c37ac3..384eb93a7 100644 --- a/examples/bluetooth/heartrate_game/heartrate_global.py +++ b/examples/bluetooth/heartrate_game/heartrate_global.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os import sys diff --git a/examples/bluetooth/heartrate_game/main.py b/examples/bluetooth/heartrate_game/main.py index 3cb4f0672..076085f0c 100644 --- a/examples/bluetooth/heartrate_game/main.py +++ b/examples/bluetooth/heartrate_game/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the bluetooth/heartrate-game example from Qt v6.x""" diff --git a/examples/bluetooth/heartrate_server/heartrate_server.py b/examples/bluetooth/heartrate_server/heartrate_server.py index abbf4eb7f..59b5af7b2 100644 --- a/examples/bluetooth/heartrate_server/heartrate_server.py +++ b/examples/bluetooth/heartrate_server/heartrate_server.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the bluetooth/heartrate-server example from Qt v6.x""" diff --git a/examples/bluetooth/lowenergyscanner/characteristicinfo.py b/examples/bluetooth/lowenergyscanner/characteristicinfo.py index 42bde8753..18f4c4202 100644 --- a/examples/bluetooth/lowenergyscanner/characteristicinfo.py +++ b/examples/bluetooth/lowenergyscanner/characteristicinfo.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtBluetooth import QLowEnergyCharacteristic, QBluetoothUuid diff --git a/examples/bluetooth/lowenergyscanner/device.py b/examples/bluetooth/lowenergyscanner/device.py index 09108cf69..afa30ff80 100644 --- a/examples/bluetooth/lowenergyscanner/device.py +++ b/examples/bluetooth/lowenergyscanner/device.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import warnings from PySide6.QtBluetooth import (QBluetoothDeviceDiscoveryAgent, QLowEnergyController, QBluetoothDeviceInfo, QBluetoothUuid, QLowEnergyService) diff --git a/examples/bluetooth/lowenergyscanner/deviceinfo.py b/examples/bluetooth/lowenergyscanner/deviceinfo.py index 35a568821..0952f8d74 100644 --- a/examples/bluetooth/lowenergyscanner/deviceinfo.py +++ b/examples/bluetooth/lowenergyscanner/deviceinfo.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/bluetooth/lowenergyscanner/main.py b/examples/bluetooth/lowenergyscanner/main.py index ec12f99e7..6b84a1031 100644 --- a/examples/bluetooth/lowenergyscanner/main.py +++ b/examples/bluetooth/lowenergyscanner/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the bluetooth/lowenergyscanner example from Qt v6.x""" diff --git a/examples/bluetooth/lowenergyscanner/serviceinfo.py b/examples/bluetooth/lowenergyscanner/serviceinfo.py index cddffe663..30df4e0be 100644 --- a/examples/bluetooth/lowenergyscanner/serviceinfo.py +++ b/examples/bluetooth/lowenergyscanner/serviceinfo.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtBluetooth import QLowEnergyService diff --git a/examples/charts/areachart/areachart.py b/examples/charts/areachart/areachart.py index 164264ff7..d1e2b7042 100644 --- a/examples/charts/areachart/areachart.py +++ b/examples/charts/areachart/areachart.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the areachart example from Qt v6.x""" diff --git a/examples/charts/audio/audio.py b/examples/charts/audio/audio.py index 8ba0b20c5..1d603f880 100644 --- a/examples/charts/audio/audio.py +++ b/examples/charts/audio/audio.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the charts/audio example from Qt v5.x""" diff --git a/examples/charts/barchart/barchart.py b/examples/charts/barchart/barchart.py index 66126ad8a..f542b9fa3 100644 --- a/examples/charts/barchart/barchart.py +++ b/examples/charts/barchart/barchart.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the linechart example from Qt v6.x""" diff --git a/examples/charts/callout/callout.py b/examples/charts/callout/callout.py index 622938d16..08c34fb6d 100644 --- a/examples/charts/callout/callout.py +++ b/examples/charts/callout/callout.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Callout example from Qt v5.x""" diff --git a/examples/charts/chartthemes/main.py b/examples/charts/chartthemes/main.py index 5787710ca..1157f270e 100644 --- a/examples/charts/chartthemes/main.py +++ b/examples/charts/chartthemes/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Chart Themes example from Qt v5.x""" diff --git a/examples/charts/donutbreakdown/donutbreakdown.py b/examples/charts/donutbreakdown/donutbreakdown.py index 9111d4aac..c4340931d 100644 --- a/examples/charts/donutbreakdown/donutbreakdown.py +++ b/examples/charts/donutbreakdown/donutbreakdown.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Donut Chart Breakdown example from Qt v5.x""" diff --git a/examples/charts/dynamicspline/chart.py b/examples/charts/dynamicspline/chart.py index 59ddef13f..0858007f1 100644 --- a/examples/charts/dynamicspline/chart.py +++ b/examples/charts/dynamicspline/chart.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import random diff --git a/examples/charts/dynamicspline/main.py b/examples/charts/dynamicspline/main.py index 8405824dc..cbb5109f1 100644 --- a/examples/charts/dynamicspline/main.py +++ b/examples/charts/dynamicspline/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Dynamic Spline example from Qt v5.x""" import sys diff --git a/examples/charts/legend/legend.py b/examples/charts/legend/legend.py index 5417a940f..36c5b6ed0 100644 --- a/examples/charts/legend/legend.py +++ b/examples/charts/legend/legend.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Legend example from Qt v5.x""" diff --git a/examples/charts/lineandbar/lineandbar.py b/examples/charts/lineandbar/lineandbar.py index 62721c763..e824b3aa1 100644 --- a/examples/charts/lineandbar/lineandbar.py +++ b/examples/charts/lineandbar/lineandbar.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the line/bar example from Qt v5.x""" diff --git a/examples/charts/linechart/linechart.py b/examples/charts/linechart/linechart.py index cee4c16db..b618cbc33 100644 --- a/examples/charts/linechart/linechart.py +++ b/examples/charts/linechart/linechart.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the linechart example from Qt v5.x""" diff --git a/examples/charts/logvalueaxis/logvalueaxis.py b/examples/charts/logvalueaxis/logvalueaxis.py index e727c1200..be58ca0a4 100644 --- a/examples/charts/logvalueaxis/logvalueaxis.py +++ b/examples/charts/logvalueaxis/logvalueaxis.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Logarithmic Axis Example from Qt v5.x""" diff --git a/examples/charts/memoryusage/memoryusage.py b/examples/charts/memoryusage/memoryusage.py index 3ba42368e..543b5f562 100644 --- a/examples/charts/memoryusage/memoryusage.py +++ b/examples/charts/memoryusage/memoryusage.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 Charts example: Simple memory usage viewer""" diff --git a/examples/charts/modeldata/modeldata.py b/examples/charts/modeldata/modeldata.py index 0e36f7770..f12eb8999 100644 --- a/examples/charts/modeldata/modeldata.py +++ b/examples/charts/modeldata/modeldata.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Model Data example from Qt v5.x""" diff --git a/examples/charts/nesteddonuts/nesteddonuts.py b/examples/charts/nesteddonuts/nesteddonuts.py index 49173c33a..cfc2f80e9 100644 --- a/examples/charts/nesteddonuts/nesteddonuts.py +++ b/examples/charts/nesteddonuts/nesteddonuts.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Nested Donuts example from Qt v5.x""" diff --git a/examples/charts/percentbarchart/percentbarchart.py b/examples/charts/percentbarchart/percentbarchart.py index 9f70c0328..e518c1721 100644 --- a/examples/charts/percentbarchart/percentbarchart.py +++ b/examples/charts/percentbarchart/percentbarchart.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Percent Bar Chart example from Qt v5.x""" diff --git a/examples/charts/piechart/piechart.py b/examples/charts/piechart/piechart.py index e71359a98..d866ef9ed 100644 --- a/examples/charts/piechart/piechart.py +++ b/examples/charts/piechart/piechart.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Pie Chart Example from Qt v5.x""" diff --git a/examples/charts/pointconfiguration/chartwindow.py b/examples/charts/pointconfiguration/chartwindow.py index 36b10aa16..70ef84268 100644 --- a/examples/charts/pointconfiguration/chartwindow.py +++ b/examples/charts/pointconfiguration/chartwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Selected Point Configuration Example from Qt 6.5""" from PySide6.QtCore import QPointF, Slot @@ -7,7 +8,6 @@ from PySide6.QtGui import QColor, QIcon, QPainter from PySide6.QtWidgets import QMainWindow, QLineEdit, QLabel, QComboBox from PySide6.QtWidgets import QCheckBox, QWidget, QGridLayout, QHBoxLayout from PySide6.QtCharts import QLineSeries, QXYSeries, QChart, QChartView -from typing import Union PointConfig = QXYSeries.PointConfiguration @@ -95,7 +95,7 @@ class ChartWindow(QMainWindow): self._select_point(4) @Slot(QPointF) - def _select_point(self, point: Union[QPointF, int]): + def _select_point(self, point: QPointF | int): try: index = (self._series.points().index(point.toPoint()) if isinstance(point, QPointF) else point) diff --git a/examples/charts/pointconfiguration/pointconfiguration.py b/examples/charts/pointconfiguration/pointconfiguration.py index d8c90d2df..b7bf43064 100644 --- a/examples/charts/pointconfiguration/pointconfiguration.py +++ b/examples/charts/pointconfiguration/pointconfiguration.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Light Markers Points Selection example from Qt v6.2""" import sys diff --git a/examples/charts/pointselectionandmarkers/pointselectionandmarkers.py b/examples/charts/pointselectionandmarkers/pointselectionandmarkers.py index df7b61687..f151287f6 100644 --- a/examples/charts/pointselectionandmarkers/pointselectionandmarkers.py +++ b/examples/charts/pointselectionandmarkers/pointselectionandmarkers.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Light Markers Points Selection example from Qt v6.2""" import sys diff --git a/examples/charts/pointselectionandmarkers/utilities.py b/examples/charts/pointselectionandmarkers/utilities.py index b27a2542b..5b47dddc5 100644 --- a/examples/charts/pointselectionandmarkers/utilities.py +++ b/examples/charts/pointselectionandmarkers/utilities.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtGui import QImage, QPainter, QColor from PySide6.QtCore import Qt diff --git a/examples/charts/qmlpolarchart/qmlpolarchart.py b/examples/charts/qmlpolarchart/qmlpolarchart.py index 6391fc305..594ac7a6a 100644 --- a/examples/charts/qmlpolarchart/qmlpolarchart.py +++ b/examples/charts/qmlpolarchart/qmlpolarchart.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the QML Polar Chart Example from Qt v5.x""" diff --git a/examples/charts/temperaturerecords/temperaturerecords.py b/examples/charts/temperaturerecords/temperaturerecords.py index 358f3818e..ef129c073 100644 --- a/examples/charts/temperaturerecords/temperaturerecords.py +++ b/examples/charts/temperaturerecords/temperaturerecords.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Temperature Records example from Qt v5.x""" diff --git a/examples/corelib/ipc/sharedmemory/dialog.py b/examples/corelib/ipc/sharedmemory/dialog.py index 134900047..8fe6f0534 100644 --- a/examples/corelib/ipc/sharedmemory/dialog.py +++ b/examples/corelib/ipc/sharedmemory/dialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from pathlib import Path diff --git a/examples/corelib/ipc/sharedmemory/main.py b/examples/corelib/ipc/sharedmemory/main.py index e497c8de6..ef8733782 100644 --- a/examples/corelib/ipc/sharedmemory/main.py +++ b/examples/corelib/ipc/sharedmemory/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the ipc/sharedmemory example from Qt v6.x""" diff --git a/examples/corelib/mimetypesbrowser/mainwindow.py b/examples/corelib/mimetypesbrowser/mainwindow.py index 76404eeb7..beed81a53 100644 --- a/examples/corelib/mimetypesbrowser/mainwindow.py +++ b/examples/corelib/mimetypesbrowser/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from mimetypemodel import MimeTypeModel from PySide6.QtCore import (QDir, QFileInfo, QMimeDatabase, QModelIndex, Qt, diff --git a/examples/corelib/mimetypesbrowser/mimetypemodel.py b/examples/corelib/mimetypesbrowser/mimetypemodel.py index 5243f110e..96ad4e290 100644 --- a/examples/corelib/mimetypesbrowser/mimetypemodel.py +++ b/examples/corelib/mimetypesbrowser/mimetypemodel.py @@ -1,7 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -from typing import List +from __future__ import annotations from PySide6.QtCore import QMimeDatabase, QMimeType, QModelIndex, QObject, Qt, qWarning from PySide6.QtGui import QStandardItem, QStandardItemModel @@ -29,7 +28,7 @@ class MimeTypeModel(QStandardItemModel): def populate(self): mime_database = QMimeDatabase() - all_types: List[QMimeType] = mime_database.allMimeTypes() + all_types: list[QMimeType] = mime_database.allMimeTypes() # Move top level types to rear end of list, sort this partition, # create top level items and truncate the list. diff --git a/examples/corelib/mimetypesbrowser/mimetypesbrowser.py b/examples/corelib/mimetypesbrowser/mimetypesbrowser.py index 4742a31b8..4f7b6959a 100644 --- a/examples/corelib/mimetypesbrowser/mimetypesbrowser.py +++ b/examples/corelib/mimetypesbrowser/mimetypesbrowser.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the corelib/mimetypes/mimetypebrowser example from from Qt""" diff --git a/examples/corelib/settingseditor/settingseditor.py b/examples/corelib/settingseditor/settingseditor.py index f87a2f4b5..bd5766adb 100644 --- a/examples/corelib/settingseditor/settingseditor.py +++ b/examples/corelib/settingseditor/settingseditor.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/tools/settingseditor example from Qt v5.x""" diff --git a/examples/corelib/threads/mandelbrot.py b/examples/corelib/threads/mandelbrot.py index 4689813d4..d2d108e1f 100644 --- a/examples/corelib/threads/mandelbrot.py +++ b/examples/corelib/threads/mandelbrot.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the corelib/threads/mandelbrot example from Qt v5.x, originating from PyQt""" diff --git a/examples/datavisualization/bars3d/bars3d.py b/examples/datavisualization/bars3d/bars3d.py index f1283fcbd..587c91c37 100644 --- a/examples/datavisualization/bars3d/bars3d.py +++ b/examples/datavisualization/bars3d/bars3d.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 QtDataVisualization example""" diff --git a/examples/datavisualization/graphgallery/axesinputhandler.py b/examples/datavisualization/graphgallery/axesinputhandler.py index 7f721d4aa..25f2e9b42 100644 --- a/examples/datavisualization/graphgallery/axesinputhandler.py +++ b/examples/datavisualization/graphgallery/axesinputhandler.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import Enum from math import sin, cos, degrees diff --git a/examples/datavisualization/graphgallery/bargraph.py b/examples/datavisualization/graphgallery/bargraph.py index 7938a5ca1..b89560dd8 100644 --- a/examples/datavisualization/graphgallery/bargraph.py +++ b/examples/datavisualization/graphgallery/bargraph.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from graphmodifier import GraphModifier diff --git a/examples/datavisualization/graphgallery/custominputhandler.py b/examples/datavisualization/graphgallery/custominputhandler.py index 0402be607..6c856bf1a 100644 --- a/examples/datavisualization/graphgallery/custominputhandler.py +++ b/examples/datavisualization/graphgallery/custominputhandler.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import Enum from math import sin, cos, degrees diff --git a/examples/datavisualization/graphgallery/graphmodifier.py b/examples/datavisualization/graphgallery/graphmodifier.py index e8d94ee96..f79e3d2b7 100644 --- a/examples/datavisualization/graphgallery/graphmodifier.py +++ b/examples/datavisualization/graphgallery/graphmodifier.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from math import atan, degrees diff --git a/examples/datavisualization/graphgallery/highlightseries.py b/examples/datavisualization/graphgallery/highlightseries.py index b5495b422..ea52799e0 100644 --- a/examples/datavisualization/graphgallery/highlightseries.py +++ b/examples/datavisualization/graphgallery/highlightseries.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QPoint, Qt, Slot from PySide6.QtGui import QLinearGradient, QVector3D diff --git a/examples/datavisualization/graphgallery/main.py b/examples/datavisualization/graphgallery/main.py index 4b57b85dd..9eb87ff5f 100644 --- a/examples/datavisualization/graphgallery/main.py +++ b/examples/datavisualization/graphgallery/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt DataVisualization graphgallery example from Qt v6.x""" diff --git a/examples/datavisualization/graphgallery/rainfalldata.py b/examples/datavisualization/graphgallery/rainfalldata.py index 18d6de8d7..28b177910 100644 --- a/examples/datavisualization/graphgallery/rainfalldata.py +++ b/examples/datavisualization/graphgallery/rainfalldata.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/datavisualization/graphgallery/scatterdatamodifier.py b/examples/datavisualization/graphgallery/scatterdatamodifier.py index 7c16ef7b9..52e27488a 100644 --- a/examples/datavisualization/graphgallery/scatterdatamodifier.py +++ b/examples/datavisualization/graphgallery/scatterdatamodifier.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from math import cos, degrees, sqrt diff --git a/examples/datavisualization/graphgallery/scattergraph.py b/examples/datavisualization/graphgallery/scattergraph.py index ffcd428ee..14a690280 100644 --- a/examples/datavisualization/graphgallery/scattergraph.py +++ b/examples/datavisualization/graphgallery/scattergraph.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, QSize, Qt from PySide6.QtWidgets import (QCheckBox, QComboBox, QCommandLinkButton, diff --git a/examples/datavisualization/graphgallery/surfacegraph.py b/examples/datavisualization/graphgallery/surfacegraph.py index d42f496f9..78d5cdcf5 100644 --- a/examples/datavisualization/graphgallery/surfacegraph.py +++ b/examples/datavisualization/graphgallery/surfacegraph.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from surfacegraphmodifier import SurfaceGraphModifier diff --git a/examples/datavisualization/graphgallery/surfacegraphmodifier.py b/examples/datavisualization/graphgallery/surfacegraphmodifier.py index 68499fac8..9cd0afeae 100644 --- a/examples/datavisualization/graphgallery/surfacegraphmodifier.py +++ b/examples/datavisualization/graphgallery/surfacegraphmodifier.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from math import sqrt, sin diff --git a/examples/datavisualization/graphgallery/topographicseries.py b/examples/datavisualization/graphgallery/topographicseries.py index 350edcb4f..95995e361 100644 --- a/examples/datavisualization/graphgallery/topographicseries.py +++ b/examples/datavisualization/graphgallery/topographicseries.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt from PySide6.QtGui import QImage, QVector3D diff --git a/examples/datavisualization/graphgallery/variantbardatamapping.py b/examples/datavisualization/graphgallery/variantbardatamapping.py index 50bdefa6a..5b1986b87 100644 --- a/examples/datavisualization/graphgallery/variantbardatamapping.py +++ b/examples/datavisualization/graphgallery/variantbardatamapping.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Signal diff --git a/examples/datavisualization/graphgallery/variantbardataproxy.py b/examples/datavisualization/graphgallery/variantbardataproxy.py index f69ebaf80..ad2b2a7cb 100644 --- a/examples/datavisualization/graphgallery/variantbardataproxy.py +++ b/examples/datavisualization/graphgallery/variantbardataproxy.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtDataVisualization import QBarDataProxy, QBarDataItem diff --git a/examples/datavisualization/graphgallery/variantdataset.py b/examples/datavisualization/graphgallery/variantdataset.py index 752bc3887..c9b8ab1ab 100644 --- a/examples/datavisualization/graphgallery/variantdataset.py +++ b/examples/datavisualization/graphgallery/variantdataset.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Signal diff --git a/examples/datavisualization/minimalsurface/main.py b/examples/datavisualization/minimalsurface/main.py index db720dced..df5e905a1 100644 --- a/examples/datavisualization/minimalsurface/main.py +++ b/examples/datavisualization/minimalsurface/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os import sys diff --git a/examples/datavisualization/qmlsurfacegallery/datasource.py b/examples/datavisualization/qmlsurfacegallery/datasource.py index aca2a6ab8..05fa2183a 100644 --- a/examples/datavisualization/qmlsurfacegallery/datasource.py +++ b/examples/datavisualization/qmlsurfacegallery/datasource.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from math import sin, pi diff --git a/examples/datavisualization/qmlsurfacegallery/main.py b/examples/datavisualization/qmlsurfacegallery/main.py index 7b980bc17..f1d3216e3 100644 --- a/examples/datavisualization/qmlsurfacegallery/main.py +++ b/examples/datavisualization/qmlsurfacegallery/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt DataVisualization qmlsurfacegallery example from Qt v6.x""" diff --git a/examples/datavisualization/surface/main.py b/examples/datavisualization/surface/main.py index f43970184..11756b805 100644 --- a/examples/datavisualization/surface/main.py +++ b/examples/datavisualization/surface/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/datavisualization/surface/surfacegraph.py b/examples/datavisualization/surface/surfacegraph.py index 69eea716c..26a910e8f 100644 --- a/examples/datavisualization/surface/surfacegraph.py +++ b/examples/datavisualization/surface/surfacegraph.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import math from pathlib import Path diff --git a/examples/datavisualization/surface_model_numpy/main.py b/examples/datavisualization/surface_model_numpy/main.py index f43970184..11756b805 100644 --- a/examples/datavisualization/surface_model_numpy/main.py +++ b/examples/datavisualization/surface_model_numpy/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/datavisualization/surface_model_numpy/surfacegraph.py b/examples/datavisualization/surface_model_numpy/surfacegraph.py index c0c1acecf..3e885d9c2 100644 --- a/examples/datavisualization/surface_model_numpy/surfacegraph.py +++ b/examples/datavisualization/surface_model_numpy/surfacegraph.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import numpy as np import math diff --git a/examples/datavisualization/surface_numpy/main.py b/examples/datavisualization/surface_numpy/main.py index f43970184..11756b805 100644 --- a/examples/datavisualization/surface_numpy/main.py +++ b/examples/datavisualization/surface_numpy/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/datavisualization/surface_numpy/surfacegraph.py b/examples/datavisualization/surface_numpy/surfacegraph.py index c9f6e75a9..654c9d05c 100644 --- a/examples/datavisualization/surface_numpy/surfacegraph.py +++ b/examples/datavisualization/surface_numpy/surfacegraph.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import numpy as np import math diff --git a/examples/dbus/listnames/listnames.py b/examples/dbus/listnames/listnames.py index 2240a06d8..1c279f5d7 100644 --- a/examples/dbus/listnames/listnames.py +++ b/examples/dbus/listnames/listnames.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the QtDBus listnames example from Qt v6.x""" diff --git a/examples/dbus/pingpong/ping.py b/examples/dbus/pingpong/ping.py index d61f25499..2e6522441 100644 --- a/examples/dbus/pingpong/ping.py +++ b/examples/dbus/pingpong/ping.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the QtDBus pingpong example from Qt v6.x (ping client)""" diff --git a/examples/dbus/pingpong/pong.py b/examples/dbus/pingpong/pong.py index 0dec6eda0..371291f2a 100644 --- a/examples/dbus/pingpong/pong.py +++ b/examples/dbus/pingpong/pong.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the QtDBus pingpong example from Qt v6.x (pong server)""" diff --git a/examples/demos/colorpaletteclient/abstractresource.py b/examples/demos/colorpaletteclient/abstractresource.py index 3f3a7ed6a..49e6168fd 100644 --- a/examples/demos/colorpaletteclient/abstractresource.py +++ b/examples/demos/colorpaletteclient/abstractresource.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject from PySide6.QtQml import QmlAnonymous diff --git a/examples/demos/colorpaletteclient/basiclogin.py b/examples/demos/colorpaletteclient/basiclogin.py index b9139c2e2..1090f4d06 100644 --- a/examples/demos/colorpaletteclient/basiclogin.py +++ b/examples/demos/colorpaletteclient/basiclogin.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from functools import partial diff --git a/examples/demos/colorpaletteclient/main.py b/examples/demos/colorpaletteclient/main.py index a249b9fa2..a35bdde80 100644 --- a/examples/demos/colorpaletteclient/main.py +++ b/examples/demos/colorpaletteclient/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt RESTful API client demo from Qt v6.x""" diff --git a/examples/demos/colorpaletteclient/paginatedresource.py b/examples/demos/colorpaletteclient/paginatedresource.py index b7f036c4e..4c463e5d5 100644 --- a/examples/demos/colorpaletteclient/paginatedresource.py +++ b/examples/demos/colorpaletteclient/paginatedresource.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from dataclasses import dataclass diff --git a/examples/demos/colorpaletteclient/restservice.py b/examples/demos/colorpaletteclient/restservice.py index d334ecd03..852c50fe3 100644 --- a/examples/demos/colorpaletteclient/restservice.py +++ b/examples/demos/colorpaletteclient/restservice.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Property, Signal, ClassInfo from PySide6.QtNetwork import (QNetworkAccessManager, QRestAccessManager, diff --git a/examples/demos/documentviewer/abstractviewer.py b/examples/demos/documentviewer/abstractviewer.py index 4039fe9fb..87eaf6fc3 100644 --- a/examples/demos/documentviewer/abstractviewer.py +++ b/examples/demos/documentviewer/abstractviewer.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject diff --git a/examples/demos/documentviewer/jsonviewer/jsonviewer.py b/examples/demos/documentviewer/jsonviewer/jsonviewer.py index 1e5a34ca0..98ca997cc 100644 --- a/examples/demos/documentviewer/jsonviewer/jsonviewer.py +++ b/examples/demos/documentviewer/jsonviewer/jsonviewer.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import json diff --git a/examples/demos/documentviewer/main.py b/examples/demos/documentviewer/main.py index 2af373ef3..5159b9c3b 100644 --- a/examples/demos/documentviewer/main.py +++ b/examples/demos/documentviewer/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt Document Viewer demo from Qt v6.x""" diff --git a/examples/demos/documentviewer/mainwindow.py b/examples/demos/documentviewer/mainwindow.py index e9abd0bec..c3e853f38 100644 --- a/examples/demos/documentviewer/mainwindow.py +++ b/examples/demos/documentviewer/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import (QDialog, QFileDialog, QMainWindow, QMessageBox) from PySide6.QtCore import (QDir, QFile, QFileInfo, QSettings, Slot) diff --git a/examples/demos/documentviewer/pdfviewer/pdfviewer.py b/examples/demos/documentviewer/pdfviewer/pdfviewer.py index d5695e4d0..08863502d 100644 --- a/examples/demos/documentviewer/pdfviewer/pdfviewer.py +++ b/examples/demos/documentviewer/pdfviewer/pdfviewer.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from math import sqrt diff --git a/examples/demos/documentviewer/pdfviewer/zoomselector.py b/examples/demos/documentviewer/pdfviewer/zoomselector.py index e5da5708f..70133d998 100644 --- a/examples/demos/documentviewer/pdfviewer/zoomselector.py +++ b/examples/demos/documentviewer/pdfviewer/zoomselector.py @@ -1,5 +1,6 @@ # Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QComboBox from PySide6.QtCore import Signal, Slot diff --git a/examples/demos/documentviewer/recentfilemenu.py b/examples/demos/documentviewer/recentfilemenu.py index 36c7dc9f3..be5ffaf45 100644 --- a/examples/demos/documentviewer/recentfilemenu.py +++ b/examples/demos/documentviewer/recentfilemenu.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QMenu from PySide6.QtCore import Signal, Slot diff --git a/examples/demos/documentviewer/recentfiles.py b/examples/demos/documentviewer/recentfiles.py index fdfc56d40..3f6e5e7a5 100644 --- a/examples/demos/documentviewer/recentfiles.py +++ b/examples/demos/documentviewer/recentfiles.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import Enum, auto diff --git a/examples/demos/documentviewer/txtviewer/txtviewer.py b/examples/demos/documentviewer/txtviewer/txtviewer.py index ef5a38fcd..f2fe5bd37 100644 --- a/examples/demos/documentviewer/txtviewer/txtviewer.py +++ b/examples/demos/documentviewer/txtviewer/txtviewer.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import (QDialog, QFileDialog, QPlainTextEdit) diff --git a/examples/demos/documentviewer/viewerfactory.py b/examples/demos/documentviewer/viewerfactory.py index ecae6770b..0d32cbfeb 100644 --- a/examples/demos/documentviewer/viewerfactory.py +++ b/examples/demos/documentviewer/viewerfactory.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import Enum, auto diff --git a/examples/designer/taskmenuextension/main.py b/examples/designer/taskmenuextension/main.py index ffde89d29..ff2cda53e 100644 --- a/examples/designer/taskmenuextension/main.py +++ b/examples/designer/taskmenuextension/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt Designer taskmenuextension example from Qt v6.x""" diff --git a/examples/designer/taskmenuextension/registertictactoe.py b/examples/designer/taskmenuextension/registertictactoe.py index 2b014c790..853355587 100644 --- a/examples/designer/taskmenuextension/registertictactoe.py +++ b/examples/designer/taskmenuextension/registertictactoe.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from tictactoe import TicTacToe # noqa: F401 from tictactoeplugin import TicTacToePlugin diff --git a/examples/designer/taskmenuextension/tictactoe.py b/examples/designer/taskmenuextension/tictactoe.py index aa1c3158c..9e8118bb4 100644 --- a/examples/designer/taskmenuextension/tictactoe.py +++ b/examples/designer/taskmenuextension/tictactoe.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt, QPoint, QRect, QSize, Property, Slot from PySide6.QtGui import QPainter, QPen diff --git a/examples/designer/taskmenuextension/tictactoeplugin.py b/examples/designer/taskmenuextension/tictactoeplugin.py index f9c925133..93a40a85a 100644 --- a/examples/designer/taskmenuextension/tictactoeplugin.py +++ b/examples/designer/taskmenuextension/tictactoeplugin.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from tictactoe import TicTacToe from tictactoetaskmenu import TicTacToeTaskMenuFactory diff --git a/examples/designer/taskmenuextension/tictactoetaskmenu.py b/examples/designer/taskmenuextension/tictactoetaskmenu.py index 71826dc7d..f2c6cceb0 100644 --- a/examples/designer/taskmenuextension/tictactoetaskmenu.py +++ b/examples/designer/taskmenuextension/tictactoetaskmenu.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from tictactoe import TicTacToe diff --git a/examples/external/matplotlib/widget3d/widget3d.py b/examples/external/matplotlib/widget3d/widget3d.py index 8bfcc4ca2..01ead09c8 100644 --- a/examples/external/matplotlib/widget3d/widget3d.py +++ b/examples/external/matplotlib/widget3d/widget3d.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/external/matplotlib/widget_gaussian/widget_gaussian.py b/examples/external/matplotlib/widget_gaussian/widget_gaussian.py index 2423e496a..22669d1a5 100644 --- a/examples/external/matplotlib/widget_gaussian/widget_gaussian.py +++ b/examples/external/matplotlib/widget_gaussian/widget_gaussian.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/external/networkx/main.py b/examples/external/networkx/main.py index 8cd7e7903..8b88b5c30 100644 --- a/examples/external/networkx/main.py +++ b/examples/external/networkx/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import math diff --git a/examples/external/opencv/webcam_pattern_detection.py b/examples/external/opencv/webcam_pattern_detection.py index 0c55a1333..00172410f 100644 --- a/examples/external/opencv/webcam_pattern_detection.py +++ b/examples/external/opencv/webcam_pattern_detection.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os import sys diff --git a/examples/external/pandas/dataframe_model.py b/examples/external/pandas/dataframe_model.py index b3d9e81fe..142d4c722 100644 --- a/examples/external/pandas/dataframe_model.py +++ b/examples/external/pandas/dataframe_model.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import pandas as pd diff --git a/examples/external/scikit/staining_colors_separation.py b/examples/external/scikit/staining_colors_separation.py index 94fdc3bdc..ce886a8e8 100644 --- a/examples/external/scikit/staining_colors_separation.py +++ b/examples/external/scikit/staining_colors_separation.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/graphs/2d/hellographs/main.py b/examples/graphs/2d/hellographs/main.py index acc349beb..aff9d129a 100644 --- a/examples/graphs/2d/hellographs/main.py +++ b/examples/graphs/2d/hellographs/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt Hello Graphs example from Qt v6.x""" diff --git a/examples/graphs/3d/minimalsurfacegraph/main.py b/examples/graphs/3d/minimalsurfacegraph/main.py index 5fb4b4472..6ef940b52 100644 --- a/examples/graphs/3d/minimalsurfacegraph/main.py +++ b/examples/graphs/3d/minimalsurfacegraph/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/graphs/3d/minimalsurfacegraph/minimalsurfacegraph.pyproject b/examples/graphs/3d/minimalsurfacegraph/minimalsurfacegraph.pyproject new file mode 100644 index 000000000..cc7a74a34 --- /dev/null +++ b/examples/graphs/3d/minimalsurfacegraph/minimalsurfacegraph.pyproject @@ -0,0 +1,3 @@ +{ + "files": ["main.py"] +} diff --git a/examples/graphs/3d/widgetgallery/doc/widgetgallery.rst b/examples/graphs/3d/widgetgallery/doc/widgetgallery.rst deleted file mode 100644 index 1470001d6..000000000 --- a/examples/graphs/3d/widgetgallery/doc/widgetgallery.rst +++ /dev/null @@ -1,11 +0,0 @@ -Widget Gallery -============== - - -Widget Gallery demonstrates all three graph types and some of their special -features. The graphs have their own tabs in the application. - - -.. image:: widgetgallery.webp - :width: 400 - :alt: Widget Screenshot diff --git a/examples/graphs/3d/widgetgallery/axesinputhandler.py b/examples/graphs/3d/widgetgraphgallery/axesinputhandler.py index 4c4202974..2323d62e1 100644 --- a/examples/graphs/3d/widgetgallery/axesinputhandler.py +++ b/examples/graphs/3d/widgetgraphgallery/axesinputhandler.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import Enum from math import sin, cos, degrees diff --git a/examples/graphs/3d/widgetgallery/bargraph.py b/examples/graphs/3d/widgetgraphgallery/bargraph.py index 822acb4a9..497916068 100644 --- a/examples/graphs/3d/widgetgallery/bargraph.py +++ b/examples/graphs/3d/widgetgraphgallery/bargraph.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from graphmodifier import GraphModifier diff --git a/examples/graphs/3d/widgetgallery/custominputhandler.py b/examples/graphs/3d/widgetgraphgallery/custominputhandler.py index 15fe00e70..a33968091 100644 --- a/examples/graphs/3d/widgetgallery/custominputhandler.py +++ b/examples/graphs/3d/widgetgraphgallery/custominputhandler.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import Enum from math import sin, cos, degrees diff --git a/examples/graphs/3d/widgetgallery/data/layer_1.png b/examples/graphs/3d/widgetgraphgallery/data/layer_1.png Binary files differindex 9138c710a..9138c710a 100644 --- a/examples/graphs/3d/widgetgallery/data/layer_1.png +++ b/examples/graphs/3d/widgetgraphgallery/data/layer_1.png diff --git a/examples/graphs/3d/widgetgallery/data/layer_2.png b/examples/graphs/3d/widgetgraphgallery/data/layer_2.png Binary files differindex 61631ae8b..61631ae8b 100644 --- a/examples/graphs/3d/widgetgallery/data/layer_2.png +++ b/examples/graphs/3d/widgetgraphgallery/data/layer_2.png diff --git a/examples/graphs/3d/widgetgallery/data/layer_3.png b/examples/graphs/3d/widgetgraphgallery/data/layer_3.png Binary files differindex 066ffbe75..066ffbe75 100644 --- a/examples/graphs/3d/widgetgallery/data/layer_3.png +++ b/examples/graphs/3d/widgetgraphgallery/data/layer_3.png diff --git a/examples/graphs/3d/widgetgallery/data/license.txt b/examples/graphs/3d/widgetgraphgallery/data/license.txt index 749daf31f..749daf31f 100644 --- a/examples/graphs/3d/widgetgallery/data/license.txt +++ b/examples/graphs/3d/widgetgraphgallery/data/license.txt diff --git a/examples/graphs/3d/widgetgallery/data/maptexture.jpg b/examples/graphs/3d/widgetgraphgallery/data/maptexture.jpg Binary files differindex ae5d66ebe..ae5d66ebe 100644 --- a/examples/graphs/3d/widgetgallery/data/maptexture.jpg +++ b/examples/graphs/3d/widgetgraphgallery/data/maptexture.jpg diff --git a/examples/graphs/3d/widgetgallery/data/narrowarrow.mesh b/examples/graphs/3d/widgetgraphgallery/data/narrowarrow.mesh Binary files differindex 288867b1e..288867b1e 100644 --- a/examples/graphs/3d/widgetgallery/data/narrowarrow.mesh +++ b/examples/graphs/3d/widgetgraphgallery/data/narrowarrow.mesh diff --git a/examples/graphs/3d/widgetgallery/data/oilrig.mesh b/examples/graphs/3d/widgetgraphgallery/data/oilrig.mesh Binary files differindex 4a7baeddf..4a7baeddf 100644 --- a/examples/graphs/3d/widgetgallery/data/oilrig.mesh +++ b/examples/graphs/3d/widgetgraphgallery/data/oilrig.mesh diff --git a/examples/graphs/3d/widgetgallery/data/pipe.mesh b/examples/graphs/3d/widgetgraphgallery/data/pipe.mesh Binary files differindex 984b6d443..984b6d443 100644 --- a/examples/graphs/3d/widgetgallery/data/pipe.mesh +++ b/examples/graphs/3d/widgetgraphgallery/data/pipe.mesh diff --git a/examples/graphs/3d/widgetgallery/data/raindata.txt b/examples/graphs/3d/widgetgraphgallery/data/raindata.txt index d95589219..d95589219 100644 --- a/examples/graphs/3d/widgetgallery/data/raindata.txt +++ b/examples/graphs/3d/widgetgraphgallery/data/raindata.txt diff --git a/examples/graphs/3d/widgetgallery/data/refinery.mesh b/examples/graphs/3d/widgetgraphgallery/data/refinery.mesh Binary files differindex a7e249353..a7e249353 100644 --- a/examples/graphs/3d/widgetgallery/data/refinery.mesh +++ b/examples/graphs/3d/widgetgraphgallery/data/refinery.mesh diff --git a/examples/graphs/3d/widgetgallery/data/topography.png b/examples/graphs/3d/widgetgraphgallery/data/topography.png Binary files differindex 9349cdb31..9349cdb31 100644 --- a/examples/graphs/3d/widgetgallery/data/topography.png +++ b/examples/graphs/3d/widgetgraphgallery/data/topography.png diff --git a/examples/graphs/3d/widgetgraphgallery/doc/widgetgraphgallery.rst b/examples/graphs/3d/widgetgraphgallery/doc/widgetgraphgallery.rst new file mode 100644 index 000000000..33a4da15b --- /dev/null +++ b/examples/graphs/3d/widgetgraphgallery/doc/widgetgraphgallery.rst @@ -0,0 +1,11 @@ +Widget Graph Gallery +==================== + + +Widget Graph Gallery demonstrates all three graph types and some of their +special features. The graphs have their own tabs in the application. + + +.. image:: widgetgraphgallery.webp + :width: 400 + :alt: Widget Screenshot diff --git a/examples/graphs/3d/widgetgallery/doc/widgetgallery.webp b/examples/graphs/3d/widgetgraphgallery/doc/widgetgraphgallery.webp Binary files differindex eb5767264..eb5767264 100644 --- a/examples/graphs/3d/widgetgallery/doc/widgetgallery.webp +++ b/examples/graphs/3d/widgetgraphgallery/doc/widgetgraphgallery.webp diff --git a/examples/graphs/3d/widgetgallery/graphmodifier.py b/examples/graphs/3d/widgetgraphgallery/graphmodifier.py index 2eaafa792..678864ac3 100644 --- a/examples/graphs/3d/widgetgallery/graphmodifier.py +++ b/examples/graphs/3d/widgetgraphgallery/graphmodifier.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from math import atan, degrees diff --git a/examples/graphs/3d/widgetgallery/highlightseries.py b/examples/graphs/3d/widgetgraphgallery/highlightseries.py index 8c7b91633..fce1bd0ac 100644 --- a/examples/graphs/3d/widgetgallery/highlightseries.py +++ b/examples/graphs/3d/widgetgraphgallery/highlightseries.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QPoint, Qt, Slot from PySide6.QtGui import QLinearGradient, QVector3D diff --git a/examples/graphs/3d/widgetgallery/main.py b/examples/graphs/3d/widgetgraphgallery/main.py index 7bb2238a7..d8380486b 100644 --- a/examples/graphs/3d/widgetgallery/main.py +++ b/examples/graphs/3d/widgetgraphgallery/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt Graphs widgetgallery example from Qt v6.x""" diff --git a/examples/graphs/3d/widgetgallery/rainfalldata.py b/examples/graphs/3d/widgetgraphgallery/rainfalldata.py index d74f45a8b..283b421e7 100644 --- a/examples/graphs/3d/widgetgallery/rainfalldata.py +++ b/examples/graphs/3d/widgetgraphgallery/rainfalldata.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/graphs/3d/widgetgallery/scatterdatamodifier.py b/examples/graphs/3d/widgetgraphgallery/scatterdatamodifier.py index 15064b412..8d6cde59f 100644 --- a/examples/graphs/3d/widgetgallery/scatterdatamodifier.py +++ b/examples/graphs/3d/widgetgraphgallery/scatterdatamodifier.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from math import cos, degrees, sqrt diff --git a/examples/graphs/3d/widgetgallery/scattergraph.py b/examples/graphs/3d/widgetgraphgallery/scattergraph.py index 79e8933eb..9cf5ff33a 100644 --- a/examples/graphs/3d/widgetgallery/scattergraph.py +++ b/examples/graphs/3d/widgetgraphgallery/scattergraph.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, QSize, Qt from PySide6.QtWidgets import (QCheckBox, QComboBox, QCommandLinkButton, diff --git a/examples/graphs/3d/widgetgallery/surfacegraph.py b/examples/graphs/3d/widgetgraphgallery/surfacegraph.py index 4052da821..5c0bc61c8 100644 --- a/examples/graphs/3d/widgetgallery/surfacegraph.py +++ b/examples/graphs/3d/widgetgraphgallery/surfacegraph.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from surfacegraphmodifier import SurfaceGraphModifier diff --git a/examples/graphs/3d/widgetgallery/surfacegraphmodifier.py b/examples/graphs/3d/widgetgraphgallery/surfacegraphmodifier.py index b2706c6fa..bcac7c3ea 100644 --- a/examples/graphs/3d/widgetgallery/surfacegraphmodifier.py +++ b/examples/graphs/3d/widgetgraphgallery/surfacegraphmodifier.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from math import sqrt, sin diff --git a/examples/graphs/3d/widgetgallery/topographicseries.py b/examples/graphs/3d/widgetgraphgallery/topographicseries.py index 4f286a222..30805d66f 100644 --- a/examples/graphs/3d/widgetgallery/topographicseries.py +++ b/examples/graphs/3d/widgetgraphgallery/topographicseries.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt from PySide6.QtGui import QImage, QVector3D diff --git a/examples/graphs/3d/widgetgallery/variantbardatamapping.py b/examples/graphs/3d/widgetgraphgallery/variantbardatamapping.py index 50bdefa6a..5b1986b87 100644 --- a/examples/graphs/3d/widgetgallery/variantbardatamapping.py +++ b/examples/graphs/3d/widgetgraphgallery/variantbardatamapping.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Signal diff --git a/examples/graphs/3d/widgetgallery/variantbardataproxy.py b/examples/graphs/3d/widgetgraphgallery/variantbardataproxy.py index 5ab2a2cd2..9cd71b1a8 100644 --- a/examples/graphs/3d/widgetgallery/variantbardataproxy.py +++ b/examples/graphs/3d/widgetgraphgallery/variantbardataproxy.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtGraphs import QBarDataProxy, QBarDataItem diff --git a/examples/graphs/3d/widgetgallery/variantdataset.py b/examples/graphs/3d/widgetgraphgallery/variantdataset.py index 752bc3887..c9b8ab1ab 100644 --- a/examples/graphs/3d/widgetgallery/variantdataset.py +++ b/examples/graphs/3d/widgetgraphgallery/variantdataset.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Signal diff --git a/examples/graphs/3d/widgetgallery/widgetgallery.pyproject b/examples/graphs/3d/widgetgraphgallery/widgetgraphgallery.pyproject index 581b21483..581b21483 100644 --- a/examples/graphs/3d/widgetgallery/widgetgallery.pyproject +++ b/examples/graphs/3d/widgetgraphgallery/widgetgraphgallery.pyproject diff --git a/examples/gui/analogclock/main.py b/examples/gui/analogclock/main.py index c0e00dd93..cae9811e0 100644 --- a/examples/gui/analogclock/main.py +++ b/examples/gui/analogclock/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/gui/rhiwindow/main.py b/examples/gui/rhiwindow/main.py index cfb73b10b..634a42064 100644 --- a/examples/gui/rhiwindow/main.py +++ b/examples/gui/rhiwindow/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from argparse import ArgumentParser, RawDescriptionHelpFormatter import sys diff --git a/examples/gui/rhiwindow/rhiwindow.py b/examples/gui/rhiwindow/rhiwindow.py index fe054af48..e33506568 100644 --- a/examples/gui/rhiwindow/rhiwindow.py +++ b/examples/gui/rhiwindow/rhiwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import numpy import sys diff --git a/examples/httpserver/afterrequest/main.py b/examples/httpserver/afterrequest/main.py index e68c992ec..7971a1c3a 100644 --- a/examples/httpserver/afterrequest/main.py +++ b/examples/httpserver/afterrequest/main.py @@ -1,6 +1,7 @@ # Copyright (C) 2020 Mikhail Svetkin <mikhail.svetkin@gmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the /httpserver/afterrequest from from Qt""" diff --git a/examples/installer_test/hello.py b/examples/installer_test/hello.py index 3921b5d51..e10276048 100644 --- a/examples/installer_test/hello.py +++ b/examples/installer_test/hello.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """ hello.py diff --git a/examples/location/mapviewer/main.py b/examples/location/mapviewer/main.py index 24ae1623f..f982572d1 100644 --- a/examples/location/mapviewer/main.py +++ b/examples/location/mapviewer/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the location/mapviewer example from Qt v6.x""" diff --git a/examples/multimedia/audiooutput/audiooutput.py b/examples/multimedia/audiooutput/audiooutput.py index 06d52f68a..c2cbd730f 100644 --- a/examples/multimedia/audiooutput/audiooutput.py +++ b/examples/multimedia/audiooutput/audiooutput.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the multimedia/audiooutput example from Qt v5.x, originating from PyQt""" diff --git a/examples/multimedia/audiosource/audiosource.py b/examples/multimedia/audiosource/audiosource.py index a78beb584..5b4fe523c 100644 --- a/examples/multimedia/audiosource/audiosource.py +++ b/examples/multimedia/audiosource/audiosource.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """ PySide6 port of Qt6 example examples/multimedia/audiosources @@ -14,7 +15,6 @@ QIODevice have python bindings that needs to be fixed. """ import os import sys -from typing import Optional import PySide6 from PySide6.QtCore import QByteArray, QMargins, Qt, Slot, qWarning @@ -56,7 +56,7 @@ class AudioInfo: class RenderArea(QWidget): - def __init__(self, parent: Optional[PySide6.QtWidgets.QWidget] = None) -> None: + def __init__(self, parent: PySide6.QtWidgets.QWidget | None = None) -> None: super().__init__(parent=parent) self.m_level = 0 self.setBackgroundRole(QPalette.Base) diff --git a/examples/multimedia/camera/camera.py b/examples/multimedia/camera/camera.py index fa379c807..b98158a1c 100644 --- a/examples/multimedia/camera/camera.py +++ b/examples/multimedia/camera/camera.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os import sys diff --git a/examples/multimedia/camera/imagesettings.py b/examples/multimedia/camera/imagesettings.py index 9ca1d92ce..392681f03 100644 --- a/examples/multimedia/camera/imagesettings.py +++ b/examples/multimedia/camera/imagesettings.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtMultimedia import QImageCapture from PySide6.QtWidgets import QDialog diff --git a/examples/multimedia/camera/main.py b/examples/multimedia/camera/main.py index fd4dd32e3..004f8fac5 100644 --- a/examples/multimedia/camera/main.py +++ b/examples/multimedia/camera/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the QtMultiMedia camera example from Qt v6.x""" diff --git a/examples/multimedia/camera/metadatadialog.py b/examples/multimedia/camera/metadatadialog.py index 97d0a36e5..1ad2c0d89 100644 --- a/examples/multimedia/camera/metadatadialog.py +++ b/examples/multimedia/camera/metadatadialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtMultimedia import QMediaMetaData from PySide6.QtWidgets import (QDialog, QDialogButtonBox, QFileDialog, diff --git a/examples/multimedia/camera/videosettings.py b/examples/multimedia/camera/videosettings.py index a88cb39ed..d0485023a 100644 --- a/examples/multimedia/camera/videosettings.py +++ b/examples/multimedia/camera/videosettings.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from PySide6.QtMultimedia import (QCameraFormat, QMediaFormat, QMediaRecorder, diff --git a/examples/multimedia/player/player.py b/examples/multimedia/player/player.py index d28f2887e..e0e328b5d 100644 --- a/examples/multimedia/player/player.py +++ b/examples/multimedia/player/player.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 Multimedia player example""" diff --git a/examples/multimedia/screencapture/main.py b/examples/multimedia/screencapture/main.py index f445bac03..df6392164 100644 --- a/examples/multimedia/screencapture/main.py +++ b/examples/multimedia/screencapture/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the QtMultiMedia Screen Capture Example from Qt v6.x""" diff --git a/examples/multimedia/screencapture/screencapturepreview.py b/examples/multimedia/screencapture/screencapturepreview.py index c7e0c596a..774a855a7 100644 --- a/examples/multimedia/screencapture/screencapturepreview.py +++ b/examples/multimedia/screencapture/screencapturepreview.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import Enum, auto diff --git a/examples/multimedia/screencapture/screenlistmodel.py b/examples/multimedia/screencapture/screenlistmodel.py index 72bb306e3..dbb13e918 100644 --- a/examples/multimedia/screencapture/screenlistmodel.py +++ b/examples/multimedia/screencapture/screenlistmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtGui import QGuiApplication from PySide6.QtCore import QAbstractListModel, Qt, Slot diff --git a/examples/multimedia/screencapture/windowlistmodel.py b/examples/multimedia/screencapture/windowlistmodel.py index 079040ec2..bffaba875 100644 --- a/examples/multimedia/screencapture/windowlistmodel.py +++ b/examples/multimedia/screencapture/windowlistmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QAbstractListModel, Qt, Slot from PySide6.QtMultimedia import QWindowCapture diff --git a/examples/network/blockingfortuneclient/blockingfortuneclient.py b/examples/network/blockingfortuneclient/blockingfortuneclient.py index d0dd7e0ad..f29cfe25b 100644 --- a/examples/network/blockingfortuneclient/blockingfortuneclient.py +++ b/examples/network/blockingfortuneclient/blockingfortuneclient.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the network/blockingfortunclient example from Qt v5.x, originating from PyQt""" diff --git a/examples/network/downloader/downloader.py b/examples/network/downloader/downloader.py index fba0cb980..35e6d3057 100644 --- a/examples/network/downloader/downloader.py +++ b/examples/network/downloader/downloader.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import ( QWidget, diff --git a/examples/network/fortuneclient/fortuneclient.py b/examples/network/fortuneclient/fortuneclient.py index e88e5e35b..360702e03 100644 --- a/examples/network/fortuneclient/fortuneclient.py +++ b/examples/network/fortuneclient/fortuneclient.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the network/fortuneclient example from Qt v5.x""" diff --git a/examples/network/fortuneserver/fortuneserver.py b/examples/network/fortuneserver/fortuneserver.py index a94a49f42..6b20b9b33 100644 --- a/examples/network/fortuneserver/fortuneserver.py +++ b/examples/network/fortuneserver/fortuneserver.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the network/fortuneserver example from Qt v5.x""" diff --git a/examples/network/googlesuggest/googlesuggest.py b/examples/network/googlesuggest/googlesuggest.py index d3fc67c05..6c384a20b 100644 --- a/examples/network/googlesuggest/googlesuggest.py +++ b/examples/network/googlesuggest/googlesuggest.py @@ -1,7 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -from typing import List +from __future__ import annotations from PySide6.QtCore import (QByteArray, QEvent, QObject, QPoint, Qt, QTimer, QXmlStreamReader, Slot) @@ -77,7 +76,7 @@ class GSuggestCompletion(QObject): return consumed return False - def show_completion(self, choices: List[str]): + def show_completion(self, choices: list[str]): if not choices: return pal = self.editor.palette() @@ -121,7 +120,7 @@ class GSuggestCompletion(QObject): @Slot(QNetworkReply) def handle_network_data(self, network_reply: QNetworkReply): if network_reply.error() == QNetworkReply.NoError: - choices: List[str] = [] + choices: list[str] = [] response: QByteArray = network_reply.readAll() xml = QXmlStreamReader(str(response)) diff --git a/examples/network/googlesuggest/main.py b/examples/network/googlesuggest/main.py index 1efda08e6..50510421f 100644 --- a/examples/network/googlesuggest/main.py +++ b/examples/network/googlesuggest/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/network/googlesuggest/searchbox.py b/examples/network/googlesuggest/searchbox.py index 9cbe20b23..a713a6234 100644 --- a/examples/network/googlesuggest/searchbox.py +++ b/examples/network/googlesuggest/searchbox.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtGui import QDesktopServices diff --git a/examples/network/loopback/dialog.py b/examples/network/loopback/dialog.py index 673afce28..d46efecab 100644 --- a/examples/network/loopback/dialog.py +++ b/examples/network/loopback/dialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QByteArray, Qt from PySide6.QtGui import QGuiApplication diff --git a/examples/network/loopback/main.py b/examples/network/loopback/main.py index d684b6bab..046a8fbac 100644 --- a/examples/network/loopback/main.py +++ b/examples/network/loopback/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/network/threadedfortuneserver/threadedfortuneserver.py b/examples/network/threadedfortuneserver/threadedfortuneserver.py index c75e2bc57..492c81085 100644 --- a/examples/network/threadedfortuneserver/threadedfortuneserver.py +++ b/examples/network/threadedfortuneserver/threadedfortuneserver.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the network/threadedfortuneserver example from Qt v5.x, originating from PyQt""" diff --git a/examples/networkauth/redditclient/main.py b/examples/networkauth/redditclient/main.py index e88e32cc5..c3e3694d1 100644 --- a/examples/networkauth/redditclient/main.py +++ b/examples/networkauth/redditclient/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the networkauth redditclient example from Qt v6.x""" diff --git a/examples/networkauth/redditclient/redditmodel.py b/examples/networkauth/redditclient/redditmodel.py index fd6f9bc97..5c2e6a0d4 100644 --- a/examples/networkauth/redditclient/redditmodel.py +++ b/examples/networkauth/redditclient/redditmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import functools from PySide6.QtCore import (QAbstractTableModel, QJsonDocument, QModelIndex, diff --git a/examples/networkauth/redditclient/redditwrapper.py b/examples/networkauth/redditclient/redditwrapper.py index ed4c3d2c7..80dfb9448 100644 --- a/examples/networkauth/redditclient/redditwrapper.py +++ b/examples/networkauth/redditclient/redditwrapper.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import functools diff --git a/examples/opengl/contextinfo/contextinfo.py b/examples/opengl/contextinfo/contextinfo.py index 311d5b765..233636853 100644 --- a/examples/opengl/contextinfo/contextinfo.py +++ b/examples/opengl/contextinfo/contextinfo.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the opengl/contextinfo example from Qt v5.x""" diff --git a/examples/opengl/hellogl2/glwidget.py b/examples/opengl/hellogl2/glwidget.py index bbf200a6b..d86ba59e8 100644 --- a/examples/opengl/hellogl2/glwidget.py +++ b/examples/opengl/hellogl2/glwidget.py @@ -1,6 +1,7 @@ # Copyright (C) 2023 The Qt Company Ltd. # Copyright (C) 2013 Riverbank Computing Limited. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import ctypes from PySide6.QtCore import Signal, Slot, Qt, QSize, QPointF diff --git a/examples/opengl/hellogl2/logo.py b/examples/opengl/hellogl2/logo.py index c236a1ec9..3be1b5bda 100644 --- a/examples/opengl/hellogl2/logo.py +++ b/examples/opengl/hellogl2/logo.py @@ -1,6 +1,7 @@ # Copyright (C) 2023 The Qt Company Ltd. # Copyright (C) 2013 Riverbank Computing Limited. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import math diff --git a/examples/opengl/hellogl2/main.py b/examples/opengl/hellogl2/main.py index c7eb78a82..41884ab12 100644 --- a/examples/opengl/hellogl2/main.py +++ b/examples/opengl/hellogl2/main.py @@ -1,6 +1,7 @@ # Copyright (C) 2023 The Qt Company Ltd. # Copyright (C) 2013 Riverbank Computing Limited. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the opengl/hellogl2 example from Qt v6.x""" diff --git a/examples/opengl/hellogl2/mainwindow.py b/examples/opengl/hellogl2/mainwindow.py index 69b9b66fe..d5fba7e26 100644 --- a/examples/opengl/hellogl2/mainwindow.py +++ b/examples/opengl/hellogl2/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot, Qt from PySide6.QtGui import QKeySequence diff --git a/examples/opengl/hellogl2/window.py b/examples/opengl/hellogl2/window.py index ad61d2f97..12c4508b3 100644 --- a/examples/opengl/hellogl2/window.py +++ b/examples/opengl/hellogl2/window.py @@ -1,6 +1,7 @@ # Copyright (C) 2023 The Qt Company Ltd. # Copyright (C) 2013 Riverbank Computing Limited. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot, Qt from PySide6.QtWidgets import (QHBoxLayout, QMainWindow, diff --git a/examples/opengl/textures/textures.py b/examples/opengl/textures/textures.py index 87c1164b7..55517d33e 100644 --- a/examples/opengl/textures/textures.py +++ b/examples/opengl/textures/textures.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the opengl/textures example from Qt v6.x showing the use of legacy OpenGL functions with QOpenGLVersionFunctionsFactory.""" diff --git a/examples/opengl/threadedqopenglwidget/glwidget.py b/examples/opengl/threadedqopenglwidget/glwidget.py index edb88e77c..70efc2814 100644 --- a/examples/opengl/threadedqopenglwidget/glwidget.py +++ b/examples/opengl/threadedqopenglwidget/glwidget.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtOpenGLWidgets import QOpenGLWidget diff --git a/examples/opengl/threadedqopenglwidget/main.py b/examples/opengl/threadedqopenglwidget/main.py index 2a379da27..0d4c14ccf 100644 --- a/examples/opengl/threadedqopenglwidget/main.py +++ b/examples/opengl/threadedqopenglwidget/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Threaded QOpenGLWidget Example from Qt v6.x""" diff --git a/examples/opengl/threadedqopenglwidget/mainwindow.py b/examples/opengl/threadedqopenglwidget/mainwindow.py index 4999b799d..cf6dbeecc 100644 --- a/examples/opengl/threadedqopenglwidget/mainwindow.py +++ b/examples/opengl/threadedqopenglwidget/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QWidget, QHBoxLayout diff --git a/examples/opengl/threadedqopenglwidget/renderer.py b/examples/opengl/threadedqopenglwidget/renderer.py index 81ec63cbb..5461123c8 100644 --- a/examples/opengl/threadedqopenglwidget/renderer.py +++ b/examples/opengl/threadedqopenglwidget/renderer.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import ctypes import math diff --git a/examples/pdf/quickpdfviewer/main.py b/examples/pdf/quickpdfviewer/main.py index ee7b882c2..388c590c3 100644 --- a/examples/pdf/quickpdfviewer/main.py +++ b/examples/pdf/quickpdfviewer/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os import sys diff --git a/examples/pdfwidgets/pdfviewer/main.py b/examples/pdfwidgets/pdfviewer/main.py index c4765fdda..55ac454ed 100644 --- a/examples/pdfwidgets/pdfviewer/main.py +++ b/examples/pdfwidgets/pdfviewer/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from argparse import ArgumentParser, RawTextHelpFormatter diff --git a/examples/pdfwidgets/pdfviewer/mainwindow.py b/examples/pdfwidgets/pdfviewer/mainwindow.py index d37475aca..154c87706 100644 --- a/examples/pdfwidgets/pdfviewer/mainwindow.py +++ b/examples/pdfwidgets/pdfviewer/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import math import sys diff --git a/examples/pdfwidgets/pdfviewer/zoomselector.py b/examples/pdfwidgets/pdfviewer/zoomselector.py index 6f9f972e0..3fa64cd34 100644 --- a/examples/pdfwidgets/pdfviewer/zoomselector.py +++ b/examples/pdfwidgets/pdfviewer/zoomselector.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtPdfWidgets import QPdfView from PySide6.QtWidgets import QComboBox diff --git a/examples/qml/editingmodel/main.py b/examples/qml/editingmodel/main.py index 5240a9de0..aa39460aa 100644 --- a/examples/qml/editingmodel/main.py +++ b/examples/qml/editingmodel/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from pathlib import Path diff --git a/examples/qml/editingmodel/model.py b/examples/qml/editingmodel/model.py index 02a1e5717..08feb6408 100644 --- a/examples/qml/editingmodel/model.py +++ b/examples/qml/editingmodel/model.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QAbstractListModel, QByteArray, QModelIndex, Qt, Slot diff --git a/examples/qml/signals/pytoqml1/main.py b/examples/qml/signals/pytoqml1/main.py index 5bc27a521..bb4311e54 100644 --- a/examples/qml/signals/pytoqml1/main.py +++ b/examples/qml/signals/pytoqml1/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from pathlib import Path diff --git a/examples/qml/signals/pytoqml2/main.py b/examples/qml/signals/pytoqml2/main.py index 3a3650aba..9868656e9 100644 --- a/examples/qml/signals/pytoqml2/main.py +++ b/examples/qml/signals/pytoqml2/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from pathlib import Path diff --git a/examples/qml/signals/qmltopy1/main.py b/examples/qml/signals/qmltopy1/main.py index 83966903c..1849f343f 100644 --- a/examples/qml/signals/qmltopy1/main.py +++ b/examples/qml/signals/qmltopy1/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from pathlib import Path diff --git a/examples/qml/signals/qmltopy2/main.py b/examples/qml/signals/qmltopy2/main.py index bc2e8d3ed..3b692e3c7 100644 --- a/examples/qml/signals/qmltopy2/main.py +++ b/examples/qml/signals/qmltopy2/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from pathlib import Path diff --git a/examples/qml/signals/qmltopy3/main.py b/examples/qml/signals/qmltopy3/main.py index 6a5554842..34f2896a3 100644 --- a/examples/qml/signals/qmltopy3/main.py +++ b/examples/qml/signals/qmltopy3/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from pathlib import Path diff --git a/examples/qml/signals/qmltopy4/main.py b/examples/qml/signals/qmltopy4/main.py index 8a56073d1..a5ea78f48 100644 --- a/examples/qml/signals/qmltopy4/main.py +++ b/examples/qml/signals/qmltopy4/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from pathlib import Path diff --git a/examples/qml/textproperties/main.py b/examples/qml/textproperties/main.py index 4e6afc9ff..ce644f754 100644 --- a/examples/qml/textproperties/main.py +++ b/examples/qml/textproperties/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from pathlib import Path diff --git a/examples/qml/tutorials/extending-qml-advanced/adding/main.py b/examples/qml/tutorials/extending-qml-advanced/adding/main.py index ec703dbf3..4c556c631 100644 --- a/examples/qml/tutorials/extending-qml-advanced/adding/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/adding/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/referenceexamples/adding example from Qt v6.x""" diff --git a/examples/qml/tutorials/extending-qml-advanced/adding/person.py b/examples/qml/tutorials/extending-qml-advanced/adding/person.py index 526eae714..90e82082a 100644 --- a/examples/qml/tutorials/extending-qml-advanced/adding/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/adding/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property from PySide6.QtQml import QmlElement diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/birthdayparty.py b/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/birthdayparty.py index 764815175..875e98a27 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/birthdayparty.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/birthdayparty.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtQml import QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/main.py b/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/main.py index 560db6602..eccb9ff8c 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project example from Qt v6.x""" diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/person.py b/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/person.py index 60dc9d882..89a669251 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced1-Base-project/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtQml import QmlElement diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/birthdayparty.py b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/birthdayparty.py index 764815175..875e98a27 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/birthdayparty.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/birthdayparty.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtQml import QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/main.py b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/main.py index cc77e2b40..ba9063e2c 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion example diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/person.py b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/person.py index 57e73e6f5..3d7e0271a 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtQml import QmlElement, QmlUncreatable diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/birthdayparty.py b/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/birthdayparty.py index 3f6102c66..1ef5ae511 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/birthdayparty.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/birthdayparty.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, ClassInfo, Property, Signal from PySide6.QtQml import QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/main.py b/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/main.py index 020974c9b..977a44c4c 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/tutorials/extending-qml-advanced/default advanced3-Default-properties example diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/person.py b/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/person.py index 503aaf65e..8deb7d0bf 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced3-Default-properties/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtQml import QmlAnonymous, QmlElement diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/birthdayparty.py b/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/birthdayparty.py index 3f6102c66..1ef5ae511 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/birthdayparty.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/birthdayparty.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, ClassInfo, Property, Signal from PySide6.QtQml import QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/main.py b/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/main.py index 9757b6daa..f15620549 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties example diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/person.py b/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/person.py index ccd439e88..db3b8d5bd 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtGui import QColor diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/birthdayparty.py b/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/birthdayparty.py index f38bfd305..8e6628f7c 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/birthdayparty.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/birthdayparty.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QDate, QObject, ClassInfo, Property, Signal from PySide6.QtQml import QmlAnonymous, QmlAttached, QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/main.py b/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/main.py index 9a92afeb5..c914fe7d2 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties example diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/person.py b/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/person.py index 503aaf65e..8deb7d0bf 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced5-Attached-properties/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtQml import QmlAnonymous, QmlElement diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/birthdayparty.py b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/birthdayparty.py index eacb5201d..e946242fd 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/birthdayparty.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/birthdayparty.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QDate, QObject, ClassInfo, Property, QTime, Signal from PySide6.QtQml import QmlAnonymous, QmlAttached, QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/happybirthdaysong.py b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/happybirthdaysong.py index c35f9bffa..b76d06ad6 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/happybirthdaysong.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/happybirthdaysong.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QTimer, Property, Signal, Slot from PySide6.QtQml import QmlElement, QPyQmlPropertyValueSource diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/main.py b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/main.py index ea412a547..eb693134a 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source example diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/person.py b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/person.py index 503aaf65e..8deb7d0bf 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtQml import QmlAnonymous, QmlElement diff --git a/examples/qml/tutorials/extending-qml-advanced/binding/birthdayparty.py b/examples/qml/tutorials/extending-qml-advanced/binding/birthdayparty.py index a337d4a16..958a35236 100644 --- a/examples/qml/tutorials/extending-qml-advanced/binding/birthdayparty.py +++ b/examples/qml/tutorials/extending-qml-advanced/binding/birthdayparty.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QDate, QObject, ClassInfo, Property, QTime, Signal from PySide6.QtQml import QmlAnonymous, QmlAttached, QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml-advanced/binding/happybirthdaysong.py b/examples/qml/tutorials/extending-qml-advanced/binding/happybirthdaysong.py index 59ebfe4c6..31d477e89 100644 --- a/examples/qml/tutorials/extending-qml-advanced/binding/happybirthdaysong.py +++ b/examples/qml/tutorials/extending-qml-advanced/binding/happybirthdaysong.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QTimer, Property, Slot from PySide6.QtQml import QmlElement, QPyQmlPropertyValueSource diff --git a/examples/qml/tutorials/extending-qml-advanced/binding/main.py b/examples/qml/tutorials/extending-qml-advanced/binding/main.py index 64929a807..45d0fd3f9 100644 --- a/examples/qml/tutorials/extending-qml-advanced/binding/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/binding/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/referenceexamples/binding example from Qt v6.x""" diff --git a/examples/qml/tutorials/extending-qml-advanced/binding/person.py b/examples/qml/tutorials/extending-qml-advanced/binding/person.py index a6942763a..69ae48c88 100644 --- a/examples/qml/tutorials/extending-qml-advanced/binding/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/binding/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal from PySide6.QtQml import QmlAnonymous, QmlElement diff --git a/examples/qml/tutorials/extending-qml-advanced/extended/main.py b/examples/qml/tutorials/extending-qml-advanced/extended/main.py index 6ee386401..694a042f5 100644 --- a/examples/qml/tutorials/extending-qml-advanced/extended/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/extended/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/referenceexamples/extended example from Qt v6.x""" diff --git a/examples/qml/tutorials/extending-qml-advanced/methods/birthdayparty.py b/examples/qml/tutorials/extending-qml-advanced/methods/birthdayparty.py index a3942b671..a00347671 100644 --- a/examples/qml/tutorials/extending-qml-advanced/methods/birthdayparty.py +++ b/examples/qml/tutorials/extending-qml-advanced/methods/birthdayparty.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Slot from PySide6.QtQml import QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml-advanced/methods/main.py b/examples/qml/tutorials/extending-qml-advanced/methods/main.py index fb656f266..e23476b4d 100644 --- a/examples/qml/tutorials/extending-qml-advanced/methods/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/methods/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/referenceexamples/methods example from Qt v6.x""" diff --git a/examples/qml/tutorials/extending-qml-advanced/methods/person.py b/examples/qml/tutorials/extending-qml-advanced/methods/person.py index 526eae714..90e82082a 100644 --- a/examples/qml/tutorials/extending-qml-advanced/methods/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/methods/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property from PySide6.QtQml import QmlElement diff --git a/examples/qml/tutorials/extending-qml-advanced/properties/birthdayparty.py b/examples/qml/tutorials/extending-qml-advanced/properties/birthdayparty.py index 47dddc85d..be7a2143e 100644 --- a/examples/qml/tutorials/extending-qml-advanced/properties/birthdayparty.py +++ b/examples/qml/tutorials/extending-qml-advanced/properties/birthdayparty.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property from PySide6.QtQml import QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml-advanced/properties/main.py b/examples/qml/tutorials/extending-qml-advanced/properties/main.py index 11757d5f3..f481be165 100644 --- a/examples/qml/tutorials/extending-qml-advanced/properties/main.py +++ b/examples/qml/tutorials/extending-qml-advanced/properties/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/examples/qml/referenceexamples/properties example from Qt v6.x""" diff --git a/examples/qml/tutorials/extending-qml-advanced/properties/person.py b/examples/qml/tutorials/extending-qml-advanced/properties/person.py index 526eae714..90e82082a 100644 --- a/examples/qml/tutorials/extending-qml-advanced/properties/person.py +++ b/examples/qml/tutorials/extending-qml-advanced/properties/person.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property from PySide6.QtQml import QmlElement diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py b/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py index 47d0a0e0c..9ff5fa318 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter1-basics example from Qt v5.x""" diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/methods.py b/examples/qml/tutorials/extending-qml/chapter2-methods/methods.py index d455c317b..a02384ad7 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/methods.py +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/methods.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter2-methods example from Qt v5.x""" diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py b/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py index a9b61e7f1..91d3abe50 100644 --- a/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/bindings.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter3-bindings example from Qt v5.x""" diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/customPropertyTypes.py b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/customPropertyTypes.py index 659850f38..74dfa1871 100644 --- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/customPropertyTypes.py +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/customPropertyTypes.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter4-customPropertyTypes example from Qt v5.x""" diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/listproperties.py b/examples/qml/tutorials/extending-qml/chapter5-listproperties/listproperties.py index 98952cef1..f52d84820 100644 --- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/listproperties.py +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/listproperties.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter5-listproperties example from Qt v5.x""" diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.py b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.py index 3ab8bcc08..d406fd758 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.py +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Property from PySide6.QtQml import QmlElement, ListProperty diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.py b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.py index 6f82f1f10..6a4a69731 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.py +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Property, QRectF from PySide6.QtGui import QColor, QPainter, QPen diff --git a/examples/qml/usingmodel/usingmodel.py b/examples/qml/usingmodel/usingmodel.py index 008a1b94b..d02fb8524 100644 --- a/examples/qml/usingmodel/usingmodel.py +++ b/examples/qml/usingmodel/usingmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from dataclasses import dataclass diff --git a/examples/quick/models/objectlistmodel/objectlistmodel.py b/examples/quick/models/objectlistmodel/objectlistmodel.py index 968761e5c..65eac2354 100644 --- a/examples/quick/models/objectlistmodel/objectlistmodel.py +++ b/examples/quick/models/objectlistmodel/objectlistmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from pathlib import Path import sys diff --git a/examples/quick/models/stringlistmodel/stringlistmodel.py b/examples/quick/models/stringlistmodel/stringlistmodel.py index 3982b1ffc..a1614b41c 100644 --- a/examples/quick/models/stringlistmodel/stringlistmodel.py +++ b/examples/quick/models/stringlistmodel/stringlistmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from pathlib import Path import sys diff --git a/examples/quick/painteditem/painteditem.py b/examples/quick/painteditem/painteditem.py index cf5a05ada..f6c3f0bf2 100644 --- a/examples/quick/painteditem/painteditem.py +++ b/examples/quick/painteditem/painteditem.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from argparse import ArgumentParser, RawTextHelpFormatter from pathlib import Path diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.py b/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.py index 69e7321f9..b094584a1 100644 --- a/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.py +++ b/examples/quick/rendercontrol/rendercontrol_opengl/cuberenderer.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import ctypes import numpy diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/main.py b/examples/quick/rendercontrol/rendercontrol_opengl/main.py index ee885ae6d..ede663bb5 100644 --- a/examples/quick/rendercontrol/rendercontrol_opengl/main.py +++ b/examples/quick/rendercontrol/rendercontrol_opengl/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtGui import QGuiApplication diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.py b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.py index 6f1e61f94..ef489a2c7 100644 --- a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.py +++ b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import numpy from pathlib import Path diff --git a/examples/quick/scenegraph/openglunderqml/main.py b/examples/quick/scenegraph/openglunderqml/main.py index 0e24877bd..e452f6907 100644 --- a/examples/quick/scenegraph/openglunderqml/main.py +++ b/examples/quick/scenegraph/openglunderqml/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from pathlib import Path diff --git a/examples/quick/scenegraph/openglunderqml/squircle.py b/examples/quick/scenegraph/openglunderqml/squircle.py index d2900198b..2cfb9f41c 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.py +++ b/examples/quick/scenegraph/openglunderqml/squircle.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Property, QRunnable, Qt, Signal, Slot from PySide6.QtQml import QmlElement diff --git a/examples/quick/scenegraph/openglunderqml/squirclerenderer.py b/examples/quick/scenegraph/openglunderqml/squirclerenderer.py index d824f96ab..f70702e2f 100644 --- a/examples/quick/scenegraph/openglunderqml/squirclerenderer.py +++ b/examples/quick/scenegraph/openglunderqml/squirclerenderer.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from textwrap import dedent diff --git a/examples/quick/scenegraph/scenegraph_customgeometry/main.py b/examples/quick/scenegraph/scenegraph_customgeometry/main.py index 60a904065..79281afd4 100644 --- a/examples/quick/scenegraph/scenegraph_customgeometry/main.py +++ b/examples/quick/scenegraph/scenegraph_customgeometry/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt Quick customgeometry example from Qt v6.x""" diff --git a/examples/quick/window/main.py b/examples/quick/window/main.py index 62ba6a5e9..f12fa88d2 100644 --- a/examples/quick/window/main.py +++ b/examples/quick/window/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from pathlib import Path diff --git a/examples/quick3d/customgeometry/examplepoint.py b/examples/quick3d/customgeometry/examplepoint.py index 0360806ae..6f0bfe0e1 100644 --- a/examples/quick3d/customgeometry/examplepoint.py +++ b/examples/quick3d/customgeometry/examplepoint.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import random diff --git a/examples/quick3d/customgeometry/exampletriangle.py b/examples/quick3d/customgeometry/exampletriangle.py index 854430c46..0f9e025a0 100644 --- a/examples/quick3d/customgeometry/exampletriangle.py +++ b/examples/quick3d/customgeometry/exampletriangle.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import numpy as np from PySide6.QtCore import Property, Signal diff --git a/examples/quick3d/customgeometry/main.py b/examples/quick3d/customgeometry/main.py index 148330d91..985943208 100644 --- a/examples/quick3d/customgeometry/main.py +++ b/examples/quick3d/customgeometry/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os diff --git a/examples/quick3d/intro/main.py b/examples/quick3d/intro/main.py index 827434038..a35ec6a45 100644 --- a/examples/quick3d/intro/main.py +++ b/examples/quick3d/intro/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os import sys diff --git a/examples/quick3d/proceduraltexture/gradienttexture.py b/examples/quick3d/proceduraltexture/gradienttexture.py index a577f7ebd..a02849f1c 100644 --- a/examples/quick3d/proceduraltexture/gradienttexture.py +++ b/examples/quick3d/proceduraltexture/gradienttexture.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Signal, Property, QSize from PySide6.QtGui import QColor diff --git a/examples/quick3d/proceduraltexture/main.py b/examples/quick3d/proceduraltexture/main.py index a732cc015..292acfe61 100644 --- a/examples/quick3d/proceduraltexture/main.py +++ b/examples/quick3d/proceduraltexture/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtGui import QGuiApplication from PySide6.QtQml import QQmlApplicationEngine diff --git a/examples/quickcontrols/contactslist/contactmodel.py b/examples/quickcontrols/contactslist/contactmodel.py index 5d2746c2e..5f65b9045 100644 --- a/examples/quickcontrols/contactslist/contactmodel.py +++ b/examples/quickcontrols/contactslist/contactmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import bisect from dataclasses import dataclass diff --git a/examples/quickcontrols/contactslist/main.py b/examples/quickcontrols/contactslist/main.py index d501bbdb4..41c7142b3 100644 --- a/examples/quickcontrols/contactslist/main.py +++ b/examples/quickcontrols/contactslist/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """ PySide6 port of Qt Quick Controls Contact List example from Qt v6.x diff --git a/examples/quickcontrols/filesystemexplorer/editormodels.py b/examples/quickcontrols/filesystemexplorer/editormodels.py index 688147726..f317fb48a 100644 --- a/examples/quickcontrols/filesystemexplorer/editormodels.py +++ b/examples/quickcontrols/filesystemexplorer/editormodels.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QFileSystemModel from PySide6.QtQuick import QQuickTextDocument diff --git a/examples/quickcontrols/filesystemexplorer/main.py b/examples/quickcontrols/filesystemexplorer/main.py index 8fad951cb..97bf9852d 100644 --- a/examples/quickcontrols/filesystemexplorer/main.py +++ b/examples/quickcontrols/filesystemexplorer/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """ This example shows how to customize Qt Quick Controls by implementing a simple filesystem explorer. diff --git a/examples/quickcontrols/gallery/gallery.py b/examples/quickcontrols/gallery/gallery.py index 6c2a3612e..7e93e083c 100644 --- a/examples/quickcontrols/gallery/gallery.py +++ b/examples/quickcontrols/gallery/gallery.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """ The gallery example is a simple application with a drawer menu that contains diff --git a/examples/remoteobjects/modelview/modelviewclient.py b/examples/remoteobjects/modelview/modelviewclient.py index 38409c998..c311d1fe1 100644 --- a/examples/remoteobjects/modelview/modelviewclient.py +++ b/examples/remoteobjects/modelview/modelviewclient.py @@ -1,6 +1,7 @@ # Copyright (C) 2017 Ford Motor Company # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the remoteobjects/modelviewclient example from Qt v5.x""" diff --git a/examples/remoteobjects/modelview/modelviewserver.py b/examples/remoteobjects/modelview/modelviewserver.py index 0e213fb57..518dc72c8 100644 --- a/examples/remoteobjects/modelview/modelviewserver.py +++ b/examples/remoteobjects/modelview/modelviewserver.py @@ -1,6 +1,7 @@ # Copyright (C) 2017 Ford Motor Company # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the remoteobjects/modelviewserver example from Qt v5.x""" diff --git a/examples/samplebinding/doc/samplebinding.rst b/examples/samplebinding/doc/samplebinding.rst index defb55d6b..f28798d52 100644 --- a/examples/samplebinding/doc/samplebinding.rst +++ b/examples/samplebinding/doc/samplebinding.rst @@ -165,23 +165,28 @@ Using CMake You can build and run this example by executing the following commands (slightly adapted to your file system layout) in a terminal: -macOS/Linux: +Run CMake on macOS/Linux: .. code-block:: bash cd ~/pyside-setup/examples/samplebinding + mkdir build + cd build + cmake .. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release -On Windows: +Run CMake on Windows: .. code-block:: bash cd C:\pyside-setup\examples\samplebinding + mkdir build + cd build + cmake .. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl.exe + +To build: .. code-block:: bash - mkdir build - cd build - cmake -S.. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl.exe ninja ninja install cd .. diff --git a/examples/samplebinding/main.py b/examples/samplebinding/main.py index cb9f116ee..125073d29 100644 --- a/examples/samplebinding/main.py +++ b/examples/samplebinding/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """An example showcasing how to use bindings for a custom non-Qt C++ library""" diff --git a/examples/scriptableapplication/doc/scriptableapplication.rst b/examples/scriptableapplication/doc/scriptableapplication.rst index 146911f13..bbabb1247 100644 --- a/examples/scriptableapplication/doc/scriptableapplication.rst +++ b/examples/scriptableapplication/doc/scriptableapplication.rst @@ -72,21 +72,22 @@ macOS/Linux: .. code-block:: bash cd ~/pyside-setup/examples/scriptableapplication + mkdir build + cd build + cmake .. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release + ninja + ./scriptableapplication On Windows: .. code-block:: bash cd C:\pyside-setup\examples\scriptableapplication - - -.. code-block:: bash - mkdir build cd build - cmake -S.. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release + cmake .. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl.exe ninja - ./scriptableapplication + .\scriptableapplication.exe Using QMake +++++++++++ diff --git a/examples/serialbus/can/bitratebox.py b/examples/serialbus/can/bitratebox.py index 68c70baac..952967c17 100644 --- a/examples/serialbus/can/bitratebox.py +++ b/examples/serialbus/can/bitratebox.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QComboBox from PySide6.QtGui import QIntValidator diff --git a/examples/serialbus/can/canbusdeviceinfobox.py b/examples/serialbus/can/canbusdeviceinfobox.py index 5e6049265..4028970e7 100644 --- a/examples/serialbus/can/canbusdeviceinfobox.py +++ b/examples/serialbus/can/canbusdeviceinfobox.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt from PySide6.QtWidgets import QGroupBox diff --git a/examples/serialbus/can/canbusdeviceinfodialog.py b/examples/serialbus/can/canbusdeviceinfodialog.py index dfb4e6025..ced446b0a 100644 --- a/examples/serialbus/can/canbusdeviceinfodialog.py +++ b/examples/serialbus/can/canbusdeviceinfodialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QDialog diff --git a/examples/serialbus/can/connectdialog.py b/examples/serialbus/can/connectdialog.py index a6d5ac378..84021da4a 100644 --- a/examples/serialbus/can/connectdialog.py +++ b/examples/serialbus/can/connectdialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QSettings, Qt, Slot from PySide6.QtGui import QIntValidator diff --git a/examples/serialbus/can/main.py b/examples/serialbus/can/main.py index 97cdcc908..0e4aefd3c 100644 --- a/examples/serialbus/can/main.py +++ b/examples/serialbus/can/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/serialbus/can/mainwindow.py b/examples/serialbus/can/mainwindow.py index ae2a08f1f..dda655888 100644 --- a/examples/serialbus/can/mainwindow.py +++ b/examples/serialbus/can/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QTimer, QUrl, Slot from PySide6.QtGui import QDesktopServices diff --git a/examples/serialbus/can/receivedframesmodel.py b/examples/serialbus/can/receivedframesmodel.py index 7953f3750..0d0f19c39 100644 --- a/examples/serialbus/can/receivedframesmodel.py +++ b/examples/serialbus/can/receivedframesmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import IntEnum diff --git a/examples/serialbus/can/receivedframesview.py b/examples/serialbus/can/receivedframesview.py index 0f99a1e77..02d52d1c6 100644 --- a/examples/serialbus/can/receivedframesview.py +++ b/examples/serialbus/can/receivedframesview.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QPoint, Qt, Slot from PySide6.QtGui import QAction, QKeySequence diff --git a/examples/serialbus/can/sendframebox.py b/examples/serialbus/can/sendframebox.py index 6472fc473..b151b79ab 100644 --- a/examples/serialbus/can/sendframebox.py +++ b/examples/serialbus/can/sendframebox.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import re diff --git a/examples/serialbus/modbus/modbusclient/main.py b/examples/serialbus/modbus/modbusclient/main.py index 1bad75c49..de3e946b6 100644 --- a/examples/serialbus/modbus/modbusclient/main.py +++ b/examples/serialbus/modbus/modbusclient/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the examples/serialbus/modbus/client example from Qt v6.x""" diff --git a/examples/serialbus/modbus/modbusclient/mainwindow.py b/examples/serialbus/modbus/modbusclient/mainwindow.py index 02f9d478b..027410bfb 100644 --- a/examples/serialbus/modbus/modbusclient/mainwindow.py +++ b/examples/serialbus/modbus/modbusclient/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import functools from enum import IntEnum diff --git a/examples/serialbus/modbus/modbusclient/settingsdialog.py b/examples/serialbus/modbus/modbusclient/settingsdialog.py index a5e4a37ca..44c59bac2 100644 --- a/examples/serialbus/modbus/modbusclient/settingsdialog.py +++ b/examples/serialbus/modbus/modbusclient/settingsdialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtWidgets import QDialog diff --git a/examples/serialbus/modbus/modbusclient/writeregistermodel.py b/examples/serialbus/modbus/modbusclient/writeregistermodel.py index 07b1226de..e88f4a835 100644 --- a/examples/serialbus/modbus/modbusclient/writeregistermodel.py +++ b/examples/serialbus/modbus/modbusclient/writeregistermodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import IntEnum diff --git a/examples/serialport/terminal/console.py b/examples/serialport/terminal/console.py index 125951374..bedb1ed96 100644 --- a/examples/serialport/terminal/console.py +++ b/examples/serialport/terminal/console.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt, Signal, Slot from PySide6.QtGui import QPalette diff --git a/examples/serialport/terminal/main.py b/examples/serialport/terminal/main.py index 0d2ce0a01..feff5da1a 100644 --- a/examples/serialport/terminal/main.py +++ b/examples/serialport/terminal/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/serialport/terminal/mainwindow.py b/examples/serialport/terminal/mainwindow.py index bdfb0fb0e..c6cf95d29 100644 --- a/examples/serialport/terminal/mainwindow.py +++ b/examples/serialport/terminal/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QIODeviceBase, Slot from PySide6.QtWidgets import QLabel, QMainWindow, QMessageBox diff --git a/examples/serialport/terminal/settingsdialog.py b/examples/serialport/terminal/settingsdialog.py index c9373d5b0..cc8bbb2aa 100644 --- a/examples/serialport/terminal/settingsdialog.py +++ b/examples/serialport/terminal/settingsdialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/spatialaudio/audiopanning/main.py b/examples/spatialaudio/audiopanning/main.py index 19b6c3bbd..db879610f 100644 --- a/examples/spatialaudio/audiopanning/main.py +++ b/examples/spatialaudio/audiopanning/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import math import sys diff --git a/examples/speech/hello_speak/main.py b/examples/speech/hello_speak/main.py index b025dd6c0..309e7ef1b 100644 --- a/examples/speech/hello_speak/main.py +++ b/examples/speech/hello_speak/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the hello_speak example from Qt v6.x""" diff --git a/examples/speech/hello_speak/mainwindow.py b/examples/speech/hello_speak/mainwindow.py index 7790fec8c..cb46b55f3 100644 --- a/examples/speech/hello_speak/mainwindow.py +++ b/examples/speech/hello_speak/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QLocale, QSignalBlocker, Slot from PySide6.QtWidgets import QMainWindow diff --git a/examples/sql/books/bookdelegate.py b/examples/sql/books/bookdelegate.py index 78295adf1..742b1fb46 100644 --- a/examples/sql/books/bookdelegate.py +++ b/examples/sql/books/bookdelegate.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import copy from PySide6.QtSql import QSqlRelationalDelegate diff --git a/examples/sql/books/bookwindow.py b/examples/sql/books/bookwindow.py index 7f9e0f94b..6aa82992b 100644 --- a/examples/sql/books/bookwindow.py +++ b/examples/sql/books/bookwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import (QAbstractItemView, QDataWidgetMapper, QHeaderView, QMainWindow, QMessageBox) diff --git a/examples/sql/books/createdb.py b/examples/sql/books/createdb.py index 5ee0f148e..471148c61 100644 --- a/examples/sql/books/createdb.py +++ b/examples/sql/books/createdb.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtSql import QSqlDatabase, QSqlQuery from datetime import date diff --git a/examples/sql/books/main.py b/examples/sql/books/main.py index 025b55884..4b4aee1a3 100644 --- a/examples/sql/books/main.py +++ b/examples/sql/books/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtWidgets import QApplication diff --git a/examples/sql/relationaltablemodel/connection.py b/examples/sql/relationaltablemodel/connection.py index 6bfc828c8..61c154ba4 100644 --- a/examples/sql/relationaltablemodel/connection.py +++ b/examples/sql/relationaltablemodel/connection.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the relationaltablemodel example from Qt v6.x""" diff --git a/examples/sql/relationaltablemodel/relationaltablemodel.py b/examples/sql/relationaltablemodel/relationaltablemodel.py index d2efac2dc..520390666 100644 --- a/examples/sql/relationaltablemodel/relationaltablemodel.py +++ b/examples/sql/relationaltablemodel/relationaltablemodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the relationaltablemodel example from Qt v6.x""" diff --git a/examples/statemachine/moveblocks/moveblocks.py b/examples/statemachine/moveblocks/moveblocks.py index 0d52c5b00..42a79b507 100644 --- a/examples/statemachine/moveblocks/moveblocks.py +++ b/examples/statemachine/moveblocks/moveblocks.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the examples/statemachine/moveblocks example from Qt v6.x""" diff --git a/examples/statemachine/ping_pong/ping_pong.py b/examples/statemachine/ping_pong/ping_pong.py index d5c18eb28..e2ea9fd67 100644 --- a/examples/statemachine/ping_pong/ping_pong.py +++ b/examples/statemachine/ping_pong/ping_pong.py @@ -1,6 +1,7 @@ # Copyright (C) 2010 velociraptor Genjix <aphidia@hotmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/statemachine/rogue/rogue.py b/examples/statemachine/rogue/rogue.py index f0ce9c28c..bca4ccb84 100644 --- a/examples/statemachine/rogue/rogue.py +++ b/examples/statemachine/rogue/rogue.py @@ -1,6 +1,7 @@ # Copyright (C) 2010 velociraptor Genjix <aphidia@hotmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/statemachine/trafficlight/trafficlight.py b/examples/statemachine/trafficlight/trafficlight.py index 1e58384f9..fb3384f1e 100644 --- a/examples/statemachine/trafficlight/trafficlight.py +++ b/examples/statemachine/trafficlight/trafficlight.py @@ -1,6 +1,7 @@ # Copyright (C) 2010 velociraptor Genjix <aphidia@hotmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/uitools/uiloader/uiloader.py b/examples/uitools/uiloader/uiloader.py index 265c93837..fa19816e7 100644 --- a/examples/uitools/uiloader/uiloader.py +++ b/examples/uitools/uiloader/uiloader.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """QUiLoader example, showing how to dynamically load a Qt Designer form from a UI file.""" diff --git a/examples/utils/pyside_config.py b/examples/utils/pyside_config.py index d3067eec1..40885dfdb 100644 --- a/examples/utils/pyside_config.py +++ b/examples/utils/pyside_config.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sysconfig from enum import Enum diff --git a/examples/webchannel/standalone/core.py b/examples/webchannel/standalone/core.py index 2d0cb0286..987a4ee1a 100644 --- a/examples/webchannel/standalone/core.py +++ b/examples/webchannel/standalone/core.py @@ -1,6 +1,7 @@ # Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Signal, Slot diff --git a/examples/webchannel/standalone/dialog.py b/examples/webchannel/standalone/dialog.py index 7f2413e6c..27cef86a7 100644 --- a/examples/webchannel/standalone/dialog.py +++ b/examples/webchannel/standalone/dialog.py @@ -1,6 +1,7 @@ # Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Signal, Slot diff --git a/examples/webchannel/standalone/main.py b/examples/webchannel/standalone/main.py index 8c04aa64f..8459b1a92 100644 --- a/examples/webchannel/standalone/main.py +++ b/examples/webchannel/standalone/main.py @@ -1,6 +1,7 @@ # Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os diff --git a/examples/webchannel/standalone/websocketclientwrapper.py b/examples/webchannel/standalone/websocketclientwrapper.py index 00b410891..a14672f25 100644 --- a/examples/webchannel/standalone/websocketclientwrapper.py +++ b/examples/webchannel/standalone/websocketclientwrapper.py @@ -1,6 +1,7 @@ # Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Signal, Slot diff --git a/examples/webchannel/standalone/websockettransport.py b/examples/webchannel/standalone/websockettransport.py index ab60e8448..96e9b822a 100644 --- a/examples/webchannel/standalone/websockettransport.py +++ b/examples/webchannel/standalone/websockettransport.py @@ -1,6 +1,7 @@ # Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWebChannel import QWebChannelAbstractTransport from PySide6.QtCore import QByteArray, QJsonDocument, Slot diff --git a/examples/webenginequick/nanobrowser/quicknanobrowser.py b/examples/webenginequick/nanobrowser/quicknanobrowser.py index aee79c2aa..b246ac167 100644 --- a/examples/webenginequick/nanobrowser/quicknanobrowser.py +++ b/examples/webenginequick/nanobrowser/quicknanobrowser.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 WebEngine QtQuick 2 Example""" diff --git a/examples/webenginewidgets/markdowneditor/document.py b/examples/webenginewidgets/markdowneditor/document.py index 331fbc0ca..10ed57523 100644 --- a/examples/webenginewidgets/markdowneditor/document.py +++ b/examples/webenginewidgets/markdowneditor/document.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QObject, Property, Signal diff --git a/examples/webenginewidgets/markdowneditor/main.py b/examples/webenginewidgets/markdowneditor/main.py index 4d787f0f0..8a92abf8d 100644 --- a/examples/webenginewidgets/markdowneditor/main.py +++ b/examples/webenginewidgets/markdowneditor/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 Markdown Editor Example""" diff --git a/examples/webenginewidgets/markdowneditor/mainwindow.py b/examples/webenginewidgets/markdowneditor/mainwindow.py index 6f74cf93d..be65483d3 100644 --- a/examples/webenginewidgets/markdowneditor/mainwindow.py +++ b/examples/webenginewidgets/markdowneditor/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QDir, QFile, QIODevice, QUrl, Qt, Slot diff --git a/examples/webenginewidgets/markdowneditor/previewpage.py b/examples/webenginewidgets/markdowneditor/previewpage.py index 35ac80be4..75c8e317f 100644 --- a/examples/webenginewidgets/markdowneditor/previewpage.py +++ b/examples/webenginewidgets/markdowneditor/previewpage.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtGui import QDesktopServices from PySide6.QtWebEngineCore import QWebEnginePage diff --git a/examples/webenginewidgets/notifications/main.py b/examples/webenginewidgets/notifications/main.py index b59aead97..c51af957b 100644 --- a/examples/webenginewidgets/notifications/main.py +++ b/examples/webenginewidgets/notifications/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 WebEngineWidgets Notifications Example""" diff --git a/examples/webenginewidgets/notifications/notificationpopup.py b/examples/webenginewidgets/notifications/notificationpopup.py index e68ce3d6f..803bfef92 100644 --- a/examples/webenginewidgets/notifications/notificationpopup.py +++ b/examples/webenginewidgets/notifications/notificationpopup.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt, QTimer, QPoint, Slot from PySide6.QtWidgets import (QWidget, QHBoxLayout, QLabel, QVBoxLayout, QSpacerItem, QSizePolicy, diff --git a/examples/webenginewidgets/simplebrowser/browser.py b/examples/webenginewidgets/simplebrowser/browser.py index a124ea084..cf3afa3d9 100644 --- a/examples/webenginewidgets/simplebrowser/browser.py +++ b/examples/webenginewidgets/simplebrowser/browser.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWebEngineCore import (qWebEngineChromiumVersion, QWebEngineProfile, QWebEngineSettings) diff --git a/examples/webenginewidgets/simplebrowser/browserwindow.py b/examples/webenginewidgets/simplebrowser/browserwindow.py index 43b811200..c09e12842 100644 --- a/examples/webenginewidgets/simplebrowser/browserwindow.py +++ b/examples/webenginewidgets/simplebrowser/browserwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.py b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.py index 7096b8b57..09dc00611 100644 --- a/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.py +++ b/examples/webenginewidgets/simplebrowser/downloadmanagerwidget.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWebEngineCore import QWebEngineDownloadRequest from PySide6.QtWidgets import QWidget, QFileDialog diff --git a/examples/webenginewidgets/simplebrowser/downloadwidget.py b/examples/webenginewidgets/simplebrowser/downloadwidget.py index 3b4973cb8..39a110538 100644 --- a/examples/webenginewidgets/simplebrowser/downloadwidget.py +++ b/examples/webenginewidgets/simplebrowser/downloadwidget.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from ui_downloadwidget import Ui_DownloadWidget diff --git a/examples/webenginewidgets/simplebrowser/main.py b/examples/webenginewidgets/simplebrowser/main.py index 781ec29eb..f072b430b 100644 --- a/examples/webenginewidgets/simplebrowser/main.py +++ b/examples/webenginewidgets/simplebrowser/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt WebEngineWidgets Simple Browser example from Qt v6.x""" diff --git a/examples/webenginewidgets/simplebrowser/tabwidget.py b/examples/webenginewidgets/simplebrowser/tabwidget.py index bda321ac1..b0eb865d9 100644 --- a/examples/webenginewidgets/simplebrowser/tabwidget.py +++ b/examples/webenginewidgets/simplebrowser/tabwidget.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from functools import partial diff --git a/examples/webenginewidgets/simplebrowser/webpage.py b/examples/webenginewidgets/simplebrowser/webpage.py index 2f2800a17..e5d9bc6ab 100644 --- a/examples/webenginewidgets/simplebrowser/webpage.py +++ b/examples/webenginewidgets/simplebrowser/webpage.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from functools import partial diff --git a/examples/webenginewidgets/simplebrowser/webpopupwindow.py b/examples/webenginewidgets/simplebrowser/webpopupwindow.py index fac27a61a..0b2263c4c 100644 --- a/examples/webenginewidgets/simplebrowser/webpopupwindow.py +++ b/examples/webenginewidgets/simplebrowser/webpopupwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QLineEdit, QSizePolicy, QWidget, QVBoxLayout from PySide6.QtGui import QAction diff --git a/examples/webenginewidgets/simplebrowser/webview.py b/examples/webenginewidgets/simplebrowser/webview.py index e1282c1dd..1ad4b493e 100644 --- a/examples/webenginewidgets/simplebrowser/webview.py +++ b/examples/webenginewidgets/simplebrowser/webview.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from functools import partial diff --git a/examples/webenginewidgets/widgetsnanobrowser/widgetsnanobrowser.py b/examples/webenginewidgets/widgetsnanobrowser/widgetsnanobrowser.py index 2db865996..b8477112a 100644 --- a/examples/webenginewidgets/widgetsnanobrowser/widgetsnanobrowser.py +++ b/examples/webenginewidgets/widgetsnanobrowser/widgetsnanobrowser.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 WebEngineWidgets Example""" diff --git a/examples/widgetbinding/dialog.py b/examples/widgetbinding/dialog.py index 1bd127804..b7bd74ce4 100644 --- a/examples/widgetbinding/dialog.py +++ b/examples/widgetbinding/dialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QDialog, QLineEdit, QVBoxLayout diff --git a/examples/widgetbinding/doc/widgetbinding.md b/examples/widgetbinding/doc/widgetbinding.md index 6355ea311..910961b1e 100644 --- a/examples/widgetbinding/doc/widgetbinding.md +++ b/examples/widgetbinding/doc/widgetbinding.md @@ -40,20 +40,24 @@ The most important files are: Now create a `build/` directory, and from inside run `cmake` to use the provided `CMakeLists.txt`: -macOS/Linux: +Run CMake on macOS/Linux: ```bash cd ~/pyside-setup/examples/widgetbinding +cd build +cmake .. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release ``` -On Windows: +Run CMake on Windows: ```bash cd C:\pyside-setup\examples\widgetbinding +mkdir build +cd build +cmake .. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl.exe ``` +To build: ```bash -mkdir build -cd build -cmake -S.. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release + ninja ninja install cd .. diff --git a/examples/widgetbinding/main.py b/examples/widgetbinding/main.py index 2b24018b1..3876b4c63 100644 --- a/examples/widgetbinding/main.py +++ b/examples/widgetbinding/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgetbinding/registerwigglywidget.py b/examples/widgetbinding/registerwigglywidget.py index c5560ba6b..f172a94cb 100644 --- a/examples/widgetbinding/registerwigglywidget.py +++ b/examples/widgetbinding/registerwigglywidget.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection from wigglywidget import WigglyWidget diff --git a/examples/widgetbinding/wigglywidget.py b/examples/widgetbinding/wigglywidget.py index 3362eab6b..08c64a28c 100644 --- a/examples/widgetbinding/wigglywidget.py +++ b/examples/widgetbinding/wigglywidget.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QBasicTimer, Property from PySide6.QtGui import QColor, QFontMetrics, QPainter, QPalette diff --git a/examples/widgets/animation/animatedtiles/animatedtiles.py b/examples/widgets/animation/animatedtiles/animatedtiles.py index 02fc75bf5..5be56b0e4 100644 --- a/examples/widgets/animation/animatedtiles/animatedtiles.py +++ b/examples/widgets/animation/animatedtiles/animatedtiles.py @@ -1,6 +1,7 @@ # Copyright (C) 2010 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys import math diff --git a/examples/widgets/animation/appchooser/appchooser.py b/examples/widgets/animation/appchooser/appchooser.py index 610050210..6b29f9997 100644 --- a/examples/widgets/animation/appchooser/appchooser.py +++ b/examples/widgets/animation/appchooser/appchooser.py @@ -1,6 +1,7 @@ # Copyright (C) 2010 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/animation/easing/easing.py b/examples/widgets/animation/easing/easing.py index ba5032458..5ea2348d1 100644 --- a/examples/widgets/animation/easing/easing.py +++ b/examples/widgets/animation/easing/easing.py @@ -1,6 +1,7 @@ # Copyright (C) 2010 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from enum import IntEnum import sys diff --git a/examples/widgets/animation/states/states.py b/examples/widgets/animation/states/states.py index 509c3a7aa..97cdb452a 100644 --- a/examples/widgets/animation/states/states.py +++ b/examples/widgets/animation/states/states.py @@ -1,6 +1,7 @@ # Copyright (C) 2010 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/animation/states/states_rc.py b/examples/widgets/animation/states/states_rc.py index 8b87b5e5e..ea7cfa0b0 100644 --- a/examples/widgets/animation/states/states_rc.py +++ b/examples/widgets/animation/states/states_rc.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # Resource object code # diff --git a/examples/widgets/desktop/screenshot/screenshot.py b/examples/widgets/desktop/screenshot/screenshot.py index a5688da7a..4494ecab4 100644 --- a/examples/widgets/desktop/screenshot/screenshot.py +++ b/examples/widgets/desktop/screenshot/screenshot.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/desktop/screenshot example from Qt v6.x""" diff --git a/examples/widgets/desktop/systray/main.py b/examples/widgets/desktop/systray/main.py index c52c51387..38e7fbb20 100644 --- a/examples/widgets/desktop/systray/main.py +++ b/examples/widgets/desktop/systray/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/desktop/systray/window.py b/examples/widgets/desktop/systray/window.py index 0b5bc39dc..db1569a7a 100644 --- a/examples/widgets/desktop/systray/window.py +++ b/examples/widgets/desktop/systray/window.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtGui import QAction, QIcon diff --git a/examples/widgets/dialogs/classwizard/classwizard.py b/examples/widgets/dialogs/classwizard/classwizard.py index 0efbde69f..d956ec7c5 100644 --- a/examples/widgets/dialogs/classwizard/classwizard.py +++ b/examples/widgets/dialogs/classwizard/classwizard.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import os from pathlib import Path diff --git a/examples/widgets/dialogs/classwizard/listchooser.py b/examples/widgets/dialogs/classwizard/listchooser.py index 6bf47c6d1..eb621baca 100644 --- a/examples/widgets/dialogs/classwizard/listchooser.py +++ b/examples/widgets/dialogs/classwizard/listchooser.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QRegularExpression, Property, Slot from PySide6.QtGui import QRegularExpressionValidator diff --git a/examples/widgets/dialogs/extension/extension.py b/examples/widgets/dialogs/extension/extension.py index b8919f38e..824be89d6 100644 --- a/examples/widgets/dialogs/extension/extension.py +++ b/examples/widgets/dialogs/extension/extension.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/dialogs/extension example from Qt v5.x""" diff --git a/examples/widgets/dialogs/licensewizard/licensewizard.py b/examples/widgets/dialogs/licensewizard/licensewizard.py index 28667d173..ea8198154 100644 --- a/examples/widgets/dialogs/licensewizard/licensewizard.py +++ b/examples/widgets/dialogs/licensewizard/licensewizard.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from enum import IntEnum diff --git a/examples/widgets/dialogs/licensewizard/main.py b/examples/widgets/dialogs/licensewizard/main.py index 26537ddf9..4e2167342 100644 --- a/examples/widgets/dialogs/licensewizard/main.py +++ b/examples/widgets/dialogs/licensewizard/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/dialogs/standarddialogs/standarddialogs.py b/examples/widgets/dialogs/standarddialogs/standarddialogs.py index ef677d5a8..c03a28a74 100644 --- a/examples/widgets/dialogs/standarddialogs/standarddialogs.py +++ b/examples/widgets/dialogs/standarddialogs/standarddialogs.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/dialogs/standarddialogs example from Qt v5.x""" diff --git a/examples/widgets/dialogs/tabdialog/tabdialog.py b/examples/widgets/dialogs/tabdialog/tabdialog.py index 6be3d020b..0e6c5071b 100644 --- a/examples/widgets/dialogs/tabdialog/tabdialog.py +++ b/examples/widgets/dialogs/tabdialog/tabdialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/dialogs/tabdialog example from Qt v6.x""" diff --git a/examples/widgets/dialogs/trivialwizard/trivialwizard.py b/examples/widgets/dialogs/trivialwizard/trivialwizard.py index 2e551ae19..25f4f9625 100644 --- a/examples/widgets/dialogs/trivialwizard/trivialwizard.py +++ b/examples/widgets/dialogs/trivialwizard/trivialwizard.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/dialogs/trivialwizard example from Qt v5.x""" diff --git a/examples/widgets/draganddrop/draggableicons/draggableicons.py b/examples/widgets/draganddrop/draggableicons/draggableicons.py index b929bd5e3..d54528c6e 100644 --- a/examples/widgets/draganddrop/draggableicons/draggableicons.py +++ b/examples/widgets/draganddrop/draggableicons/draggableicons.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from pathlib import Path import sys diff --git a/examples/widgets/draganddrop/draggabletext/draggabletext.py b/examples/widgets/draganddrop/draggabletext/draggabletext.py index 6ffdbd70e..532e705c6 100644 --- a/examples/widgets/draganddrop/draggabletext/draggabletext.py +++ b/examples/widgets/draganddrop/draggabletext/draggabletext.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/draganddrop/draggabletext example from Qt v5.x, originating from PyQt""" diff --git a/examples/widgets/draganddrop/dropsite/droparea.py b/examples/widgets/draganddrop/dropsite/droparea.py index efc4614f0..86714b5d0 100644 --- a/examples/widgets/draganddrop/dropsite/droparea.py +++ b/examples/widgets/draganddrop/dropsite/droparea.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QMimeData, Qt, Slot, Signal from PySide6.QtGui import QPalette, QPixmap diff --git a/examples/widgets/draganddrop/dropsite/dropsitewindow.py b/examples/widgets/draganddrop/dropsite/dropsitewindow.py index 5427d520d..5d09d87ae 100644 --- a/examples/widgets/draganddrop/dropsite/dropsitewindow.py +++ b/examples/widgets/draganddrop/dropsite/dropsitewindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import re from PySide6.QtCore import QMimeData, Qt, Slot diff --git a/examples/widgets/draganddrop/dropsite/main.py b/examples/widgets/draganddrop/dropsite/main.py index bce476a61..1c4365ed7 100644 --- a/examples/widgets/draganddrop/dropsite/main.py +++ b/examples/widgets/draganddrop/dropsite/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/effects/blurpicker/blureffect.py b/examples/widgets/effects/blurpicker/blureffect.py index 16c14a758..cb9b2f34e 100644 --- a/examples/widgets/effects/blurpicker/blureffect.py +++ b/examples/widgets/effects/blurpicker/blureffect.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QRect diff --git a/examples/widgets/effects/blurpicker/blurpicker.py b/examples/widgets/effects/blurpicker/blurpicker.py index 6ff11f217..a0cad5edc 100644 --- a/examples/widgets/effects/blurpicker/blurpicker.py +++ b/examples/widgets/effects/blurpicker/blurpicker.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from pathlib import Path diff --git a/examples/widgets/effects/blurpicker/main.py b/examples/widgets/effects/blurpicker/main.py index 053ac60ec..7f2df0db8 100644 --- a/examples/widgets/effects/blurpicker/main.py +++ b/examples/widgets/effects/blurpicker/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/effects/blurpicker example from Qt v6.x""" diff --git a/examples/widgets/effects/lighting/lighting.py b/examples/widgets/effects/lighting/lighting.py index f074813c3..bec09aa94 100644 --- a/examples/widgets/effects/lighting/lighting.py +++ b/examples/widgets/effects/lighting/lighting.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import math import sys diff --git a/examples/widgets/gettext/main.py b/examples/widgets/gettext/main.py index 85695728d..02e6c2e08 100644 --- a/examples/widgets/gettext/main.py +++ b/examples/widgets/gettext/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from pathlib import Path import gettext diff --git a/examples/widgets/graphicsview/anchorlayout/anchorlayout.py b/examples/widgets/graphicsview/anchorlayout/anchorlayout.py index 9d9be041f..7153018e1 100644 --- a/examples/widgets/graphicsview/anchorlayout/anchorlayout.py +++ b/examples/widgets/graphicsview/anchorlayout/anchorlayout.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/graphicsview/collidingmice/collidingmice.py b/examples/widgets/graphicsview/collidingmice/collidingmice.py index fb24db3ab..7f1a3d233 100644 --- a/examples/widgets/graphicsview/collidingmice/collidingmice.py +++ b/examples/widgets/graphicsview/collidingmice/collidingmice.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import math import sys diff --git a/examples/widgets/graphicsview/collidingmice/mice_rc.py b/examples/widgets/graphicsview/collidingmice/mice_rc.py index e2a22b2e4..0fe2f9022 100644 --- a/examples/widgets/graphicsview/collidingmice/mice_rc.py +++ b/examples/widgets/graphicsview/collidingmice/mice_rc.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # Resource object code # diff --git a/examples/widgets/graphicsview/diagramscene/diagramscene.py b/examples/widgets/graphicsview/diagramscene/diagramscene.py index 60e05613c..5cf5edf8b 100644 --- a/examples/widgets/graphicsview/diagramscene/diagramscene.py +++ b/examples/widgets/graphicsview/diagramscene/diagramscene.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import math import sys diff --git a/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py b/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py index 9ed92b26e..b3ec221fe 100644 --- a/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py +++ b/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys import math diff --git a/examples/widgets/graphicsview/elasticnodes/elasticnodes.py b/examples/widgets/graphicsview/elasticnodes/elasticnodes.py index 90cb49626..d41981dce 100644 --- a/examples/widgets/graphicsview/elasticnodes/elasticnodes.py +++ b/examples/widgets/graphicsview/elasticnodes/elasticnodes.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys import weakref diff --git a/examples/widgets/imageviewer/imageviewer.py b/examples/widgets/imageviewer/imageviewer.py index 93b1e87ba..ebf420f92 100644 --- a/examples/widgets/imageviewer/imageviewer.py +++ b/examples/widgets/imageviewer/imageviewer.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtPrintSupport import QPrintDialog, QPrinter from PySide6.QtWidgets import (QApplication, QDialog, QFileDialog, QLabel, diff --git a/examples/widgets/imageviewer/main.py b/examples/widgets/imageviewer/main.py index 949def62e..2af5833aa 100644 --- a/examples/widgets/imageviewer/main.py +++ b/examples/widgets/imageviewer/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/imageviewer example from Qt v6.0""" diff --git a/examples/widgets/itemviews/address_book/adddialogwidget.py b/examples/widgets/itemviews/address_book/adddialogwidget.py index ecb853e80..29d0a4756 100644 --- a/examples/widgets/itemviews/address_book/adddialogwidget.py +++ b/examples/widgets/itemviews/address_book/adddialogwidget.py @@ -1,6 +1,7 @@ # Copyright (C) 2011 Arun Srinivasan <rulfzid@gmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt from PySide6.QtWidgets import (QDialog, QLabel, QTextEdit, QLineEdit, diff --git a/examples/widgets/itemviews/address_book/address_book.py b/examples/widgets/itemviews/address_book/address_book.py index af0cf3dee..647326903 100644 --- a/examples/widgets/itemviews/address_book/address_book.py +++ b/examples/widgets/itemviews/address_book/address_book.py @@ -1,6 +1,7 @@ # Copyright (C) 2011 Arun Srinivasan <rulfzid@gmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtGui import QAction diff --git a/examples/widgets/itemviews/address_book/addresswidget.py b/examples/widgets/itemviews/address_book/addresswidget.py index cb2f46ea1..5852263e1 100644 --- a/examples/widgets/itemviews/address_book/addresswidget.py +++ b/examples/widgets/itemviews/address_book/addresswidget.py @@ -1,6 +1,7 @@ # Copyright (C) 2011 Arun Srinivasan <rulfzid@gmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations try: import cpickle as pickle diff --git a/examples/widgets/itemviews/address_book/newaddresstab.py b/examples/widgets/itemviews/address_book/newaddresstab.py index d3d037ad4..055137db9 100644 --- a/examples/widgets/itemviews/address_book/newaddresstab.py +++ b/examples/widgets/itemviews/address_book/newaddresstab.py @@ -1,6 +1,7 @@ # Copyright (C) 2011 Arun Srinivasan <rulfzid@gmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import (Qt, Signal) from PySide6.QtWidgets import (QWidget, QLabel, QPushButton, QVBoxLayout) diff --git a/examples/widgets/itemviews/address_book/tablemodel.py b/examples/widgets/itemviews/address_book/tablemodel.py index 3c1dbd4cc..9a69be24e 100644 --- a/examples/widgets/itemviews/address_book/tablemodel.py +++ b/examples/widgets/itemviews/address_book/tablemodel.py @@ -1,6 +1,7 @@ # Copyright (C) 2011 Arun Srinivasan <rulfzid@gmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import (Qt, QAbstractTableModel, QModelIndex) diff --git a/examples/widgets/itemviews/basicfiltermodel/basicsortfiltermodel.py b/examples/widgets/itemviews/basicfiltermodel/basicsortfiltermodel.py index a30b0abdf..7ee69c183 100644 --- a/examples/widgets/itemviews/basicfiltermodel/basicsortfiltermodel.py +++ b/examples/widgets/itemviews/basicfiltermodel/basicsortfiltermodel.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import (QDate, QDateTime, QRegularExpression, diff --git a/examples/widgets/itemviews/dirview/dirview.py b/examples/widgets/itemviews/dirview/dirview.py index d1be6958e..5408f5c7f 100644 --- a/examples/widgets/itemviews/dirview/dirview.py +++ b/examples/widgets/itemviews/dirview/dirview.py @@ -1,5 +1,6 @@ # Copyright (C) 2020 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from argparse import ArgumentParser, RawTextHelpFormatter diff --git a/examples/widgets/itemviews/editabletreemodel/main.py b/examples/widgets/itemviews/editabletreemodel/main.py index 491baa68d..dd33c5424 100644 --- a/examples/widgets/itemviews/editabletreemodel/main.py +++ b/examples/widgets/itemviews/editabletreemodel/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/itemviews/editabletreemodel/mainwindow.py b/examples/widgets/itemviews/editabletreemodel/mainwindow.py index 1489bf28b..2691c0139 100644 --- a/examples/widgets/itemviews/editabletreemodel/mainwindow.py +++ b/examples/widgets/itemviews/editabletreemodel/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from pathlib import Path diff --git a/examples/widgets/itemviews/editabletreemodel/treeitem.py b/examples/widgets/itemviews/editabletreemodel/treeitem.py index 1a25b0774..dfc98b3e8 100644 --- a/examples/widgets/itemviews/editabletreemodel/treeitem.py +++ b/examples/widgets/itemviews/editabletreemodel/treeitem.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations class TreeItem: diff --git a/examples/widgets/itemviews/editabletreemodel/treemodel.py b/examples/widgets/itemviews/editabletreemodel/treemodel.py index a58572fca..ac27fe795 100644 --- a/examples/widgets/itemviews/editabletreemodel/treemodel.py +++ b/examples/widgets/itemviews/editabletreemodel/treemodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QModelIndex, Qt, QAbstractItemModel diff --git a/examples/widgets/itemviews/fetchmore/fetchmore.py b/examples/widgets/itemviews/fetchmore/fetchmore.py index 5150250e0..1b9202f2f 100644 --- a/examples/widgets/itemviews/fetchmore/fetchmore.py +++ b/examples/widgets/itemviews/fetchmore/fetchmore.py @@ -2,6 +2,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the itemviews/fetchmore/fetchmore example from Qt v6.x diff --git a/examples/widgets/itemviews/jsonmodel/jsonmodel.py b/examples/widgets/itemviews/jsonmodel/jsonmodel.py index 6e614c77f..0ff14e67c 100644 --- a/examples/widgets/itemviews/jsonmodel/jsonmodel.py +++ b/examples/widgets/itemviews/jsonmodel/jsonmodel.py @@ -1,9 +1,10 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import json import sys -from typing import Any, List, Dict, Union +from typing import Any from PySide6.QtWidgets import QTreeView, QApplication, QHeaderView from PySide6.QtCore import QAbstractItemModel, QModelIndex, QObject, Qt, QFileInfo @@ -71,7 +72,7 @@ class TreeItem: @classmethod def load( - cls, value: Union[List, Dict], parent: "TreeItem" = None, sort=True + cls, value: list | dict, parent: "TreeItem" = None, sort=True ) -> "TreeItem": """Create a 'root' TreeItem from a nested list or a nested dictonary diff --git a/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.py b/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.py index 577f0faa5..f701d32fe 100644 --- a/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.py +++ b/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/itemviews/spreadsheet/main.py b/examples/widgets/itemviews/spreadsheet/main.py index 0ecc5ec23..b21059ffe 100644 --- a/examples/widgets/itemviews/spreadsheet/main.py +++ b/examples/widgets/itemviews/spreadsheet/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheet.py b/examples/widgets/itemviews/spreadsheet/spreadsheet.py index 82ebe5ebb..342b60f26 100644 --- a/examples/widgets/itemviews/spreadsheet/spreadsheet.py +++ b/examples/widgets/itemviews/spreadsheet/spreadsheet.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QPoint, Qt, QCoreApplication, Slot from PySide6.QtGui import QAction, QBrush, QPixmap, QColor, QPainter @@ -11,12 +12,11 @@ from PySide6.QtWidgets import (QColorDialog, QComboBox, QDialog, QFontDialog, from spreadsheetdelegate import SpreadSheetDelegate from spreadsheetitem import SpreadSheetItem -from typing import Optional from numbers import Number class SpreadSheet(QMainWindow): - def __init__(self, rows: Number, cols: Number, parent: Optional[QWidget] = None) -> None: + def __init__(self, rows: Number, cols: Number, parent: QWidget | None = None) -> None: super().__init__(parent) self._tool_bar = QToolBar(self) diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.py b/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.py index 57aba6f47..c098a6fbb 100644 --- a/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.py +++ b/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.py @@ -1,16 +1,15 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import (QAbstractItemModel, QDate, QModelIndex, QObject, QStringListModel, Qt, Slot) from PySide6.QtWidgets import (QCompleter, QDateTimeEdit, QLineEdit, QStyleOptionViewItem, QStyledItemDelegate, QWidget) -from typing import Optional - class SpreadSheetDelegate(QStyledItemDelegate): - def __init__(self, parent: Optional[QObject] = None) -> None: + def __init__(self, parent: QObject | None = None) -> None: super().__init__(parent) def create_editor(self, parent: QWidget, diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheetitem.py b/examples/widgets/itemviews/spreadsheet/spreadsheetitem.py index dc70da883..9dcdc47d6 100644 --- a/examples/widgets/itemviews/spreadsheet/spreadsheetitem.py +++ b/examples/widgets/itemviews/spreadsheet/spreadsheetitem.py @@ -1,7 +1,8 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations -from typing import Any, Tuple +from typing import Any from PySide6.QtCore import QMetaType, Qt from PySide6.QtWidgets import QTableWidget, QTableWidgetItem @@ -106,7 +107,7 @@ class SpreadSheetItem(QTableWidgetItem): return result - def decode_pos(pos: str) -> Tuple[int, int]: + def decode_pos(pos: str) -> tuple[int, int]: if (not pos): col = -1 row = -1 diff --git a/examples/widgets/itemviews/stardelegate/stardelegate.py b/examples/widgets/itemviews/stardelegate/stardelegate.py index 973eb14f6..394bfc98f 100644 --- a/examples/widgets/itemviews/stardelegate/stardelegate.py +++ b/examples/widgets/itemviews/stardelegate/stardelegate.py @@ -2,6 +2,7 @@ # Copyright (C) 2011 Arun Srinivasan <rulfzid@gmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QStyledItemDelegate, QStyle diff --git a/examples/widgets/itemviews/stardelegate/stareditor.py b/examples/widgets/itemviews/stardelegate/stareditor.py index 296afa950..1fd7839e1 100644 --- a/examples/widgets/itemviews/stardelegate/stareditor.py +++ b/examples/widgets/itemviews/stardelegate/stareditor.py @@ -2,6 +2,7 @@ # Copyright (C) 2011 Arun Srinivasan <rulfzid@gmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import (QWidget) from PySide6.QtGui import (QPainter) diff --git a/examples/widgets/itemviews/stardelegate/starrating.py b/examples/widgets/itemviews/stardelegate/starrating.py index 28dbacd6f..e457e2f50 100644 --- a/examples/widgets/itemviews/stardelegate/starrating.py +++ b/examples/widgets/itemviews/stardelegate/starrating.py @@ -2,6 +2,7 @@ # Copyright (C) 2011 Arun Srinivasan <rulfzid@gmail.com> # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from math import (cos, sin, pi) diff --git a/examples/widgets/layouts/basiclayouts/basiclayouts.py b/examples/widgets/layouts/basiclayouts/basiclayouts.py index 827cb7850..be99d804f 100644 --- a/examples/widgets/layouts/basiclayouts/basiclayouts.py +++ b/examples/widgets/layouts/basiclayouts/basiclayouts.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/layouts/basiclayout example from Qt v5.x""" diff --git a/examples/widgets/layouts/borderlayout/borderlayout.py b/examples/widgets/layouts/borderlayout/borderlayout.py index 3268d7034..19ba3e94b 100644 --- a/examples/widgets/layouts/borderlayout/borderlayout.py +++ b/examples/widgets/layouts/borderlayout/borderlayout.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/layouts/borderlayout example from Qt v5.x""" diff --git a/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.py b/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.py index c9dfcc730..419b4e97c 100644 --- a/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.py +++ b/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/layouts/dynamiclayouts example from Qt v5.x""" diff --git a/examples/widgets/layouts/flowlayout/flowlayout.py b/examples/widgets/layouts/flowlayout/flowlayout.py index 3ab4318fa..4764de70a 100644 --- a/examples/widgets/layouts/flowlayout/flowlayout.py +++ b/examples/widgets/layouts/flowlayout/flowlayout.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/layouts/flowlayout example from Qt v6.x""" diff --git a/examples/widgets/linguist/main.py b/examples/widgets/linguist/main.py index e4212e801..dd6ef4d09 100644 --- a/examples/widgets/linguist/main.py +++ b/examples/widgets/linguist/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/mainwindows/application/application.py b/examples/widgets/mainwindows/application/application.py index f69eade2e..e17c0cae4 100644 --- a/examples/widgets/mainwindows/application/application.py +++ b/examples/widgets/mainwindows/application/application.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from argparse import ArgumentParser, RawTextHelpFormatter import sys diff --git a/examples/widgets/mainwindows/dockwidgets/dockwidgets.py b/examples/widgets/mainwindows/dockwidgets/dockwidgets.py index 83487ee58..d0917063f 100644 --- a/examples/widgets/mainwindows/dockwidgets/dockwidgets.py +++ b/examples/widgets/mainwindows/dockwidgets/dockwidgets.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/mainwindows/dockwidgets example from Qt v5.x, originating from PyQt""" diff --git a/examples/widgets/mainwindows/mdi/mdi.py b/examples/widgets/mainwindows/mdi/mdi.py index c1fa01b8c..e41200ca1 100644 --- a/examples/widgets/mainwindows/mdi/mdi.py +++ b/examples/widgets/mainwindows/mdi/mdi.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/mainwindows/mdi example from Qt v5.x, originating from PyQt""" diff --git a/examples/widgets/painting/basicdrawing/basicdrawing.py b/examples/widgets/painting/basicdrawing/basicdrawing.py index 858a8cd9f..cdc7fd9d5 100644 --- a/examples/widgets/painting/basicdrawing/basicdrawing.py +++ b/examples/widgets/painting/basicdrawing/basicdrawing.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/painting/basicdrawing example from Qt v5.x, originating from PyQt""" diff --git a/examples/widgets/painting/concentriccircles/concentriccircles.py b/examples/widgets/painting/concentriccircles/concentriccircles.py index d2c60178f..297ab1db7 100644 --- a/examples/widgets/painting/concentriccircles/concentriccircles.py +++ b/examples/widgets/painting/concentriccircles/concentriccircles.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/painting/concentriccircles example from Qt v5.x, originating from PyQt""" diff --git a/examples/widgets/painting/painter/painter.py b/examples/widgets/painting/painter/painter.py index 2ca078ad9..1c06a4b47 100644 --- a/examples/widgets/painting/painter/painter.py +++ b/examples/widgets/painting/painter/painter.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import ( QWidget, diff --git a/examples/widgets/painting/plot/plot.py b/examples/widgets/painting/plot/plot.py index fd7ff9937..d437309d0 100644 --- a/examples/widgets/painting/plot/plot.py +++ b/examples/widgets/painting/plot/plot.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import math import sys diff --git a/examples/widgets/rhi/simplerhiwidget/examplewidget.py b/examples/widgets/rhi/simplerhiwidget/examplewidget.py index 5b3e40f50..9f3ef70e9 100644 --- a/examples/widgets/rhi/simplerhiwidget/examplewidget.py +++ b/examples/widgets/rhi/simplerhiwidget/examplewidget.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import numpy diff --git a/examples/widgets/rhi/simplerhiwidget/main.py b/examples/widgets/rhi/simplerhiwidget/main.py index 59be81ddc..5b23af0df 100644 --- a/examples/widgets/rhi/simplerhiwidget/main.py +++ b/examples/widgets/rhi/simplerhiwidget/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the Qt Simple RHI Widget Example example from Qt v6.x""" diff --git a/examples/widgets/richtext/orderform/orderform.py b/examples/widgets/richtext/orderform/orderform.py index 9725624c3..b8f99cac4 100644 --- a/examples/widgets/richtext/orderform/orderform.py +++ b/examples/widgets/richtext/orderform/orderform.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/richtext/orderform example from Qt v5.x""" diff --git a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py index 021328977..5f85ab24d 100644 --- a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py +++ b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/richtext/syntaxhighlighter example from Qt v5.x""" diff --git a/examples/widgets/richtext/textedit/main.py b/examples/widgets/richtext/textedit/main.py index 330ea5fc5..3bebace78 100644 --- a/examples/widgets/richtext/textedit/main.py +++ b/examples/widgets/richtext/textedit/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/richtext/textedit example from Qt v6.x""" diff --git a/examples/widgets/richtext/textedit/textedit.py b/examples/widgets/richtext/textedit/textedit.py index 8019446f0..428a5eae3 100644 --- a/examples/widgets/richtext/textedit/textedit.py +++ b/examples/widgets/richtext/textedit/textedit.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import (QCoreApplication, QDir, QFile, QFileInfo, diff --git a/examples/widgets/richtext/textobject/textobject.py b/examples/widgets/richtext/textobject/textobject.py index 9ab7bf8ae..d42b5643c 100644 --- a/examples/widgets/richtext/textobject/textobject.py +++ b/examples/widgets/richtext/textobject/textobject.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/richtext/textobject example from Qt v5.x""" diff --git a/examples/widgets/thread_signals/thread_signals.py b/examples/widgets/thread_signals/thread_signals.py index ae8e1ba72..f9101bd8c 100644 --- a/examples/widgets/thread_signals/thread_signals.py +++ b/examples/widgets/thread_signals/thread_signals.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import QObject, QThread, Signal, Slot diff --git a/examples/widgets/tools/regularexpression/regularexpression.py b/examples/widgets/tools/regularexpression/regularexpression.py index 261e26196..ac08ddd32 100644 --- a/examples/widgets/tools/regularexpression/regularexpression.py +++ b/examples/widgets/tools/regularexpression/regularexpression.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """ PySide6 port of Qt6 example qtbase/examples/widgets/tools/regularexpression diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.py b/examples/widgets/tools/regularexpression/regularexpressiondialog.py index 2d2bb2bb7..bbaa2f452 100644 --- a/examples/widgets/tools/regularexpression/regularexpressiondialog.py +++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import re import logging diff --git a/examples/widgets/tutorials/addressbook/part1.py b/examples/widgets/tutorials/addressbook/part1.py index 648ddea46..87174453f 100644 --- a/examples/widgets/tutorials/addressbook/part1.py +++ b/examples/widgets/tutorials/addressbook/part1.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/addressbook/part2.py b/examples/widgets/tutorials/addressbook/part2.py index 3c0eb451d..b91d08d8a 100644 --- a/examples/widgets/tutorials/addressbook/part2.py +++ b/examples/widgets/tutorials/addressbook/part2.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/addressbook/part3.py b/examples/widgets/tutorials/addressbook/part3.py index 611796f5e..b6cf0598f 100644 --- a/examples/widgets/tutorials/addressbook/part3.py +++ b/examples/widgets/tutorials/addressbook/part3.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/addressbook/part4.py b/examples/widgets/tutorials/addressbook/part4.py index 95f31d46c..0a569adb7 100644 --- a/examples/widgets/tutorials/addressbook/part4.py +++ b/examples/widgets/tutorials/addressbook/part4.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/addressbook/part5.py b/examples/widgets/tutorials/addressbook/part5.py index 1e9c05862..364a56a3f 100644 --- a/examples/widgets/tutorials/addressbook/part5.py +++ b/examples/widgets/tutorials/addressbook/part5.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/addressbook/part6.py b/examples/widgets/tutorials/addressbook/part6.py index d11298fb9..a00fec3a2 100644 --- a/examples/widgets/tutorials/addressbook/part6.py +++ b/examples/widgets/tutorials/addressbook/part6.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import pickle import sys diff --git a/examples/widgets/tutorials/addressbook/part7.py b/examples/widgets/tutorials/addressbook/part7.py index 3829c003d..dc560cd1a 100644 --- a/examples/widgets/tutorials/addressbook/part7.py +++ b/examples/widgets/tutorials/addressbook/part7.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import pickle import sys diff --git a/examples/widgets/tutorials/cannon/t1.py b/examples/widgets/tutorials/cannon/t1.py index 62411ace2..924069610 100644 --- a/examples/widgets/tutorials/cannon/t1.py +++ b/examples/widgets/tutorials/cannon/t1.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 1 diff --git a/examples/widgets/tutorials/cannon/t10.py b/examples/widgets/tutorials/cannon/t10.py index 8649bb562..710d4e253 100644 --- a/examples/widgets/tutorials/cannon/t10.py +++ b/examples/widgets/tutorials/cannon/t10.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 10 diff --git a/examples/widgets/tutorials/cannon/t11.py b/examples/widgets/tutorials/cannon/t11.py index fbfd2481d..010d22c0c 100644 --- a/examples/widgets/tutorials/cannon/t11.py +++ b/examples/widgets/tutorials/cannon/t11.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 11 diff --git a/examples/widgets/tutorials/cannon/t12.py b/examples/widgets/tutorials/cannon/t12.py index 749c24684..551eb058e 100644 --- a/examples/widgets/tutorials/cannon/t12.py +++ b/examples/widgets/tutorials/cannon/t12.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 12 diff --git a/examples/widgets/tutorials/cannon/t13.py b/examples/widgets/tutorials/cannon/t13.py index f9a771d15..f5ed124ec 100644 --- a/examples/widgets/tutorials/cannon/t13.py +++ b/examples/widgets/tutorials/cannon/t13.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 13 diff --git a/examples/widgets/tutorials/cannon/t14.py b/examples/widgets/tutorials/cannon/t14.py index 3c94408f3..77c61b893 100644 --- a/examples/widgets/tutorials/cannon/t14.py +++ b/examples/widgets/tutorials/cannon/t14.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 14 diff --git a/examples/widgets/tutorials/cannon/t2.py b/examples/widgets/tutorials/cannon/t2.py index d3adba396..7379ba4d9 100644 --- a/examples/widgets/tutorials/cannon/t2.py +++ b/examples/widgets/tutorials/cannon/t2.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 2 diff --git a/examples/widgets/tutorials/cannon/t3.py b/examples/widgets/tutorials/cannon/t3.py index 13bd8f736..ed7cf00e0 100644 --- a/examples/widgets/tutorials/cannon/t3.py +++ b/examples/widgets/tutorials/cannon/t3.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 3 diff --git a/examples/widgets/tutorials/cannon/t4.py b/examples/widgets/tutorials/cannon/t4.py index 37a2dc9dd..199b65731 100644 --- a/examples/widgets/tutorials/cannon/t4.py +++ b/examples/widgets/tutorials/cannon/t4.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 4 diff --git a/examples/widgets/tutorials/cannon/t5.py b/examples/widgets/tutorials/cannon/t5.py index ed5d085f8..e56991629 100644 --- a/examples/widgets/tutorials/cannon/t5.py +++ b/examples/widgets/tutorials/cannon/t5.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 5 diff --git a/examples/widgets/tutorials/cannon/t6.py b/examples/widgets/tutorials/cannon/t6.py index ea2e044e6..98dd9ec11 100644 --- a/examples/widgets/tutorials/cannon/t6.py +++ b/examples/widgets/tutorials/cannon/t6.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 6 diff --git a/examples/widgets/tutorials/cannon/t7.py b/examples/widgets/tutorials/cannon/t7.py index 1175107b8..d0a0704b0 100644 --- a/examples/widgets/tutorials/cannon/t7.py +++ b/examples/widgets/tutorials/cannon/t7.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 7 diff --git a/examples/widgets/tutorials/cannon/t8.py b/examples/widgets/tutorials/cannon/t8.py index 9bb5516b8..33f18a0a0 100644 --- a/examples/widgets/tutorials/cannon/t8.py +++ b/examples/widgets/tutorials/cannon/t8.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 8 diff --git a/examples/widgets/tutorials/cannon/t9.py b/examples/widgets/tutorials/cannon/t9.py index 7cdda4e7b..37c753118 100644 --- a/examples/widgets/tutorials/cannon/t9.py +++ b/examples/widgets/tutorials/cannon/t9.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations # PySide6 tutorial 9 diff --git a/examples/widgets/tutorials/modelview/1_readonly.py b/examples/widgets/tutorials/modelview/1_readonly.py index 9dc923260..4606bc47b 100644 --- a/examples/widgets/tutorials/modelview/1_readonly.py +++ b/examples/widgets/tutorials/modelview/1_readonly.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/modelview/2_formatting.py b/examples/widgets/tutorials/modelview/2_formatting.py index f39ec462c..70cbda03b 100644 --- a/examples/widgets/tutorials/modelview/2_formatting.py +++ b/examples/widgets/tutorials/modelview/2_formatting.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/modelview/3_changingmodel.py b/examples/widgets/tutorials/modelview/3_changingmodel.py index 2148ec5d3..bc6661e66 100644 --- a/examples/widgets/tutorials/modelview/3_changingmodel.py +++ b/examples/widgets/tutorials/modelview/3_changingmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/modelview/4_headers.py b/examples/widgets/tutorials/modelview/4_headers.py index 3feef17bf..91fbe16a7 100644 --- a/examples/widgets/tutorials/modelview/4_headers.py +++ b/examples/widgets/tutorials/modelview/4_headers.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/modelview/5_edit.py b/examples/widgets/tutorials/modelview/5_edit.py index 1a4481fc9..450ac5072 100644 --- a/examples/widgets/tutorials/modelview/5_edit.py +++ b/examples/widgets/tutorials/modelview/5_edit.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from itertools import chain diff --git a/examples/widgets/tutorials/modelview/6_treeview.py b/examples/widgets/tutorials/modelview/6_treeview.py index cac3c6d53..d0259f485 100644 --- a/examples/widgets/tutorials/modelview/6_treeview.py +++ b/examples/widgets/tutorials/modelview/6_treeview.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/tutorials/modelview/7_selections.py b/examples/widgets/tutorials/modelview/7_selections.py index c879d8f67..0a4638bcf 100644 --- a/examples/widgets/tutorials/modelview/7_selections.py +++ b/examples/widgets/tutorials/modelview/7_selections.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/widgets/charactermap/characterwidget.py b/examples/widgets/widgets/charactermap/characterwidget.py index 0f01f9684..e96dacf9e 100644 --- a/examples/widgets/widgets/charactermap/characterwidget.py +++ b/examples/widgets/widgets/charactermap/characterwidget.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from textwrap import dedent diff --git a/examples/widgets/widgets/charactermap/fontinfodialog.py b/examples/widgets/widgets/charactermap/fontinfodialog.py index aa874884f..43b0c1145 100644 --- a/examples/widgets/widgets/charactermap/fontinfodialog.py +++ b/examples/widgets/widgets/charactermap/fontinfodialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt, qVersion, qFuzzyCompare from PySide6.QtGui import QGuiApplication, QFontDatabase diff --git a/examples/widgets/widgets/charactermap/main.py b/examples/widgets/widgets/charactermap/main.py index e84a1d8af..8feded90a 100644 --- a/examples/widgets/widgets/charactermap/main.py +++ b/examples/widgets/widgets/charactermap/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/widgets/widgets/charactermap/mainwindow.py b/examples/widgets/widgets/charactermap/mainwindow.py index d79285def..a2dbb3b25 100644 --- a/examples/widgets/widgets/charactermap/mainwindow.py +++ b/examples/widgets/widgets/charactermap/mainwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt, QSignalBlocker, Slot from PySide6.QtGui import QGuiApplication, QClipboard, QFont, QFontDatabase diff --git a/examples/widgets/widgets/digitalclock/digitalclock.py b/examples/widgets/widgets/digitalclock/digitalclock.py index f0030b356..53c40c823 100644 --- a/examples/widgets/widgets/digitalclock/digitalclock.py +++ b/examples/widgets/widgets/digitalclock/digitalclock.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import QTime, QTimer, Slot diff --git a/examples/widgets/widgets/tetrix/tetrix.py b/examples/widgets/widgets/tetrix/tetrix.py index b5df2aa35..68a5033e7 100644 --- a/examples/widgets/widgets/tetrix/tetrix.py +++ b/examples/widgets/widgets/tetrix/tetrix.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/widgets/tetrix example from Qt v5.x""" diff --git a/examples/widgets/widgetsgallery/main.py b/examples/widgets/widgetsgallery/main.py index e40077a38..ec2b5d651 100644 --- a/examples/widgets/widgetsgallery/main.py +++ b/examples/widgets/widgetsgallery/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the widgets/gallery example from Qt v5.15""" diff --git a/examples/widgets/widgetsgallery/widgetgallery.py b/examples/widgets/widgetsgallery/widgetgallery.py index d43ab26a5..75e6d4245 100644 --- a/examples/widgets/widgetsgallery/widgetgallery.py +++ b/examples/widgets/widgetsgallery/widgetgallery.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/examples/xml/dombookmarks/dombookmarks.py b/examples/xml/dombookmarks/dombookmarks.py index a35aeb0f2..9283ca4d2 100644 --- a/examples/xml/dombookmarks/dombookmarks.py +++ b/examples/xml/dombookmarks/dombookmarks.py @@ -1,6 +1,7 @@ # Copyright (C) 2013 Riverbank Computing Limited. # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """PySide6 port of the xml/dombookmarks example from Qt v5.x""" @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ This is a setuptools setup-script for the Qt for Python project. diff --git a/sources/pyside-tools/android_deploy.py b/sources/pyside-tools/android_deploy.py index 75269d622..ca6775b7c 100644 --- a/sources/pyside-tools/android_deploy.py +++ b/sources/pyside-tools/android_deploy.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import argparse import logging diff --git a/sources/pyside-tools/deploy.py b/sources/pyside-tools/deploy.py index aa03d13d0..a9d2b9d67 100644 --- a/sources/pyside-tools/deploy.py +++ b/sources/pyside-tools/deploy.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ pyside6-deploy deployment tool @@ -49,10 +50,20 @@ TOOL_DESCRIPTION = dedent(f""" Linux = .bin """) +HELP_MODE = dedent(""" + The mode in which the application is deployed. The options are: onefile, + standalone. The default value is onefile. + + This options translates to the mode Nuitka uses to create the executable. + + macOS by default uses the --standalone option. + """) + def main(main_file: Path = None, name: str = None, config_file: Path = None, init: bool = False, loglevel=logging.WARNING, dry_run: bool = False, keep_deployment_files: bool = False, - force: bool = False, extra_ignore_dirs: str = None, extra_modules_grouped: str = None): + force: bool = False, extra_ignore_dirs: str = None, extra_modules_grouped: str = None, + mode: bool = False): logging.basicConfig(level=loglevel) if config_file and not config_file.exists() and not main_file.exists(): @@ -91,7 +102,7 @@ def main(main_file: Path = None, name: str = None, config_file: Path = None, ini config = DesktopConfig(config_file=config_file, source_file=main_file, python_exe=python.exe, dry_run=dry_run, existing_config_file=config_file_exists, - extra_ignore_dirs=extra_ignore_dirs) + extra_ignore_dirs=extra_ignore_dirs, mode=mode) # set application name if name: @@ -135,7 +146,8 @@ def main(main_file: Path = None, name: str = None, config_file: Path = None, ini excluded_qml_plugins=config.excluded_qml_plugins, icon=config.icon, dry_run=dry_run, - permissions=config.permissions) + permissions=config.permissions, + mode=config.mode) except Exception: print(f"[DEPLOY] Exception occurred: {traceback.format_exc()}") finally: @@ -182,7 +194,11 @@ if __name__ == "__main__": parser.add_argument("--extra-modules", type=str, help=HELP_EXTRA_MODULES) + parser.add_argument("--mode", choices=["onefile", "standalone"], default="onefile", + help=HELP_MODE) + args = parser.parse_args() main(args.main_file, args.name, args.config_file, args.init, args.loglevel, args.dry_run, - args.keep_deployment_files, args.force, args.extra_ignore_dirs, args.extra_modules) + args.keep_deployment_files, args.force, args.extra_ignore_dirs, args.extra_modules, + args.mode) diff --git a/sources/pyside-tools/deploy_lib/__init__.py b/sources/pyside-tools/deploy_lib/__init__.py index a40d0838b..b8f9ba659 100644 --- a/sources/pyside-tools/deploy_lib/__init__.py +++ b/sources/pyside-tools/deploy_lib/__init__.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys from pathlib import Path from textwrap import dedent diff --git a/sources/pyside-tools/deploy_lib/android/__init__.py b/sources/pyside-tools/deploy_lib/android/__init__.py index c3027762c..80ba6dee3 100644 --- a/sources/pyside-tools/deploy_lib/android/__init__.py +++ b/sources/pyside-tools/deploy_lib/android/__init__.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations # maps instruction set to Android platform names platform_map = {"aarch64": "arm64-v8a", diff --git a/sources/pyside-tools/deploy_lib/android/android_config.py b/sources/pyside-tools/deploy_lib/android/android_config.py index ad818c2ff..4cca7dfb6 100644 --- a/sources/pyside-tools/deploy_lib/android/android_config.py +++ b/sources/pyside-tools/deploy_lib/android/android_config.py @@ -1,12 +1,13 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import re +import sys import tempfile import logging import zipfile import xml.etree.ElementTree as ET -from typing import List from pathlib import Path from pkginfo import Wheel @@ -15,6 +16,7 @@ from . import (extract_and_copy_jar, get_wheel_android_arch, find_lib_dependenci from .. import (Config, find_pyside_modules, get_all_pyside_modules, MAJOR_VERSION) ANDROID_NDK_VERSION = "26b" +ANDROID_NDK_VERSION_NUMBER_SUFFIX = "10909125" ANDROID_DEPLOY_CACHE = Path.home() / ".pyside6_android_deploy" @@ -24,7 +26,7 @@ class AndroidConfig(Config): """ def __init__(self, config_file: Path, source_file: Path, python_exe: Path, dry_run: bool, android_data, existing_config_file: bool = False, - extra_ignore_dirs: List[str] = None): + extra_ignore_dirs: list[str] = None): super().__init__(config_file=config_file, source_file=source_file, python_exe=python_exe, dry_run=dry_run, existing_config_file=existing_config_file) @@ -58,6 +60,11 @@ class AndroidConfig(Config): else: ndk_path_temp = (ANDROID_DEPLOY_CACHE / "android-ndk" / f"android-ndk-r{ANDROID_NDK_VERSION}") + if sys.platform == "darwin": + ndk_path_temp = ( + ANDROID_DEPLOY_CACHE / "android-ndk" + / f"AndroidNDK{ANDROID_NDK_VERSION_NUMBER_SUFFIX}.app/Contents/NDK" + ) if ndk_path_temp.exists(): self.ndk_path = ndk_path_temp @@ -328,7 +335,7 @@ class AndroidConfig(Config): return dependent_modules - def _find_and_set_dependency_files(self) -> List[zipfile.Path]: + def _find_and_set_dependency_files(self) -> list[zipfile.Path]: """ Based on `modules`, returns the Qt6{module}_{arch}-android-dependencies.xml file, which contains the various dependencies of the module, like permissions, plugins etc @@ -377,7 +384,7 @@ class AndroidConfig(Config): return list(local_libs), list(plugins) - def _find_plugin_dependencies(self, dependent_plugins: List[str]): + def _find_plugin_dependencies(self, dependent_plugins: list[str]): # The `bundled` element in the dependency xml files points to the folder where # additional dependencies for the application exists. Inspecting the depenency files # in android, this always points to the specific Qt plugin dependency folder. diff --git a/sources/pyside-tools/deploy_lib/android/android_helper.py b/sources/pyside-tools/deploy_lib/android/android_helper.py index 7d2f5d575..f9398d7ed 100644 --- a/sources/pyside-tools/deploy_lib/android/android_helper.py +++ b/sources/pyside-tools/deploy_lib/android/android_helper.py @@ -1,11 +1,11 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only - +from __future__ import annotations +import sys import logging import zipfile from dataclasses import dataclass from pathlib import Path -from typing import List, Set from zipfile import ZipFile from jinja2 import Environment, FileSystemLoader @@ -25,8 +25,8 @@ class AndroidData: def create_recipe(version: str, component: str, wheel_path: str, generated_files_path: Path, - qt_modules: List[str] = None, local_libs: List[str] = None, - plugins: List[str] = None): + qt_modules: list[str] = None, local_libs: list[str] = None, + plugins: list[str] = None): ''' Create python_for_android recipe for PySide6 and shiboken6 ''' @@ -91,10 +91,10 @@ def get_llvm_readobj(ndk_path: Path) -> Path: ''' # TODO: Requires change if Windows platform supports Android Deployment or if we # support host other than linux-x86_64 - return (ndk_path / "toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readobj") + return (ndk_path / f"toolchains/llvm/prebuilt/{sys.platform}-x86_64/bin/llvm-readobj") -def find_lib_dependencies(llvm_readobj: Path, lib_path: Path, used_dependencies: Set[str] = None, +def find_lib_dependencies(llvm_readobj: Path, lib_path: Path, used_dependencies: set[str] = None, dry_run: bool = False): """ Find all the Qt dependencies of a library using llvm_readobj diff --git a/sources/pyside-tools/deploy_lib/android/buildozer.py b/sources/pyside-tools/deploy_lib/android/buildozer.py index 828982b5b..36d8313e5 100644 --- a/sources/pyside-tools/deploy_lib/android/buildozer.py +++ b/sources/pyside-tools/deploy_lib/android/buildozer.py @@ -1,12 +1,12 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys import logging import xml.etree.ElementTree as ET import zipfile from pathlib import Path -from typing import List from . import AndroidConfig from .. import BaseConfig, run_command @@ -39,6 +39,13 @@ class BuildozerConfig(BaseConfig): self.set_value("app", "p4a.bootstrap", "qt") self.set_value('app', "p4a.local_recipes", str(pysidedeploy_config.recipe_dir)) + # add p4a branch + # by default the master branch is used + # https://github.com/kivy/python-for-android/commit/b92522fab879dbfc0028966ca3c59ef46ab7767d + # has not been merged to master yet. So, we use the develop branch for now + # TODO: remove this once the above commit is merged to master + self.set_value("app", "p4a.branch", "develop") + # add permissions permissions = self.__find_permissions(pysidedeploy_config.dependency_files) permissions = ", ".join(permissions) @@ -69,7 +76,7 @@ class BuildozerConfig(BaseConfig): self.update_config() - def __find_permissions(self, dependency_files: List[zipfile.Path]): + def __find_permissions(self, dependency_files: list[zipfile.Path]): permissions = set() for dependency_file in dependency_files: xml_content = dependency_file.read_text() @@ -78,7 +85,7 @@ class BuildozerConfig(BaseConfig): permissions.add(permission.attrib['name']) return permissions - def __find_jars(self, dependency_files: List[zipfile.Path], jars_dir: Path): + def __find_jars(self, dependency_files: list[zipfile.Path], jars_dir: Path): jars, init_classes = set(), set() for dependency_file in dependency_files: xml_content = dependency_file.read_text() diff --git a/sources/pyside-tools/deploy_lib/android/recipes/PySide6/__init__.tmpl.py b/sources/pyside-tools/deploy_lib/android/recipes/PySide6/__init__.tmpl.py index 8a8615798..375dadf38 100644 --- a/sources/pyside-tools/deploy_lib/android/recipes/PySide6/__init__.tmpl.py +++ b/sources/pyside-tools/deploy_lib/android/recipes/PySide6/__init__.tmpl.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import shutil import zipfile diff --git a/sources/pyside-tools/deploy_lib/android/recipes/shiboken6/__init__.tmpl.py b/sources/pyside-tools/deploy_lib/android/recipes/shiboken6/__init__.tmpl.py index d6ab037bf..0b822d4d1 100644 --- a/sources/pyside-tools/deploy_lib/android/recipes/shiboken6/__init__.tmpl.py +++ b/sources/pyside-tools/deploy_lib/android/recipes/shiboken6/__init__.tmpl.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import shutil import zipfile diff --git a/sources/pyside-tools/deploy_lib/commands.py b/sources/pyside-tools/deploy_lib/commands.py index 3a7e2a2e2..ee1abcb15 100644 --- a/sources/pyside-tools/deploy_lib/commands.py +++ b/sources/pyside-tools/deploy_lib/commands.py @@ -1,11 +1,11 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import json import subprocess import sys from pathlib import Path -from typing import List """ All utility functions for deployment @@ -37,7 +37,7 @@ def run_command(command, dry_run: bool, fetch_output: bool = False): return command_str, output -def run_qmlimportscanner(qml_files: List[Path], dry_run: bool): +def run_qmlimportscanner(qml_files: list[Path], dry_run: bool): """ Runs pyside6-qmlimportscanner to find all the imported qml modules """ diff --git a/sources/pyside-tools/deploy_lib/config.py b/sources/pyside-tools/deploy_lib/config.py index d59dd92ad..23d037dca 100644 --- a/sources/pyside-tools/deploy_lib/config.py +++ b/sources/pyside-tools/deploy_lib/config.py @@ -1,13 +1,14 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys import configparser import logging import warnings from configparser import ConfigParser -from typing import List from pathlib import Path +from enum import Enum from project import ProjectData from . import (DEFAULT_APP_ICON, find_pyside_modules, find_permission_categories, @@ -74,7 +75,7 @@ class Config(BaseConfig): """ def __init__(self, config_file: Path, source_file: Path, python_exe: Path, dry_run: bool, - existing_config_file: bool = False, extra_ignore_dirs: List[str] = None): + existing_config_file: bool = False, extra_ignore_dirs: list[str] = None): super().__init__(config_file=config_file, existing_config_file=existing_config_file) self.extra_ignore_dirs = extra_ignore_dirs @@ -141,19 +142,20 @@ class Config(BaseConfig): def set_or_fetch(self, config_property_val, config_property_key, config_property_group="app"): """ - Write to config_file if 'config_property_key' is known without config_file - Fetch and return from config_file if 'config_property_key' is unknown, but - config_file exists + If the value corresponding to the key exists in the config file, then return it. + Otherwise, set the value to the config file and return it. Otherwise, raise an exception """ - if config_property_val: + existing_value = self.get_value(config_property_group, config_property_key) + if existing_value: + return existing_value + elif config_property_val: self.set_value(config_property_group, config_property_key, str(config_property_val)) return config_property_val - elif self.get_value(config_property_group, config_property_key): - return self.get_value(config_property_group, config_property_key) else: raise RuntimeError( - f"[DEPLOY] No {config_property_key} specified in config file or as cli option" + f"[DEPLOY] No value for {config_property_key} specified in config file or as cli" + " option" ) @property @@ -375,8 +377,13 @@ class Config(BaseConfig): class DesktopConfig(Config): """Wrapper class around pysidedeploy.spec, but specific to Desktop deployment """ + class NuitkaMode(Enum): + ONEFILE = "onefile" + STANDALONE = "standalone" + def __init__(self, config_file: Path, source_file: Path, python_exe: Path, dry_run: bool, - existing_config_file: bool = False, extra_ignore_dirs: List[str] = None): + existing_config_file: bool = False, extra_ignore_dirs: list[str] = None, + mode: str = "onefile"): super().__init__(config_file, source_file, python_exe, dry_run, existing_config_file, extra_ignore_dirs) self.dependency_reader = QtDependencyReader(dry_run=self.dry_run) @@ -402,6 +409,12 @@ class DesktopConfig(Config): else: self._find_and_set_permissions() + self._mode = self.NuitkaMode.ONEFILE + if self.get_value("nuitka", "mode") == self.NuitkaMode.STANDALONE.value: + self._mode = self.NuitkaMode.STANDALONE + elif mode == self.NuitkaMode.STANDALONE.value: + self.mode = self.NuitkaMode.STANDALONE + @property def qt_plugins(self): return self._qt_plugins @@ -420,6 +433,15 @@ class DesktopConfig(Config): self._permissions = permissions self.set_value("nuitka", "macos.permissions", ",".join(permissions)) + @property + def mode(self): + return self._mode + + @mode.setter + def mode(self, mode: NuitkaMode): + self._mode = mode + self.set_value("nuitka", "mode", mode.value) + def _find_dependent_qt_modules(self): """ Given pysidedeploy_config.modules, find all the other dependent Qt modules. diff --git a/sources/pyside-tools/deploy_lib/default.spec b/sources/pyside-tools/deploy_lib/default.spec index 0a729d585..6f466c24d 100644 --- a/sources/pyside-tools/deploy_lib/default.spec +++ b/sources/pyside-tools/deploy_lib/default.spec @@ -25,9 +25,7 @@ icon = python_path = # python packages to install -# ordered-set: increase compile time performance of nuitka packaging -# zstandard: provides final executable size optimization -packages = Nuitka==2.1 +packages = Nuitka==2.3.2 # buildozer: for deploying Android application android_packages = buildozer==1.5.0,cython==0.29.33 @@ -65,6 +63,9 @@ plugins = # eg: NSCameraUsageDescription:CameraAccess macos.permissions = +# mode of using Nuitka. Accepts standalone or onefile. Default is onefile. +mode = onefile + # (str) specify any extra nuitka arguments # eg: extra_args = --show-modules --follow-stdlib extra_args = --quiet --noinclude-qt-translations diff --git a/sources/pyside-tools/deploy_lib/dependency_util.py b/sources/pyside-tools/deploy_lib/dependency_util.py index 2d5b188d3..30a336f0a 100644 --- a/sources/pyside-tools/deploy_lib/dependency_util.py +++ b/sources/pyside-tools/deploy_lib/dependency_util.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import ast import re @@ -11,14 +12,13 @@ import logging import shutil import sys from pathlib import Path -from typing import List, Set from functools import lru_cache from . import IMPORT_WARNING_PYSIDE, run_command @lru_cache(maxsize=None) -def get_py_files(project_dir: Path, extra_ignore_dirs: List[Path] = None, project_data=None): +def get_py_files(project_dir: Path, extra_ignore_dirs: list[Path] = None, project_data=None): """Finds and returns all the Python files in the project """ py_candidates = [] @@ -78,7 +78,7 @@ def get_ast(py_file: Path): return tree -def find_permission_categories(project_dir: Path, extra_ignore_dirs: List[Path] = None, +def find_permission_categories(project_dir: Path, extra_ignore_dirs: list[Path] = None, project_data=None): """Given the project directory, finds all the permission categories required by the project. eg: Camera, Bluetooth, Contacts etc. @@ -126,7 +126,7 @@ def find_permission_categories(project_dir: Path, extra_ignore_dirs: List[Path] return all_perm_categories -def find_pyside_modules(project_dir: Path, extra_ignore_dirs: List[Path] = None, +def find_pyside_modules(project_dir: Path, extra_ignore_dirs: list[Path] = None, project_data=None): """ Searches all the python files in the project to find all the PySide modules used by @@ -234,7 +234,7 @@ class QtDependencyReader: def lib_reader(self): return self._lib_reader - def find_dependencies(self, module: str, used_modules: Set[str] = None): + def find_dependencies(self, module: str, used_modules: set[str] = None): """ Given a Qt module, find all the other Qt modules it is dependent on and add it to the 'used_modules' set @@ -285,7 +285,7 @@ class QtDependencyReader: else: logging.info(f"[DEPLOY] No Qt dependencies found for {module}") - def find_plugin_dependencies(self, used_modules: List[str], python_exe: Path) -> List[str]: + def find_plugin_dependencies(self, used_modules: list[str], python_exe: Path) -> list[str]: """ Given the modules used by the application, returns all the required plugins """ diff --git a/sources/pyside-tools/deploy_lib/deploy_util.py b/sources/pyside-tools/deploy_lib/deploy_util.py index e8b05e990..724c10bc0 100644 --- a/sources/pyside-tools/deploy_lib/deploy_util.py +++ b/sources/pyside-tools/deploy_lib/deploy_util.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import logging import shutil @@ -7,7 +8,7 @@ import sys from pathlib import Path from . import EXE_FORMAT -from .config import Config +from .config import Config, DesktopConfig def config_option_exists(): @@ -61,17 +62,21 @@ def create_config_file(dry_run: bool = False, config_file: Path = None, main_fil return config_file -def finalize(config: Config): +def finalize(config: DesktopConfig): """ Copy the executable into the final location For Android deployment, this is done through buildozer """ - generated_exec_path = config.generated_files_path / (config.source_file.stem + EXE_FORMAT) + dist_format = EXE_FORMAT + if config.mode == DesktopConfig.NuitkaMode.STANDALONE and sys.platform != "darwin": + dist_format = ".dist" + + generated_exec_path = config.generated_files_path / (config.source_file.stem + dist_format) if generated_exec_path.exists() and config.exe_dir: - if sys.platform == "darwin": - shutil.copytree(generated_exec_path, config.exe_dir / (config.title + EXE_FORMAT), + if sys.platform == "darwin" or config.mode == DesktopConfig.NuitkaMode.STANDALONE: + shutil.copytree(generated_exec_path, config.exe_dir / (config.title + dist_format), dirs_exist_ok=True) else: shutil.copy(generated_exec_path, config.exe_dir) print("[DEPLOY] Executed file created in " - f"{str(config.exe_dir / (config.source_file.stem + EXE_FORMAT))}") + f"{str(config.exe_dir / (config.source_file.stem + dist_format))}") diff --git a/sources/pyside-tools/deploy_lib/nuitka_helper.py b/sources/pyside-tools/deploy_lib/nuitka_helper.py index d202db25e..06dba84f5 100644 --- a/sources/pyside-tools/deploy_lib/nuitka_helper.py +++ b/sources/pyside-tools/deploy_lib/nuitka_helper.py @@ -1,13 +1,17 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations +# enables to use typehints for classes that has not been defined yet or imported +# used for resolving circular imports +from __future__ import annotations import logging import os import sys from pathlib import Path -from typing import List from . import MAJOR_VERSION, run_command +from .config import DesktopConfig class Nuitka: @@ -35,6 +39,12 @@ class Nuitka: "generic" # plugins that error with Nuitka ] + # .webp are considered to be dlls by Nuitka instead of data files causing + # the packaging to fail + # https://github.com/Nuitka/Nuitka/issues/2854 + # TODO: Remove .webp when the issue is fixed + self.files_to_ignore = [".cpp.o", ".qsb", ".webp"] + @staticmethod def icon_option(): if sys.platform == "linux": @@ -44,12 +54,14 @@ class Nuitka: else: return "--macos-app-icon" - def create_executable(self, source_file: Path, extra_args: str, qml_files: List[Path], - qt_plugins: List[str], excluded_qml_plugins: List[str], icon: str, - dry_run: bool, permissions: List[str]): + def create_executable(self, source_file: Path, extra_args: str, qml_files: list[Path], + qt_plugins: list[str], excluded_qml_plugins: list[str], icon: str, + dry_run: bool, permissions: list[str], + mode: DesktopConfig.NuitkaMode): qt_plugins = [plugin for plugin in qt_plugins if plugin not in self.qt_plugins_to_ignore] extra_args = extra_args.split() + # macOS uses the --standalone option by default to create an app bundle if sys.platform == "darwin": # create an app bundle extra_args.extend(["--standalone", "--macos-create-app-bundle"]) @@ -57,7 +69,7 @@ class Nuitka: for permission in permissions: extra_args.append(permission_pattern.format(permission=permission)) else: - extra_args.append("--onefile") + extra_args.append(f"--{mode.value}") qml_args = [] if qml_files: @@ -81,6 +93,14 @@ class Nuitka: dll_name = plugin.replace("Qt", f"Qt{MAJOR_VERSION}") qml_args.append(f"--noinclude-dlls={prefix}{dll_name}*") + # Exclude .qen json files from QtQuickEffectMaker + # These files are not relevant for PySide6 applications + qml_args.append("--noinclude-dlls=*/qml/QtQuickEffectMaker/*") + + # Exclude files that cannot be processed by Nuitka + for file in self.files_to_ignore: + extra_args.append(f"--noinclude-dlls=*{file}") + output_dir = source_file.parent / "deployment" if not dry_run: output_dir.mkdir(parents=True, exist_ok=True) diff --git a/sources/pyside-tools/deploy_lib/python_helper.py b/sources/pyside-tools/deploy_lib/python_helper.py index 7cbf323ed..f234f9378 100644 --- a/sources/pyside-tools/deploy_lib/python_helper.py +++ b/sources/pyside-tools/deploy_lib/python_helper.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import logging import os diff --git a/sources/pyside-tools/metaobjectdump.py b/sources/pyside-tools/metaobjectdump.py index 0970f9974..bab4e1c46 100644 --- a/sources/pyside-tools/metaobjectdump.py +++ b/sources/pyside-tools/metaobjectdump.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import ast import json @@ -8,7 +9,7 @@ import sys import tokenize from argparse import ArgumentParser, RawTextHelpFormatter from pathlib import Path -from typing import Dict, List, Optional, Set, Tuple, Union +from typing import Union DESCRIPTION = """Parses Python source code to create QObject metatype @@ -38,32 +39,38 @@ ITEM_MODELS = ["QAbstractListModel", "QAbstractProxyModel", QOBJECT_DERIVED = ["QObject", "QQuickItem", "QQuickPaintedItem"] + ITEM_MODELS +# Python 3.9 does not support this syntax, yet +# AstDecorator = ast.Name | ast.Call +# AstPySideTypeSpec = ast.Name | ast.Constant AstDecorator = Union[ast.Name, ast.Call] AstPySideTypeSpec = Union[ast.Name, ast.Constant] -ClassList = List[dict] +ClassList = list[dict] -PropertyEntry = Dict[str, Union[str, int, bool]] +# PropertyEntry = dict[str, str | int | bool] +PropertyEntry = dict[str, Union[str, int, bool]] -Argument = Dict[str, str] -Arguments = List[Argument] -Signal = Dict[str, Union[str, Arguments]] -Slot = Dict[str, Union[str, Arguments]] +Argument = dict[str, str] +Arguments = list[Argument] +# Signal = dict[str, str | Arguments] +# Slot = dict[str, str | Arguments] +Signal = dict[str, Union[str, Arguments]] +Slot = dict[str, Union[str, Arguments]] -def _decorator(name: str, value: str) -> Dict[str, str]: +def _decorator(name: str, value: str) -> dict[str, str]: """Create a QML decorator JSON entry""" return {"name": name, "value": value} -def _attribute(node: ast.Attribute) -> Tuple[str, str]: +def _attribute(node: ast.Attribute) -> tuple[str, str]: """Split an attribute.""" return node.value.id, node.attr -def _name(node: Union[ast.Name, ast.Attribute]) -> str: +def _name(node: ast.Name | ast.Attribute) -> str: """Return the name of something that is either an attribute or a name, such as base classes or call.func""" if isinstance(node, ast.Attribute): @@ -82,14 +89,14 @@ def _python_to_cpp_type(type: str) -> str: return c if c else type -def _parse_property_kwargs(keywords: List[ast.keyword], prop: PropertyEntry): +def _parse_property_kwargs(keywords: list[ast.keyword], prop: PropertyEntry): """Parse keyword arguments of @Property""" for k in keywords: if k.arg == "notify": prop["notify"] = _name(k.value) -def _parse_assignment(node: ast.Assign) -> Tuple[Optional[str], Optional[ast.AST]]: +def _parse_assignment(node: ast.Assign) -> tuple[str | None, ast.AST | None]: """Parse an assignment and return a tuple of name, value.""" if len(node.targets) == 1 and isinstance(node.targets[0], ast.Name): var_name = node.targets[0].id @@ -144,10 +151,10 @@ class MetaObjectDumpVisitor(ast.NodeVisitor): self._context = context self._json_class_list: ClassList = [] # Property by name, which will be turned into the JSON List later - self._properties: List[PropertyEntry] = [] - self._signals: List[Signal] = [] + self._properties: list[PropertyEntry] = [] + self._signals: list[Signal] = [] self._within_class: bool = False - self._qt_modules: Set[str] = set() + self._qt_modules: set[str] = set() self._qml_import_name = "" self._qml_import_major_version = 0 self._qml_import_minor_version = 0 @@ -158,7 +165,7 @@ class MetaObjectDumpVisitor(ast.NodeVisitor): def qml_import_name(self) -> str: return self._qml_import_name - def qml_import_version(self) -> Tuple[int, int]: + def qml_import_version(self) -> tuple[int, int]: return (self._qml_import_major_version, self._qml_import_minor_version) def qt_modules(self): @@ -215,7 +222,7 @@ class MetaObjectDumpVisitor(ast.NodeVisitor): if bases: data["superClasses"] = bases - class_decorators: List[dict] = [] + class_decorators: list[dict] = [] for d in node.decorator_list: self._parse_class_decorator(d, class_decorators) @@ -247,7 +254,7 @@ class MetaObjectDumpVisitor(ast.NodeVisitor): self._parse_function_decorator(node.name, d) def _parse_class_decorator(self, node: AstDecorator, - class_decorators: List[dict]): + class_decorators: list[dict]): """Parse ClassInfo decorators.""" if isinstance(node, ast.Call): name = _func_name(node) @@ -298,7 +305,7 @@ class MetaObjectDumpVisitor(ast.NodeVisitor): return -1 def _create_property_entry(self, name: str, type: str, - getter: Optional[str] = None) -> PropertyEntry: + getter: str | None = None) -> PropertyEntry: """Create a property JSON entry.""" result: PropertyEntry = {"name": name, "type": type, "index": len(self._properties)} @@ -390,7 +397,7 @@ def create_arg_parser(desc: str) -> ArgumentParser: def parse_file(file: Path, context: VisitorContext, - suppress_file: bool = False) -> Optional[Dict]: + suppress_file: bool = False) -> dict | None: """Parse a file and return its json data""" ast_tree = MetaObjectDumpVisitor.create_ast(file) visitor = MetaObjectDumpVisitor(context) diff --git a/sources/pyside-tools/project.py b/sources/pyside-tools/project.py index 3706a2985..3821c5f2e 100644 --- a/sources/pyside-tools/project.py +++ b/sources/pyside-tools/project.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ @@ -21,7 +22,6 @@ handled per project file. """ import sys import os -from typing import List, Tuple, Optional from pathlib import Path from argparse import ArgumentParser, RawTextHelpFormatter @@ -57,7 +57,7 @@ NEW_PROJECT_TYPES = {"new-quick": ProjectType.QUICK, "new-widget": ProjectType.WIDGET} -def _sort_sources(files: List[Path]) -> List[Path]: +def _sort_sources(files: list[Path]) -> list[Path]: """Sort the sources for building, ensure .qrc is last since it might depend on generated files.""" @@ -76,9 +76,9 @@ class Project: self.cl_options = ClOptions() # Files for QML modules using the QmlElement decorators - self._qml_module_sources: List[Path] = [] - self._qml_module_dir: Optional[Path] = None - self._qml_dir_file: Optional[Path] = None + self._qml_module_sources: list[Path] = [] + self._qml_module_dir: Path | None = None + self._qml_dir_file: Path | None = None self._qml_project_data = QmlProjectData() self._qml_module_check() @@ -113,7 +113,7 @@ class Project: print(f"{self.project.project_file.name}, {count} QML file(s)," f" {self._qml_project_data}") - def _get_artifacts(self, file: Path) -> Tuple[List[Path], Optional[List[str]]]: + def _get_artifacts(self, file: Path) -> tuple[list[Path], list[str] | None]: """Return path and command for a file's artifact""" if file.suffix == ".ui": # Qt form files py_file = f"{file.parent}/ui_{file.stem}.py" diff --git a/sources/pyside-tools/project/__init__.py b/sources/pyside-tools/project/__init__.py index e57a9ff88..926a1fc9a 100644 --- a/sources/pyside-tools/project/__init__.py +++ b/sources/pyside-tools/project/__init__.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from dataclasses import dataclass diff --git a/sources/pyside-tools/project/newproject.py b/sources/pyside-tools/project/newproject.py index c363a9fc0..80ed5a75e 100644 --- a/sources/pyside-tools/project/newproject.py +++ b/sources/pyside-tools/project/newproject.py @@ -1,17 +1,17 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import json import os import sys from enum import Enum from pathlib import Path -from typing import List, Tuple """New project generation code.""" -Project = List[Tuple[str, str]] # tuple of (filename, contents). +Project = list[tuple[str, str]] # tuple of (filename, contents). class ProjectType(Enum): diff --git a/sources/pyside-tools/project/project_data.py b/sources/pyside-tools/project/project_data.py index 52e20be3f..20a8daef1 100644 --- a/sources/pyside-tools/project/project_data.py +++ b/sources/pyside-tools/project/project_data.py @@ -1,11 +1,11 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import json import os import subprocess import sys -from typing import List, Tuple from pathlib import Path from . import (METATYPES_JSON_SUFFIX, PROJECT_FILE_SUFFIX, TRANSLATION_SUFFIX, qt_metatype_json_dir, MOD_CMD, QML_IMPORT_MAJOR_VERSION, @@ -21,21 +21,21 @@ class ProjectData: def __init__(self, project_file: Path) -> None: """Parse the project.""" self._project_file = project_file - self._sub_projects_files: List[Path] = [] + self._sub_projects_files: list[Path] = [] # All sources except subprojects - self._files: List[Path] = [] + self._files: list[Path] = [] # QML files - self._qml_files: List[Path] = [] + self._qml_files: list[Path] = [] # Python files self.main_file: Path = None - self._python_files: List[Path] = [] + self._python_files: list[Path] = [] # ui files - self._ui_files: List[Path] = [] + self._ui_files: list[Path] = [] # qrc files - self._qrc_files: List[Path] = [] + self._qrc_files: list[Path] = [] # ts files - self._ts_files: List[Path] = [] + self._ts_files: list[Path] = [] with project_file.open("r") as pyf: pyproject = json.load(pyf) @@ -128,7 +128,7 @@ class QmlProjectData: self._import_name: str = "" self._import_major_version: int = 0 self._import_minor_version: int = 0 - self._qt_modules: List[str] = [] + self._qt_modules: list[str] = [] def registrar_options(self): result = [ @@ -141,7 +141,7 @@ class QmlProjectData: ] if self._qt_modules: # Add Qt modules as foreign types - foreign_files: List[str] = [] + foreign_files: list[str] = [] meta_dir = qt_metatype_json_dir() for mod in self._qt_modules: mod_id = mod[2:].lower() @@ -198,7 +198,7 @@ class QmlProjectData: return len(self._import_name) > 0 and self._import_major_version > 0 -def _has_qml_decorated_class(class_list: List) -> bool: +def _has_qml_decorated_class(class_list: list) -> bool: """Check for QML-decorated classes in the moc json output.""" for d in class_list: class_infos = d.get("classInfos") @@ -209,7 +209,7 @@ def _has_qml_decorated_class(class_list: List) -> bool: return False -def check_qml_decorators(py_file: Path) -> Tuple[bool, QmlProjectData]: +def check_qml_decorators(py_file: Path) -> tuple[bool, QmlProjectData]: """Check if a Python file has QML-decorated classes by running a moc check and return whether a class was found and the QML data.""" data = None diff --git a/sources/pyside-tools/project/utils.py b/sources/pyside-tools/project/utils.py index d2bff65af..a2d91375b 100644 --- a/sources/pyside-tools/project/utils.py +++ b/sources/pyside-tools/project/utils.py @@ -1,15 +1,15 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys import subprocess from pathlib import Path -from typing import List, Dict, Optional from . import QTPATHS_CMD, PROJECT_FILE_SUFFIX, ClOptions -def run_command(command: List[str], cwd: str = None, ignore_fail: bool = False): +def run_command(command: list[str], cwd: str = None, ignore_fail: bool = False): """Run a command observing quiet/dry run""" cloptions = ClOptions() if not cloptions.quiet or cloptions.dry_run: @@ -20,7 +20,7 @@ def run_command(command: List[str], cwd: str = None, ignore_fail: bool = False): sys.exit(ex) -def requires_rebuild(sources: List[Path], artifact: Path) -> bool: +def requires_rebuild(sources: list[Path], artifact: Path) -> bool: """Returns whether artifact needs to be rebuilt depending on sources""" if not artifact.is_file(): return True @@ -58,10 +58,10 @@ def package_dir() -> Path: return Path(__file__).resolve().parents[2] -_qtpaths_info: Dict[str, str] = {} +_qtpaths_info: dict[str, str] = {} -def qtpaths() -> Dict[str, str]: +def qtpaths() -> dict[str, str]: """Run qtpaths and return a dict of values.""" global _qtpaths_info if not _qtpaths_info: @@ -73,7 +73,7 @@ def qtpaths() -> Dict[str, str]: return _qtpaths_info -_qt_metatype_json_dir: Optional[Path] = None +_qt_metatype_json_dir: Path | None = None def qt_metatype_json_dir() -> Path: @@ -95,7 +95,7 @@ def qt_metatype_json_dir() -> Path: return _qt_metatype_json_dir -def resolve_project_file(cmdline: str) -> Optional[Path]: +def resolve_project_file(cmdline: str) -> Path | None: """Return the project file from the command line value, either from the file argument or directory""" project_file = Path(cmdline).resolve() if cmdline else Path.cwd() diff --git a/sources/pyside-tools/pyside_tool.py b/sources/pyside-tools/pyside_tool.py index b369be8a2..47283516c 100644 --- a/sources/pyside-tools/pyside_tool.py +++ b/sources/pyside-tools/pyside_tool.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import importlib import os @@ -214,8 +215,9 @@ def deploy(): def android_deploy(): - if not sys.platform == "linux": - print("pyside6-android-deploy only works from a Linux host") + if sys.platform == "win32": + print("pyside6-android-deploy only works from a Unix host and not a Windows host", + file=sys.stderr) else: android_requirements_file = Path(__file__).parent / "requirements-android.txt" with open(android_requirements_file, 'r', encoding='UTF-8') as file: diff --git a/sources/pyside-tools/qml.py b/sources/pyside-tools/qml.py index 5d029f93d..d36e86347 100644 --- a/sources/pyside-tools/qml.py +++ b/sources/pyside-tools/qml.py @@ -1,5 +1,6 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """pyside6-qml tool implementation. This tool mimics the capabilities of qml runtime utility for python and enables quick protyping with python modules""" @@ -11,7 +12,6 @@ import sys import os from pathlib import Path from pprint import pprint -from typing import List, Set from PySide6.QtCore import QCoreApplication, Qt, QLibraryInfo, QUrl, SignalInstance from PySide6.QtGui import QGuiApplication, QSurfaceFormat @@ -20,7 +20,7 @@ from PySide6.QtQuick import QQuickView, QQuickItem from PySide6.QtWidgets import QApplication -def import_qml_modules(qml_parent_path: Path, module_paths: List[Path] = []): +def import_qml_modules(qml_parent_path: Path, module_paths: list[Path] = []): ''' Import all the python modules in the qml_parent_path. This way all the classes containing the @QmlElement/@QmlNamedElement are also imported @@ -42,7 +42,7 @@ def import_qml_modules(qml_parent_path: Path, module_paths: List[Path] = []): elif module_path.exists() and module_path.suffix == ".py": search_file_paths.append(module_path) - def import_module(import_module_paths: Set[Path]): + def import_module(import_module_paths: set[Path]): """Import the modules in 'import_module_paths'""" for module_path in import_module_paths: module_name = module_path.name[:-3] diff --git a/sources/pyside-tools/qtpy2cpp.py b/sources/pyside-tools/qtpy2cpp.py index 857b12b67..bed933cab 100644 --- a/sources/pyside-tools/qtpy2cpp.py +++ b/sources/pyside-tools/qtpy2cpp.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import logging import os diff --git a/sources/pyside-tools/qtpy2cpp_lib/astdump.py b/sources/pyside-tools/qtpy2cpp_lib/astdump.py index d92fb7589..469b0368a 100644 --- a/sources/pyside-tools/qtpy2cpp_lib/astdump.py +++ b/sources/pyside-tools/qtpy2cpp_lib/astdump.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """Tool to dump a Python AST""" diff --git a/sources/pyside-tools/qtpy2cpp_lib/formatter.py b/sources/pyside-tools/qtpy2cpp_lib/formatter.py index 9a38e803d..ad4903717 100644 --- a/sources/pyside-tools/qtpy2cpp_lib/formatter.py +++ b/sources/pyside-tools/qtpy2cpp_lib/formatter.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """C++ formatting helper functions and formatter class""" diff --git a/sources/pyside-tools/qtpy2cpp_lib/nodedump.py b/sources/pyside-tools/qtpy2cpp_lib/nodedump.py index de62e9700..c101f1fdf 100644 --- a/sources/pyside-tools/qtpy2cpp_lib/nodedump.py +++ b/sources/pyside-tools/qtpy2cpp_lib/nodedump.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """Helper to dump AST nodes for debugging""" diff --git a/sources/pyside-tools/qtpy2cpp_lib/qt.py b/sources/pyside-tools/qtpy2cpp_lib/qt.py index 69bd54aeb..4827a09ac 100644 --- a/sources/pyside-tools/qtpy2cpp_lib/qt.py +++ b/sources/pyside-tools/qtpy2cpp_lib/qt.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """Provides some type information on Qt classes""" diff --git a/sources/pyside-tools/qtpy2cpp_lib/tests/baseline/basic_test.py b/sources/pyside-tools/qtpy2cpp_lib/tests/baseline/basic_test.py index 1466ac6b1..62805cd15 100644 --- a/sources/pyside-tools/qtpy2cpp_lib/tests/baseline/basic_test.py +++ b/sources/pyside-tools/qtpy2cpp_lib/tests/baseline/basic_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import sys diff --git a/sources/pyside-tools/qtpy2cpp_lib/tests/test_qtpy2cpp.py b/sources/pyside-tools/qtpy2cpp_lib/tests/test_qtpy2cpp.py index 894b2a958..73dbd2e58 100644 --- a/sources/pyside-tools/qtpy2cpp_lib/tests/test_qtpy2cpp.py +++ b/sources/pyside-tools/qtpy2cpp_lib/tests/test_qtpy2cpp.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import subprocess import tempfile diff --git a/sources/pyside-tools/qtpy2cpp_lib/tokenizer.py b/sources/pyside-tools/qtpy2cpp_lib/tokenizer.py index d5e26c2a8..4f81ba5a2 100644 --- a/sources/pyside-tools/qtpy2cpp_lib/tokenizer.py +++ b/sources/pyside-tools/qtpy2cpp_lib/tokenizer.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """Tool to dump Python Tokens""" diff --git a/sources/pyside-tools/qtpy2cpp_lib/visitor.py b/sources/pyside-tools/qtpy2cpp_lib/visitor.py index 2056951ae..e3f39e997 100644 --- a/sources/pyside-tools/qtpy2cpp_lib/visitor.py +++ b/sources/pyside-tools/qtpy2cpp_lib/visitor.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """AST visitor printing out C++""" diff --git a/sources/pyside6/PySide6/QtAsyncio/__init__.py b/sources/pyside6/PySide6/QtAsyncio/__init__.py index 4baa8134e..08332f621 100644 --- a/sources/pyside6/PySide6/QtAsyncio/__init__.py +++ b/sources/pyside6/PySide6/QtAsyncio/__init__.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from .events import ( QAsyncioEventLoopPolicy, QAsyncioEventLoop, QAsyncioHandle, QAsyncioTimerHandle @@ -28,8 +29,8 @@ def run(coro: typing.Optional[typing.Coroutine] = None, # subsequent removal in Python 3.15. At that point, part of the current # logic of the QAsyncioEventLoopPolicy constructor will have to be moved # here and/or to a loop factory class (to be provided as an argument to - # asyncio.run()), namely setting up the QCoreApplication and the SIGINT - # handler. + # asyncio.run()). In particular, this concerns the logic of setting up the + # QCoreApplication and the SIGINT handler. # # More details: # https://discuss.python.org/t/removing-the-asyncio-policy-system-asyncio-set-event-loop-policy-in-python-3-15/37553 # noqa: E501 diff --git a/sources/pyside6/PySide6/QtAsyncio/events.py b/sources/pyside6/PySide6/QtAsyncio/events.py index b87d7a309..1f838226d 100644 --- a/sources/pyside6/PySide6/QtAsyncio/events.py +++ b/sources/pyside6/PySide6/QtAsyncio/events.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from PySide6.QtCore import (QCoreApplication, QDateTime, QDeadlineTimer, QEventLoop, QObject, QTimer, QThread, Slot) @@ -50,17 +51,24 @@ class QAsyncioExecutorWrapper(QObject): def _cb(self): try: - # Call the synchronous callable that we submitted with submit() or map(). + # Call the synchronous callable that we submitted with submit() or + # map(). self._result = self._func(*self._args) except BaseException as e: self._exception = e self._loop.exit() def do(self): - # This creates a new event loop and dispatcher for the thread, if not already created. + # This creates a new event loop and dispatcher for the thread, if not + # already created. self._loop = QEventLoop() asyncio.events._set_running_loop(self._loop) - QTimer.singleShot(0, self._loop, lambda: self._cb()) + + # The do() function will always be executed from the new executor + # thread and never from outside, so using the overload without the + # context argument is sufficient. + QTimer.singleShot(0, lambda: self._cb()) + self._loop.exec() if self._exception is not None: raise self._exception @@ -656,19 +664,24 @@ class QAsyncioHandle(): self._state = QAsyncioHandle.HandleState.PENDING self._start() + def _start(self) -> None: + self._schedule_event(self._timeout, lambda: self._cb()) + def _schedule_event(self, timeout: int, func: typing.Callable) -> None: # Do not schedule events from asyncio when the app is quit from outside # the event loop, as this would cause events to be enqueued after the # event loop was destroyed. if not self._loop.is_closed() and not self._loop._quit_from_outside: if self._is_threadsafe: + # This singleShot overload will push func into self._loop + # instead of the current thread's loop. This allows scheduling + # a callback from a different thread, which is necessary for + # thread-safety. + # https://docs.python.org/3/library/asyncio-dev.html#asyncio-multithreading QTimer.singleShot(timeout, self._loop, func) else: QTimer.singleShot(timeout, func) - def _start(self) -> None: - self._schedule_event(self._timeout, lambda: self._cb()) - @Slot() def _cb(self) -> None: """ diff --git a/sources/pyside6/PySide6/QtAsyncio/futures.py b/sources/pyside6/PySide6/QtAsyncio/futures.py index 611bd5634..29d86ad3c 100644 --- a/sources/pyside6/PySide6/QtAsyncio/futures.py +++ b/sources/pyside6/PySide6/QtAsyncio/futures.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from . import events @@ -36,10 +37,11 @@ class QAsyncioFuture(): self._result: typing.Any = None self._exception: typing.Optional[BaseException] = None - self._callbacks: typing.List[typing.Callable] = list() - self._cancel_message: typing.Optional[str] = None + # List of callbacks that are called when the future is done. + self._callbacks: typing.List[typing.Callable] = list() + def __await__(self): if not self.done(): self._asyncio_future_blocking = True @@ -51,6 +53,7 @@ class QAsyncioFuture(): __iter__ = __await__ def _schedule_callbacks(self, context: typing.Optional[contextvars.Context] = None): + """ A future can optionally have callbacks that are called when the future is done. """ for cb in self._callbacks: self._loop.call_soon( cb, self, context=context if context else self._context) diff --git a/sources/pyside6/PySide6/QtAsyncio/tasks.py b/sources/pyside6/PySide6/QtAsyncio/tasks.py index c04006686..9b6b2c22b 100644 --- a/sources/pyside6/PySide6/QtAsyncio/tasks.py +++ b/sources/pyside6/PySide6/QtAsyncio/tasks.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from . import events from . import futures @@ -20,17 +21,22 @@ class QAsyncioTask(futures.QAsyncioFuture): context: typing.Optional[contextvars.Context] = None) -> None: super().__init__(loop=loop, context=context) - self._coro = coro + self._coro = coro # The coroutine for which this task was created. self._name = name if name else "QtTask" + # The task creates a handle for its coroutine. The handle enqueues the + # task's step function as its callback in the event loop. self._handle = self._loop.call_soon(self._step, context=self._context) - self._cancellation_requests = 0 - + # The task step function executes the coroutine until it finishes, + # raises an exception or returns a future. If a future was returned, + # the task will await its completion (or exception). self._future_to_await: typing.Optional[asyncio.Future] = None - self._cancel_message: typing.Optional[str] = None + self._cancelled = False + self._cancel_message: typing.Optional[str] = None + # https://docs.python.org/3/library/asyncio-extending.html#task-lifetime-support asyncio._register_task(self) # type: ignore[arg-type] def __repr__(self) -> str: @@ -59,6 +65,14 @@ class QAsyncioTask(futures.QAsyncioFuture): def _step(self, exception_or_future: typing.Union[ BaseException, futures.QAsyncioFuture, None] = None) -> None: + """ + The step function is the heart of a task. It is scheduled in the event + loop repeatedly, executing the coroutine "step" by "step" (i.e., + iterating through the asynchronous generator) until it finishes with an + exception or successfully. Each step can optionally receive an + exception or a future as a result from a previous step to handle. + """ + if self.done(): return result = None @@ -72,7 +86,15 @@ class QAsyncioTask(futures.QAsyncioFuture): try: asyncio._enter_task(self._loop, self) # type: ignore[arg-type] + + # It is at this point that the coroutine is resumed for the current + # step (i.e. asynchronous generator iteration). It will now be + # executed until it yields (and potentially returns a future), + # raises an exception, is cancelled, or finishes successfully. + if isinstance(exception_or_future, BaseException): + # If the coroutine doesn't handle this exception, it propagates + # to the caller. result = self._coro.throw(exception_or_future) else: result = self._coro.send(None) @@ -87,6 +109,9 @@ class QAsyncioTask(futures.QAsyncioFuture): self._exception = e else: if asyncio.futures.isfuture(result): + # If the coroutine yields a future, the task will await its + # completion, and at that point the step function will be + # called again. result.add_done_callback( self._step, context=self._context) # type: ignore[arg-type] self._future_to_await = result @@ -100,12 +125,16 @@ class QAsyncioTask(futures.QAsyncioFuture): # very quickly. self._future_to_await.cancel(self._cancel_message) elif result is None: + # If no future was yielded, we schedule the step function again + # without any arguments. self._loop.call_soon(self._step, context=self._context) else: + # This is not supposed to happen. exception = RuntimeError(f"Bad task result: {result}") self._loop.call_soon(self._step, exception, context=self._context) finally: asyncio._leave_task(self._loop, self) # type: ignore[arg-type] + if self._exception: self._loop.call_exception_handler({ "message": (str(self._exception) if self._exception @@ -117,8 +146,11 @@ class QAsyncioTask(futures.QAsyncioFuture): if asyncio.futures.isfuture(exception_or_future) else None) }) + if self.done(): self._schedule_callbacks() + + # https://docs.python.org/3/library/asyncio-extending.html#task-lifetime-support asyncio._unregister_task(self) # type: ignore[arg-type] def get_stack(self, *, limit=None) -> typing.List[typing.Any]: @@ -144,6 +176,8 @@ class QAsyncioTask(futures.QAsyncioFuture): self._cancel_message = msg self._handle.cancel() if self._future_to_await is not None: + # A task that is awaiting a future must also cancel this future in + # order for the cancellation to be successful. self._future_to_await.cancel(msg) self._cancelled = True return True diff --git a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml index 9b306c088..110f86f25 100644 --- a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml +++ b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml @@ -1289,6 +1289,7 @@ qRegisterMetaType<QList<QPersistentModelIndex> >("QList_QPersistentModelIndex"); </inject-code> <modify-function signature="internalPointer()const"> + <modify-argument index="return" pyi-type="Any"/> <inject-code class="target" position="beginning"> <insert-template name="return_internal_pointer" /> </inject-code> @@ -1677,8 +1678,9 @@ <add-function signature="operator==(const QItemSelection&)" return-type="bool"/> <add-function signature="operator!=(const QItemSelection&)" return-type="bool"/> <!-- For some reason, the empty selection is not seen. Maybe related to the new [default] - tag in Qt6? --> - <declare-function signature="QItemSelection()" return-type="QItemSelection" /> + tag in Qt6? + PYSIDE-2756: The return-type attribute is unnecessary --> + <declare-function signature="QItemSelection()"/> <!-- The __add__ function creates a result list, instead of using the inherited type. Fixed by adding with the correct type. --> <add-function signature="operator+(QItemSelection)" return-type="QItemSelection"> @@ -1759,9 +1761,6 @@ </modify-function> <!-- End of Invalidate-after-use fix --> <modify-function signature="parent()const"> - <modify-argument index="this"> - <parent index="return" action="add"/> - </modify-argument> <modify-argument index="return"> <define-ownership class="target" owner="default"/> </modify-argument> @@ -3108,6 +3107,7 @@ </object-type> <value-type name="QModelIndex"> <modify-function signature="internalPointer()const"> + <modify-argument index="return" pyi-type="Any"/> <inject-code class="target" position="beginning"> <insert-template name="return_internal_pointer" /> </inject-code> diff --git a/sources/pyside6/PySide6/QtGui/CMakeLists.txt b/sources/pyside6/PySide6/QtGui/CMakeLists.txt index 7cd7871f3..c868b6c88 100644 --- a/sources/pyside6/PySide6/QtGui/CMakeLists.txt +++ b/sources/pyside6/PySide6/QtGui/CMakeLists.txt @@ -88,6 +88,7 @@ ${QtGui_GEN_DIR}/qaccessibleactioninterface_wrapper.cpp ${QtGui_GEN_DIR}/qaccessibleeditabletextinterface_wrapper.cpp ${QtGui_GEN_DIR}/qaccessibleevent_wrapper.cpp ${QtGui_GEN_DIR}/qaccessibleobject_wrapper.cpp +${QtGui_GEN_DIR}/qaccessibleselectioninterface_wrapper.cpp ${QtGui_GEN_DIR}/qaccessiblestatechangeevent_wrapper.cpp ${QtGui_GEN_DIR}/qaccessibletablecellinterface_wrapper.cpp ${QtGui_GEN_DIR}/qaccessibletablemodelchangeevent_wrapper.cpp @@ -312,6 +313,15 @@ set(QtGui_private_include_dirs ${Qt${QT_MAJOR_VERSION}Core_PRIVATE_INCLUDE_DIRS} ${Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS}) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") + if (QT_FEATURE_opengles2) + # add openGL ES 2.0 + find_package(GLESv2 REQUIRED) + else() + message(FATAL_ERROR "QtGui requires OpenGL ES 2.0 on Android") + endif() +endif() + configure_file("${QtGui_SOURCE_DIR}/QtGui_global.post.h.in" "${QtGui_BINARY_DIR}/QtGui_global.post.h" @ONLY) diff --git a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml index 3eee63ba4..feb2dc11b 100644 --- a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml +++ b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml @@ -122,6 +122,7 @@ <object-type name="QAccessibleEditableTextInterface"/> <object-type name="QAccessibleInterface"/> <object-type name="QAccessibleObject" qt-register-metatype="base"/> + <object-type name="QAccessibleSelectionInterface" since="6.7"/> <object-type name="QAccessibleTableCellInterface"/> <object-type name="QAccessibleTextInterface"/> <object-type name="QAccessibleValueInterface"/> diff --git a/sources/pyside6/PySide6/QtNetwork/typesystem_network.xml b/sources/pyside6/PySide6/QtNetwork/typesystem_network.xml index 508043626..4dc7c9b0a 100644 --- a/sources/pyside6/PySide6/QtNetwork/typesystem_network.xml +++ b/sources/pyside6/PySide6/QtNetwork/typesystem_network.xml @@ -179,6 +179,11 @@ <modify-function signature="put(const QNetworkRequest &,QIODevice*)" allow-thread="yes"/> <modify-function signature="put(const QNetworkRequest &,const QByteArray &)" allow-thread="yes"/> <modify-function signature="sendCustomRequest(const QNetworkRequest &,const QByteArray &,QIODevice*)" allow-thread="yes" since="4.7"/> + <modify-function signature="setCache(QAbstractNetworkCache*)"> + <modify-argument index="1"> + <define-ownership class="target" owner="c++"/> + </modify-argument> + </modify-function> <modify-function signature="setCookieJar(QNetworkCookieJar*)"> <modify-argument index="1"> <define-ownership class="target" owner="c++"/> diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp b/sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp index 52a45e026..2cab76b47 100644 --- a/sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp +++ b/sources/pyside6/PySide6/QtQml/pysideqmlvolatilebool.cpp @@ -5,6 +5,7 @@ #include <pep384ext.h> #include <signature.h> +#include <sbktypefactory.h> #include <QtCore/QDebug> @@ -49,7 +50,10 @@ static void QtQml_VolatileBoolObject_dealloc(PyObject *self) static PyObject * QtQml_VolatileBoolObject_get(QtQml_VolatileBoolObject *self) { - return *self->flag ? Py_True : Py_False; + if (*self->flag) { + Py_RETURN_TRUE; + } + Py_RETURN_FALSE; } static PyObject * diff --git a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml index 6a739bbdf..3392ef379 100644 --- a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml +++ b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml @@ -124,9 +124,12 @@ <function signature="qmlProtectModule(const char*,int)" doc-file="qqmlengine"/> <function signature="qmlRegisterModule(const char*,int,int)" doc-file="qqmlengine"/> <function signature="qmlTypeId(const char*,int,int,const char*)" doc-file="qqmlengine"/> - <function signature="qmlRegisterType(const QUrl &,const char *,int,int,const char *)"/> - <function signature="qmlRegisterSingletonType(const QUrl &,const char *,int,int,const char *)"/> - <function signature="qmlRegisterUncreatableMetaObject(const QMetaObject&,const char*,int,int, const char*,const QString&)"/> + <function signature="qmlRegisterType(const QUrl &,const char *,int,int,const char *)" + doc-file="qqmlengine"/> + <function signature="qmlRegisterSingletonType(const QUrl &,const char *,int,int,const char *)" + doc-file="qqmlengine"/> + <function signature="qmlRegisterUncreatableMetaObject(const QMetaObject&,const char*,int,int, const char*,const QString&)" + doc-file="qqmlengine"/> <enum-type identified-by-value="QML_HAS_ATTACHED_PROPERTIES"> <extra-includes> diff --git a/sources/pyside6/PySide6/QtWebEngineQuick/CMakeLists.txt b/sources/pyside6/PySide6/QtWebEngineQuick/CMakeLists.txt index 5aedc1147..d87dc55a4 100644 --- a/sources/pyside6/PySide6/QtWebEngineQuick/CMakeLists.txt +++ b/sources/pyside6/PySide6/QtWebEngineQuick/CMakeLists.txt @@ -14,17 +14,26 @@ set(QtWebEngineQuick_include_dirs ${QtWebEngineQuick_SOURCE_DIR} ${QtWebEngineQuick_BINARY_DIR} ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS} + ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS} + ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS} ${Qt${QT_MAJOR_VERSION}Network_INCLUDE_DIRS} + ${Qt${QT_MAJOR_VERSION}PrintSupport_INCLUDE_DIRS} ${Qt${QT_MAJOR_VERSION}Qml_INCLUDE_DIRS} + ${Qt${QT_MAJOR_VERSION}WebChannel_INCLUDE_DIRS} ${libpyside_SOURCE_DIR} ${QtCore_GEN_DIR} + ${QtGui_GEN_DIR} + ${QtWidgets_GEN_DIR} ${QtNetwork_GEN_DIR} - ${QtQml_GEN_DIR}) + ${QtWebEngineCore_GEN_DIR} + ${QtPrintSupport_GEN_DIR} + ${QtQml_GEN_DIR} + ${QtWebChannel_GEN_DIR}) set(QtWebEngineQuick_libraries pyside6 ${Qt${QT_MAJOR_VERSION}WebEngineQuick_LIBRARIES}) -set(QtWebEngineQuick_deps QtQml QtNetwork QtCore) +set(QtWebEngineQuick_deps QtQml QtWebEngineCore) create_pyside_module(NAME QtWebEngineQuick INCLUDE_DIRS QtWebEngineQuick_include_dirs diff --git a/sources/pyside6/PySide6/QtWebEngineQuick/typesystem_webenginequick.xml b/sources/pyside6/PySide6/QtWebEngineQuick/typesystem_webenginequick.xml index 108ba5fae..2e7d22334 100644 --- a/sources/pyside6/PySide6/QtWebEngineQuick/typesystem_webenginequick.xml +++ b/sources/pyside6/PySide6/QtWebEngineQuick/typesystem_webenginequick.xml @@ -6,6 +6,7 @@ <typesystem package="PySide6.QtWebEngineQuick" namespace-begin="QT_BEGIN_NAMESPACE" namespace-end="QT_END_NAMESPACE"> <load-typesystem name="QtQml/typesystem_qml.xml" generate="no"/> + <load-typesystem name="QtWebEngineCore/typesystem_webenginecore.xml" generate="no"/> <namespace-type name="QtWebEngineQuick"/> <!-- initialize() --> diff --git a/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml b/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml index 774f9dd64..b1188a514 100644 --- a/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside6/PySide6/QtWidgets/typesystem_widgets_common.xml @@ -2032,9 +2032,6 @@ </modify-function> <modify-function signature="parentWidget()const"> - <modify-argument index="this"> - <parent index="return" action="add"/> - </modify-argument> <modify-argument index="return"> <define-ownership class="target" owner="default"/> </modify-argument> diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp index a8afc9b6a..0c206db72 100644 --- a/sources/pyside6/PySide6/glue/qtcore.cpp +++ b/sources/pyside6/PySide6/glue/qtcore.cpp @@ -84,11 +84,9 @@ static PyObject *convertToPrimitiveType(const QVariant &out, int metaTypeId) return PyFloat_FromDouble(out.toFloat()); case QMetaType::Bool: if (out.toBool()) { - Py_INCREF(Py_True); - return Py_True; + Py_RETURN_TRUE; } - Py_INCREF(Py_False); - return Py_False; + Py_RETURN_FALSE; default: break; } @@ -1024,6 +1022,8 @@ void QSingleShotTimerFunctor::operator()() Shiboken::GilState state; Shiboken::AutoDecRef arglist(PyTuple_New(0)); Shiboken::AutoDecRef ret(PyObject_CallObject(object(), arglist)); + if (Shiboken::Errors::occurred()) + Shiboken::Errors::storeErrorOrPrint(); release(); // single shot } // @snippet qtimer-singleshot-functorclass diff --git a/sources/pyside6/PySide6/qtdatavisualization_helper.h b/sources/pyside6/PySide6/qtdatavisualization_helper.h index 6884900ee..8fee4492d 100644 --- a/sources/pyside6/PySide6/qtdatavisualization_helper.h +++ b/sources/pyside6/PySide6/qtdatavisualization_helper.h @@ -6,8 +6,8 @@ #include <sbkpython.h> -#include <QtDataVisualization/QSurfaceDataProxy> -#include <QtCore/QList> +#include <QtDataVisualization/qsurfacedataproxy.h> +#include <QtCore/qlist.h> namespace QtDataVisualizationHelper { diff --git a/sources/pyside6/PySide6/qtgraphs_helper.h b/sources/pyside6/PySide6/qtgraphs_helper.h index 726f5fb37..e488fc7d3 100644 --- a/sources/pyside6/PySide6/qtgraphs_helper.h +++ b/sources/pyside6/PySide6/qtgraphs_helper.h @@ -6,8 +6,8 @@ #include <sbkpython.h> -#include <QtGraphs/QSurfaceDataProxy> -#include <QtCore/QList> +#include <QtGraphs/qsurfacedataproxy.h> +#include <QtCore/qlist.h> namespace QtGraphsHelper { diff --git a/sources/pyside6/PySide6/support/__init__.py b/sources/pyside6/PySide6/support/__init__.py index 5127df0f4..e64ee57c0 100644 --- a/sources/pyside6/PySide6/support/__init__.py +++ b/sources/pyside6/PySide6/support/__init__.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from shiboken6.Shiboken import VoidPtr diff --git a/sources/pyside6/PySide6/support/deprecated.py b/sources/pyside6/PySide6/support/deprecated.py index 263dd3ed7..bacafce70 100644 --- a/sources/pyside6/PySide6/support/deprecated.py +++ b/sources/pyside6/PySide6/support/deprecated.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ deprecated.py diff --git a/sources/pyside6/PySide6/support/generate_pyi.py b/sources/pyside6/PySide6/support/generate_pyi.py index 92808e2a5..39a916655 100644 --- a/sources/pyside6/PySide6/support/generate_pyi.py +++ b/sources/pyside6/PySide6/support/generate_pyi.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ generate_pyi.py diff --git a/sources/pyside6/cmake/Macros/PySideModules.cmake b/sources/pyside6/cmake/Macros/PySideModules.cmake index 1e434f9f6..fb279c60c 100644 --- a/sources/pyside6/cmake/Macros/PySideModules.cmake +++ b/sources/pyside6/cmake/Macros/PySideModules.cmake @@ -194,6 +194,35 @@ macro(create_pyside_module) --lean-headers --api-version=${SUPPORTED_QT_VERSION}) + # check if building for Android with a macOS host + # This is not needed for Linux because OpenGLES2 development binaries in + # linux can be installed by installing 'libgles2-mesa-dev' package which + # comes as a default requirement for building PySide6. As such for + # cross-compiling in linux, we use the clang compiler from the installed + # libclang itself. + if(CMAKE_ANDROID_ARCH_LLVM_TRIPLE AND CMAKE_HOST_APPLE) + message(STATUS "Building for Android with arch ${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}") + list(APPEND shiboken_command "--clang-option=--target=${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}") + + # CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX does not contain the ANDROID_PLATFORM i.e. it ends with + # the form 'aarch64-linux-android-'. Remove the last '-' and add the corresponding clang + # based on ANDROID_PLATFORM making it 'aarch64-linux-android26-clang++' + + # Get the length of the string + string(LENGTH "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}" _length) + + # Subtract 1 from the length to get the characters till '-' + math(EXPR _last_index "${_length} - 1") + + # Get the substring from the start to the character before the last one + string(SUBSTRING "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}" 0 "${_last_index}" + SHIBOKEN_ANDROID_COMPILER_PREFIX) + + # use the compiler from the Android NDK + list(APPEND shiboken_command + "--compiler-path=${SHIBOKEN_ANDROID_COMPILER_PREFIX}${CMAKE_ANDROID_API}-clang++") + endif() + if(CMAKE_HOST_APPLE) set(shiboken_framework_include_dir_list ${QT_FRAMEWORK_INCLUDE_DIR}) make_path(shiboken_framework_include_dirs ${shiboken_framework_include_dir_list}) @@ -311,6 +340,10 @@ macro(create_pyside_module) ${generate_pyi_options}) add_dependencies("${module_NAME}_pyi" ${module_NAME}) + if(TARGET shibokenmodule) + add_dependencies("${module_NAME}_pyi" shibokenmodule) + endif() + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/../${module_NAME}.pyi" DESTINATION "${PYTHON_SITE_PACKAGES}/PySide6") endif() diff --git a/sources/pyside6/cmake/PySideHelpers.cmake b/sources/pyside6/cmake/PySideHelpers.cmake index 23ceda6bd..01c438107 100644 --- a/sources/pyside6/cmake/PySideHelpers.cmake +++ b/sources/pyside6/cmake/PySideHelpers.cmake @@ -138,13 +138,18 @@ macro(check_os) set(ENABLE_MAC "0") set(ENABLE_WIN "0") - if(CMAKE_HOST_APPLE) - set(ENABLE_MAC "1") - elseif(CMAKE_HOST_WIN32) - set(ENABLE_WIN "1") - set(ENABLE_UNIX "0") - elseif(NOT CMAKE_HOST_UNIX) - message(FATAL_ERROR "OS not supported") + # check if Android, if so, set ENABLE_UNIX=1 + # this is needed to avoid including the wrapper specific to macOS when building for Android + # from a macOS host + if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android") + if(CMAKE_HOST_APPLE) + set(ENABLE_MAC "1") + elseif(CMAKE_HOST_WIN32) + set(ENABLE_WIN "1") + set(ENABLE_UNIX "0") + elseif(NOT CMAKE_HOST_UNIX) + message(FATAL_ERROR "OS not supported") + endif() endif() endmacro() diff --git a/sources/pyside6/doc/commercial/index.rst b/sources/pyside6/doc/commercial/index.rst index e74419d6a..de135730e 100644 --- a/sources/pyside6/doc/commercial/index.rst +++ b/sources/pyside6/doc/commercial/index.rst @@ -109,7 +109,7 @@ simplify the installation step:: Complementary to the wheels, you will be able to download the sources as well. -.. note:: Wheels installed this way will be detectable by `*Qt Creator*`_, which +.. note:: Wheels installed this way will be detectable by `Qt Creator`_, which will offer you to install them for your current Python interpreter. Using account.qt.io diff --git a/sources/pyside6/doc/deployment/deployment-nuitka.rst b/sources/pyside6/doc/deployment/deployment-nuitka.rst index 8b0afa56c..ceac2065a 100644 --- a/sources/pyside6/doc/deployment/deployment-nuitka.rst +++ b/sources/pyside6/doc/deployment/deployment-nuitka.rst @@ -117,16 +117,3 @@ for data compression. Then you can run:: This process takes a bit longer, but in the end you have one executable ``hello.bin``:: ./hello.bin - - -Some Caveats -============ - - -Nuitka issue on macOS ---------------------- - -Nuitka currently has a problem with the macOS bundle files on current macOS versions. -That has the effect that ``--standalone`` and ``--onefile`` create a crashing application. -Older versions which don't have the recent macOS API changes from 2020 will work. -We are currently trying to fix that problem. diff --git a/sources/pyside6/doc/deployment/deployment-pyside6-deploy.rst b/sources/pyside6/doc/deployment/deployment-pyside6-deploy.rst index 980fe2dd1..fab9965fe 100644 --- a/sources/pyside6/doc/deployment/deployment-pyside6-deploy.rst +++ b/sources/pyside6/doc/deployment/deployment-pyside6-deploy.rst @@ -14,6 +14,9 @@ macOS. not add the virtual environment to the application directory you are trying to deploy. ``pyside6-deploy`` will try to package this venv folder and will eventually fail. +.. note:: The default version of Nuitka used with the tool is version ``2.3.2``. This can be + updated to a newer version by updating your ``pysidedeploy.spec`` file. + .. _how_pysidedeploy: How to use it? @@ -144,6 +147,12 @@ The relevant parameters for ``pyside6-deploy`` are: NSCameraUsageDescription:CameraAccess + * ``mode``: Accepts one of the options: ``onefile`` or ``standalone``. The default is ``onefile``. + This option corresponds to the mode in which Nuitka is run. The onefile mode creates a single + executable file, while the standalone mode creates a directory with the executable and all the + necessary files. The standalone mode is useful when you want to distribute the application as a + directory with dependencies and other files required by the app. + * ``extra_args``: Any extra Nuitka arguments specified. It is specified as space-separated command line arguments i.e. just like how you would specify it when you use Nuitka through the command line. By default, it contains the following arguments:: @@ -215,3 +224,29 @@ are required to be installed on the system: * - macOS - dyld_info - Available by default from macOS 12 and upwards + +Creating a bug report +===================== + +If you are unsure if the bug is from ``pyside6-deploy`` or ``Nuitka``: + +#. Create a bug report in Qt for Python. See instructions + `here <https://wiki.qt.io/Qt_for_Python/Reporting_Bugs/>`_. + +#. Run ``pyside6-deploy`` command with the ``--verbose`` option and replace ``--quiet`` with + ``--verbose`` in the ``extra_args`` parameter in the ``pysidedeploy.spec`` file. Attach the + output from stdout to the bug report. + +#. Attach a minimal example that reproduces the bug with the bug report. + +If you think the bug originates from ``Nuitka``: + +#. Try using a newer version of ``Nuitka``. You can change this from the ``packages`` parameter in + your generated ``pysidedeploy.spec`` file. + +#. If the bug persists, create a bug report on the + `Nuitka GitHub page <https://github.com/Nuitka/Nuitka/issues>`_. + + * Run ``pyside6-deploy`` with the ``--dry-run`` option to see the actual ``Nuitka`` command + generated. Attach the ``Nuitka`` command ran to the bug report. + * Follow the Nuitka bug report template to create a bug report. diff --git a/sources/pyside6/doc/gettingstarted/index.rst b/sources/pyside6/doc/gettingstarted/index.rst index 9d36061ad..51d8bea26 100644 --- a/sources/pyside6/doc/gettingstarted/index.rst +++ b/sources/pyside6/doc/gettingstarted/index.rst @@ -18,10 +18,10 @@ you might get them with ``brew``, and on **Windows** you can download the instal website. * **Python**: 3.9+ `[official Python website] <https://www.python.org/downloads/>`_ -* **Qt:** 6.4+ `[online installer] <https://download.qt.io/official_releases/online_installers/>`_ +* **Qt:** 6.8+ `[online installer] <https://download.qt.io/official_releases/online_installers/>`_ * **CMake:** 3.18+ `[official CMake website] <https://cmake.org/download/>`_ * **Git:** 2.0+. `[official Git website] <https://git-scm.com/downloads>`_ -* **libclang:** The libclang library, recommended: version 10 for 6.0+. +* **libclang:** The libclang library, recommended: version 16+ for 6.8+. Prebuilt versions for each OS can be `downloaded here`_. * Check the `Supported Platforms of Qt`_ diff --git a/sources/pyside6/doc/gettingstarted/linux.rst b/sources/pyside6/doc/gettingstarted/linux.rst index 912105ef8..eb1b5869d 100644 --- a/sources/pyside6/doc/gettingstarted/linux.rst +++ b/sources/pyside6/doc/gettingstarted/linux.rst @@ -30,12 +30,12 @@ Setting up CLANG If you don't have libclang already in your system, you can download from the Qt servers:: - wget https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_140-based-linux-Rhel8.2-gcc9.2-x86_64.7z + wget https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_18.1.5-based-linux-Rhel8.6-gcc10.3-x86_64.7z Extract the files, and leave it on any desired path, and set the environment variable required:: - 7z x libclang-release_140-based-linux-Rhel8.2-gcc9.2-x86_64.7z + 7z x libclang-release_18.1.5-based-linux-Rhel8.6-gcc10.3-x86_64.7z export LLVM_INSTALL_DIR=$PWD/libclang Getting the source @@ -45,16 +45,20 @@ Cloning the official repository can be done by:: git clone https://code.qt.io/pyside/pyside-setup -Checking out the version that we want to build, for example 6.5:: +Checking out the version that we want to build, for example 6.8:: - cd pyside-setup && git checkout 6.5 + cd pyside-setup && git checkout 6.8 Install the general dependencies:: pip install -r requirements.txt +For building the documentation:: + + pip install -r requirements-doc.txt + .. note:: Keep in mind you need to use the same version as your Qt installation. - Additionally, :command:`git checkout -b 6.5 --track origin/6.5` could be a better option + Additionally, :command:`git checkout -b 6.8 --track origin/6.8` could be a better option in case you want to work on it. Building and Installing (setuptools) @@ -64,15 +68,15 @@ The ``setuptools`` approach uses the ``setup.py`` file to execute the build, install, and packaging steps. Check your Qt installation path, to specifically use that version of qtpaths to build PySide. -for example, :command:`/opt/Qt/6.5.0/gcc_64/bin/qtpaths`. +for example, :command:`/opt/Qt/6.8.0/gcc_64/bin/qtpaths`. Build can take a few minutes, so it is recommended to use more than one CPU core:: - python setup.py build --qtpaths=/opt/Qt/6.5.0/gcc_64/bin/qtpaths --build-tests --ignore-git --parallel=8 + python setup.py build --qtpaths=/opt/Qt/6.8.0/gcc_64/bin/qtpaths --build-tests --ignore-git --parallel=8 To install on the current directory, just run:: - python setup.py install --qtpaths=/opt/Qt/6.5.0/gcc_64/bin/qtpaths --build-tests --ignore-git --parallel=8 + python setup.py install --qtpaths=/opt/Qt/6.8.0/gcc_64/bin/qtpaths --build-tests --ignore-git --parallel=8 Building and Installing (cmake) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/sources/pyside6/doc/gettingstarted/macOS.rst b/sources/pyside6/doc/gettingstarted/macOS.rst index ff457a4e2..accffbe92 100644 --- a/sources/pyside6/doc/gettingstarted/macOS.rst +++ b/sources/pyside6/doc/gettingstarted/macOS.rst @@ -34,12 +34,12 @@ Setting up CLANG If you don't have libclang already in your system, you can download from the Qt servers:: - wget https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_140-based-macos-universal.7z + wget https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_18.1.5-based-macos-universal.7z Extract the files, and leave it on any desired path, and set the environment variable required:: - 7z x libclang-release_140-based-macos-universal.7z + 7z x libclang-release_18.1.5-based-macos-universal.7z export LLVM_INSTALL_DIR=$PWD/libclang Getting PySide @@ -49,32 +49,36 @@ Cloning the official repository can be done by:: git clone https://code.qt.io/pyside/pyside-setup -Checking out the version that we want to build, for example, 6.5:: +Checking out the version that we want to build, for example, 6.8:: - cd pyside-setup && git checkout 6.5 + cd pyside-setup && git checkout 6.8 Install the general dependencies:: pip install -r requirements.txt +For building the documentation:: + + pip install -r requirements-doc.txt + .. note:: Keep in mind you need to use the same version as your Qt installation Building PySide ~~~~~~~~~~~~~~~ Check your Qt installation path, to specifically use that version of qtpaths to build PySide. -for example, ``/opt/Qt/6.5.0/gcc_64/bin/qtpaths``. +for example, ``/opt/Qt/6.8.0/gcc_64/bin/qtpaths``. Build can take a few minutes, so it is recommended to use more than one CPU core:: - python setup.py build --qtpaths=/opt/Qt/6.5.0/gcc_64/bin/qtpaths --build-tests --ignore-git --parallel=8 + python setup.py build --qtpaths=/opt/Qt/6.8.0/gcc_64/bin/qtpaths --build-tests --ignore-git --parallel=8 Installing PySide ~~~~~~~~~~~~~~~~~ To install on the current directory, just run:: - python setup.py install --qtpaths=/opt/Qt/6.5.0/gcc_64/bin/qtpaths --build-tests --ignore-git --parallel=8 + python setup.py install --qtpaths=/opt/Qt/6.8.0/gcc_64/bin/qtpaths --build-tests --ignore-git --parallel=8 Test installation ~~~~~~~~~~~~~~~~~ diff --git a/sources/pyside6/doc/gettingstarted/windows.rst b/sources/pyside6/doc/gettingstarted/windows.rst index f688acd90..4451bb1fd 100644 --- a/sources/pyside6/doc/gettingstarted/windows.rst +++ b/sources/pyside6/doc/gettingstarted/windows.rst @@ -7,7 +7,7 @@ selected when using the online installer. Requirements ------------ -* `MSVC2022`_ or (MSVC2019) for Python 3 on Windows, +* `MSVC2022`_ for Python 3 on Windows, * `OpenSSL`_ (optional for SSL support, Qt must have been configured using the same SSL library). * ``sphinx`` package for the documentation (optional). * Check the platform dependencies of `Qt for Windows`_. @@ -38,7 +38,7 @@ Setting up CLANG libclang can be downloaded from the `Qt servers <https://download.qt.io/development_releases/prebuilt/libclang>`_. -for example, ``libclang-release_140-based-windows-vs2019_64.7z``. +for example, ``libclang-release_18.1.5-based-windows-vs2019_64.7z``. Note that from version 12 onwards, the prebuilt Windows binaries from `LLVM <https://www.llvm.org>`_ no longer contain CMake configuration files; so @@ -57,21 +57,25 @@ Cloning the official repository can be done by:: git clone https://code.qt.io/pyside/pyside-setup -Checking out the version that we want to build, for example, 6.5:: +Checking out the version that we want to build, for example, 6.8:: - cd pyside-setup && git checkout 6.5 + cd pyside-setup && git checkout 6.8 Install the general dependencies:: pip install -r requirements.txt +For building the documentation:: + + pip install -r requirements-doc.txt + .. note:: Keep in mind you need to use the same version as your Qt installation Building PySide ~~~~~~~~~~~~~~~ Check your Qt installation path, to specifically use that version of qtpaths to build PySide. -for example, ``C:\Qt\6.5.0\msvc2019_64\bin\qtpaths.exe``. +for example, ``C:\Qt\6.8.0\msvc2019_64\bin\qtpaths.exe``. Build can take a few minutes, so it is recommended to use more than one CPU core:: diff --git a/sources/pyside6/doc/inheritance_graph.py b/sources/pyside6/doc/inheritance_graph.py index 00e0ac486..c45791ba5 100644 --- a/sources/pyside6/doc/inheritance_graph.py +++ b/sources/pyside6/doc/inheritance_graph.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys diff --git a/sources/pyside6/doc/json_inheritance.py b/sources/pyside6/doc/json_inheritance.py index 06be33ea4..221114680 100644 --- a/sources/pyside6/doc/json_inheritance.py +++ b/sources/pyside6/doc/json_inheritance.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import json import os diff --git a/sources/pyside6/doc/qtattributionsscannertorst.py b/sources/pyside6/doc/qtattributionsscannertorst.py index 677371c45..1a46cb032 100644 --- a/sources/pyside6/doc/qtattributionsscannertorst.py +++ b/sources/pyside6/doc/qtattributionsscannertorst.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ Tool to run qtattributionsscanner and convert its output to rst diff --git a/sources/pyside6/doc/tools/pyside-qml.rst b/sources/pyside6/doc/tools/pyside-qml.rst index 0502dd94a..6279aad2b 100644 --- a/sources/pyside6/doc/tools/pyside-qml.rst +++ b/sources/pyside6/doc/tools/pyside-qml.rst @@ -3,16 +3,16 @@ pyside6-qml =========== -``pyside6-qml`` mimics some capabilities of Qt's `qml <qml_runtime>`_ runtime utility by directly +``pyside6-qml`` mimics some capabilities of Qt's `qml`_ runtime utility by directly invoking QQmlEngine/QQuickView. It enables prototyping with QML/QtQuick without the need to write -any Python code that loads the QML files either through `QQmlApplicationEngine <qqmlappengine>`_ or -the `QQuickView <qquickview>`_ class. The tool also detects the QML classes implemented in Python +any Python code that loads the QML files either through `QQmlApplicationEngine`_ or +the `QQuickView`_ class. The tool also detects the QML classes implemented in Python and registers them with the QML type system. Usage ----- -Consider the example `Extending QML - Plugins Example <extending_qml_example>`_. This example does +Consider the example `Extending QML - Plugins Example`_. This example does not have a Python file with a ``main`` function that initializes a QmlEngine to load the QML file ``app.qml``. You can run the example by running @@ -50,8 +50,8 @@ Options * **--verbose/-v**: Run ``pyside6-qml`` in verbose mode. When run in this mode, pyside6-qml prints log messages during various stages of processing. -Options that align with `QML <qml_runtime>`_ runtime utility -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Options that align with the `qml`_ runtime utility +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * **--app-typ/-a**: Specifies which application class to use. It takes one of the three values - ``core, gui, widget``. The default value is *gui*. @@ -78,7 +78,7 @@ Options that align with `QML <qml_runtime>`_ runtime utility * **--disable-context-sharing**: Disable the use of a shared GL context for QtQuick Windows". -.. _`qml_runtime`: https://doc.qt.io/qt-6/qtquick-qml-runtime.html -.. _`qqmlappengine`: https://doc.qt.io/qt-6/qqmlapplicationengine.html -.. _`qquickview`: https://doc.qt.io/qt-6/qquickview.html -.. _`extending_qml_example`: https://doc.qt.io/qtforpython-6/examples/example_qml_tutorials_extending-qml_chapter6-plugins.html +.. _`qml`: https://doc.qt.io/qt-6/qtquick-qml-runtime.html +.. _`QQmlApplicationEngine`: https://doc.qt.io/qt-6/qqmlapplicationengine.html +.. _`QQuickView`: https://doc.qt.io/qt-6/qquickview.html +.. _`Extending QML - Plugins Example`: https://doc.qt.io/qtforpython-6/examples/example_qml_tutorials_extending-qml_chapter6-plugins.html diff --git a/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.py b/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.py index 106483b7b..a17824b06 100644 --- a/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.py +++ b/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize1/main.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize1/main.py index 995b9906a..626f3ae3a 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize1/main.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize1/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import argparse import pandas as pd diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize2/main.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize2/main.py index 9ea96097c..03304e1db 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize2/main.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize2/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import argparse import pandas as pd diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize3/main.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize3/main.py index bbf85e17d..dd240516a 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize3/main.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize3/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys import argparse diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize3/main_window.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize3/main_window.py index 745f2fefe..8ce8f9ace 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize3/main_window.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize3/main_window.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtGui import QAction, QKeySequence diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main.py index 87b962bd3..ee8350362 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys import argparse diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_widget.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_widget.py index 2a2bfeb09..b299e785c 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_widget.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_widget.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import (QHBoxLayout, QHeaderView, QSizePolicy, QTableView, QWidget) diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_window.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_window.py index ebe2997a1..69753656d 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_window.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_window.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtGui import QAction, QKeySequence diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/table_model.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/table_model.py index 08eeeeed6..730697c29 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/table_model.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/table_model.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt, QAbstractTableModel, QModelIndex from PySide6.QtGui import QColor diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main.py index 87b962bd3..ee8350362 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys import argparse diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_widget.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_widget.py index 15b7e97e5..40954ea34 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_widget.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_widget.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QDateTime, Qt from PySide6.QtGui import QPainter diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_window.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_window.py index ed12c1f8f..e686ce093 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_window.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_window.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtGui import QAction, QKeySequence diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/table_model.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/table_model.py index 08eeeeed6..730697c29 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/table_model.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/table_model.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt, QAbstractTableModel, QModelIndex from PySide6.QtGui import QColor diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main.py index 2d851cc14..ffc81d89c 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys import argparse diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main_widget.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main_widget.py index cbcc126a1..501d7b268 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main_widget.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main_widget.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import QDateTime, Qt from PySide6.QtGui import QPainter diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main_window.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main_window.py index 116e53dc3..21842cff1 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main_window.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/main_window.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Slot from PySide6.QtGui import QAction, QKeySequence, QScreen diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/table_model.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/table_model.py index 4952c0c38..3201e5887 100644 --- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/table_model.py +++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize6/table_model.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import Qt, QAbstractTableModel, QModelIndex from PySide6.QtGui import QColor diff --git a/sources/pyside6/doc/tutorials/expenses/main.py b/sources/pyside6/doc/tutorials/expenses/main.py index a3a998470..eefe5192a 100644 --- a/sources/pyside6/doc/tutorials/expenses/main.py +++ b/sources/pyside6/doc/tutorials/expenses/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import Qt, Slot diff --git a/sources/pyside6/doc/tutorials/expenses/main_snake_prop.py b/sources/pyside6/doc/tutorials/expenses/main_snake_prop.py index 055544409..0817fae25 100644 --- a/sources/pyside6/doc/tutorials/expenses/main_snake_prop.py +++ b/sources/pyside6/doc/tutorials/expenses/main_snake_prop.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import QMargins, Qt, Slot, QSize diff --git a/sources/pyside6/doc/tutorials/expenses/steps/01-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/01-expenses.py index 27f2aef65..917d069bd 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/01-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/01-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtWidgets import QApplication, QMainWindow diff --git a/sources/pyside6/doc/tutorials/expenses/steps/02-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/02-expenses.py index 039b818df..e82b5e76b 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/02-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/02-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtWidgets import QApplication, QMainWindow diff --git a/sources/pyside6/doc/tutorials/expenses/steps/03-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/03-expenses.py index 039b818df..e82b5e76b 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/03-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/03-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtWidgets import QApplication, QMainWindow diff --git a/sources/pyside6/doc/tutorials/expenses/steps/04-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/04-expenses.py index 6723690a8..6bf5ad8cc 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/04-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/04-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtWidgets import QApplication, QMainWindow, QWidget diff --git a/sources/pyside6/doc/tutorials/expenses/steps/05-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/05-expenses.py index df0362fde..dc111d75d 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/05-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/05-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtWidgets import (QApplication, QHeaderView, QHBoxLayout, diff --git a/sources/pyside6/doc/tutorials/expenses/steps/06-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/06-expenses.py index d19a6220f..f905e980e 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/06-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/06-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtWidgets import (QApplication, QFormLayout, QHeaderView, diff --git a/sources/pyside6/doc/tutorials/expenses/steps/07-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/07-expenses.py index b1ed3fecc..56634ae0a 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/07-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/07-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import Slot diff --git a/sources/pyside6/doc/tutorials/expenses/steps/08-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/08-expenses.py index 0e7e21a32..45b37a671 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/08-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/08-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import Slot diff --git a/sources/pyside6/doc/tutorials/expenses/steps/09-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/09-expenses.py index 279a46512..99362817d 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/09-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/09-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import Slot diff --git a/sources/pyside6/doc/tutorials/expenses/steps/10-expenses.py b/sources/pyside6/doc/tutorials/expenses/steps/10-expenses.py index a3a998470..eefe5192a 100644 --- a/sources/pyside6/doc/tutorials/expenses/steps/10-expenses.py +++ b/sources/pyside6/doc/tutorials/expenses/steps/10-expenses.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtCore import Qt, Slot diff --git a/sources/pyside6/doc/tutorials/extendedexplorer/editormodels.py b/sources/pyside6/doc/tutorials/extendedexplorer/editormodels.py index 688147726..f317fb48a 100644 --- a/sources/pyside6/doc/tutorials/extendedexplorer/editormodels.py +++ b/sources/pyside6/doc/tutorials/extendedexplorer/editormodels.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtWidgets import QFileSystemModel from PySide6.QtQuick import QQuickTextDocument diff --git a/sources/pyside6/doc/tutorials/extendedexplorer/main.py b/sources/pyside6/doc/tutorials/extendedexplorer/main.py index f1e6e7d93..4afb08b6d 100644 --- a/sources/pyside6/doc/tutorials/extendedexplorer/main.py +++ b/sources/pyside6/doc/tutorials/extendedexplorer/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """ This example shows how to customize Qt Quick Controls by implementing a simple filesystem explorer. diff --git a/sources/pyside6/doc/tutorials/extendedexplorer/scheme_manager.py b/sources/pyside6/doc/tutorials/extendedexplorer/scheme_manager.py index 8d732093c..f4228a8b4 100644 --- a/sources/pyside6/doc/tutorials/extendedexplorer/scheme_manager.py +++ b/sources/pyside6/doc/tutorials/extendedexplorer/scheme_manager.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import json from pathlib import Path diff --git a/sources/pyside6/doc/tutorials/modelviewprogramming/qlistview-dnd.py b/sources/pyside6/doc/tutorials/modelviewprogramming/qlistview-dnd.py index 3a37cc0f3..15e9c81dc 100644 --- a/sources/pyside6/doc/tutorials/modelviewprogramming/qlistview-dnd.py +++ b/sources/pyside6/doc/tutorials/modelviewprogramming/qlistview-dnd.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/sources/pyside6/doc/tutorials/modelviewprogramming/simplemodel-use.py b/sources/pyside6/doc/tutorials/modelviewprogramming/simplemodel-use.py index 1bacfd829..41b168cef 100644 --- a/sources/pyside6/doc/tutorials/modelviewprogramming/simplemodel-use.py +++ b/sources/pyside6/doc/tutorials/modelviewprogramming/simplemodel-use.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/sources/pyside6/doc/tutorials/modelviewprogramming/stringlistmodel.py b/sources/pyside6/doc/tutorials/modelviewprogramming/stringlistmodel.py index 2c8493aa9..6818c1aa3 100644 --- a/sources/pyside6/doc/tutorials/modelviewprogramming/stringlistmodel.py +++ b/sources/pyside6/doc/tutorials/modelviewprogramming/stringlistmodel.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter1/createdb.py b/sources/pyside6/doc/tutorials/portingguide/chapter1/createdb.py index da7d201a8..46b5c312a 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter1/createdb.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter1/createdb.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtSql import QSqlDatabase, QSqlError, QSqlQuery from datetime import date diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter1/main.py b/sources/pyside6/doc/tutorials/portingguide/chapter1/main.py index c1293bcbd..3e8562872 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter1/main.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter1/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter2/bookdelegate.py b/sources/pyside6/doc/tutorials/portingguide/chapter2/bookdelegate.py index 2c2b80157..5e926baca 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter2/bookdelegate.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter2/bookdelegate.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import copy import os diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter2/createdb.py b/sources/pyside6/doc/tutorials/portingguide/chapter2/createdb.py index da7d201a8..46b5c312a 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter2/createdb.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter2/createdb.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtSql import QSqlDatabase, QSqlError, QSqlQuery from datetime import date diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter2/main.py b/sources/pyside6/doc/tutorials/portingguide/chapter2/main.py index 3cc55fa46..735d8e021 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter2/main.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter2/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter3/bookdelegate-old.py b/sources/pyside6/doc/tutorials/portingguide/chapter3/bookdelegate-old.py index b3187e054..cfe52bba8 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter3/bookdelegate-old.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter3/bookdelegate-old.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import copy import os diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter3/bookdelegate.py b/sources/pyside6/doc/tutorials/portingguide/chapter3/bookdelegate.py index 145d6b73e..6aba9dd93 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter3/bookdelegate.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter3/bookdelegate.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import copy, os from PySide6.QtSql import QSqlRelationalDelegate diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter3/bookwindow.py b/sources/pyside6/doc/tutorials/portingguide/chapter3/bookwindow.py index bb033c6d2..e115c321d 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter3/bookwindow.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter3/bookwindow.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtGui import QAction from PySide6.QtWidgets import (QAbstractItemView, QDataWidgetMapper, diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter3/createdb.py b/sources/pyside6/doc/tutorials/portingguide/chapter3/createdb.py index da7d201a8..46b5c312a 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter3/createdb.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter3/createdb.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtSql import QSqlDatabase, QSqlError, QSqlQuery from datetime import date diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter3/main-old.py b/sources/pyside6/doc/tutorials/portingguide/chapter3/main-old.py index 164fc589a..7d1aea78c 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter3/main-old.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter3/main-old.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtWidgets import QApplication diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter3/main.py b/sources/pyside6/doc/tutorials/portingguide/chapter3/main.py index 9a6575dc2..9af868772 100644 --- a/sources/pyside6/doc/tutorials/portingguide/chapter3/main.py +++ b/sources/pyside6/doc/tutorials/portingguide/chapter3/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from PySide6.QtWidgets import QApplication diff --git a/sources/pyside6/doc/tutorials/portingguide/hello_world_ex.py b/sources/pyside6/doc/tutorials/portingguide/hello_world_ex.py index d67906fa7..3b234bdf8 100644 --- a/sources/pyside6/doc/tutorials/portingguide/hello_world_ex.py +++ b/sources/pyside6/doc/tutorials/portingguide/hello_world_ex.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys import random diff --git a/sources/pyside6/doc/tutorials/qmlapp/main.py b/sources/pyside6/doc/tutorials/qmlapp/main.py index 8b1b25440..c532e8d26 100644 --- a/sources/pyside6/doc/tutorials/qmlapp/main.py +++ b/sources/pyside6/doc/tutorials/qmlapp/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys import urllib.request diff --git a/sources/pyside6/doc/tutorials/qmlintegration/main.py b/sources/pyside6/doc/tutorials/qmlintegration/main.py index 0a751d7d1..6e7897acd 100644 --- a/sources/pyside6/doc/tutorials/qmlintegration/main.py +++ b/sources/pyside6/doc/tutorials/qmlintegration/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations import sys from pathlib import Path diff --git a/sources/pyside6/doc/tutorials/qmlsqlintegration/main.py b/sources/pyside6/doc/tutorials/qmlsqlintegration/main.py index 314fd5aa5..f038505e5 100644 --- a/sources/pyside6/doc/tutorials/qmlsqlintegration/main.py +++ b/sources/pyside6/doc/tutorials/qmlsqlintegration/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys import logging diff --git a/sources/pyside6/doc/tutorials/qmlsqlintegration/sqlDialog.py b/sources/pyside6/doc/tutorials/qmlsqlintegration/sqlDialog.py index d728aee59..be839bcba 100644 --- a/sources/pyside6/doc/tutorials/qmlsqlintegration/sqlDialog.py +++ b/sources/pyside6/doc/tutorials/qmlsqlintegration/sqlDialog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import datetime import logging diff --git a/sources/pyside6/libpyside/globalreceiverv2.cpp b/sources/pyside6/libpyside/globalreceiverv2.cpp index 51070b4ad..2c75e39e1 100644 --- a/sources/pyside6/libpyside/globalreceiverv2.cpp +++ b/sources/pyside6/libpyside/globalreceiverv2.cpp @@ -274,9 +274,8 @@ int GlobalReceiverV2::qt_metacall(QMetaObject::Call call, int id, void **args) if (setSenderDynamicProperty) m_receiver->setProperty(senderDynamicProperty, QVariant::fromValue(sender())); - const bool isShortCuit = std::strchr(slot.methodSignature(), '(') == nullptr; Shiboken::AutoDecRef callback(m_data->callback()); - SignalManager::callPythonMetaMethod(slot, args, callback, isShortCuit); + SignalManager::callPythonMetaMethod(slot, args, callback); if (setSenderDynamicProperty) m_receiver->setProperty(senderDynamicProperty, QVariant{}); diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index cff74c260..9e12e3cd7 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -43,6 +43,7 @@ #include <QtCore/QMutex> #include <QtCore/QStack> #include <QtCore/QThread> +#include <QtCore/private/qobject_p.h> #include <algorithm> #include <cstring> @@ -63,6 +64,20 @@ QT_END_NAMESPACE Q_LOGGING_CATEGORY(lcPySide, "qt.pyside.libpyside", QtCriticalMsg) +static QObjectData *qt_object_private(const QObject *o) +{ + class FriendlyQObject : public QObject { + public: + using QObject::d_ptr; + }; + return static_cast<const FriendlyQObject *>(o)->d_ptr.data(); +} + +static bool hasDynamicMetaObject(const QObject *o) +{ + return qt_object_private(o)->metaObject != nullptr; +} + namespace PySide { @@ -675,6 +690,32 @@ static void invalidatePtr(any_t *object) static const char invalidatePropertyName[] = "_PySideInvalidatePtr"; +// PYSIDE-2749: Skip over internal QML classes and classes +// with dynamic meta objects when looking for the best matching +// type to avoid unnessarily triggering the lazy load mechanism +// for classes that do not have a binding from things like eventFilter(). +static inline bool isInternalObject(const char *name) +{ + return std::strstr(name, "QMLTYPE") != nullptr || std::strstr(name, "QQmlPrivate") != nullptr; +} + +static const QMetaObject *metaObjectCandidate(const QObject *o) +{ + auto *metaObject = o->metaObject(); + // Skip QML helper types and Python objects + if (hasDynamicMetaObject(o)) { + if (auto *super = metaObject->superClass()) + metaObject = super; + } + for (auto *candidate = metaObject; candidate != nullptr; candidate = candidate->superClass()) { + if (!isInternalObject(candidate->className())) { + metaObject = candidate; + break; + } + } + return metaObject; +} + // PYSIDE-1214, when creating new wrappers for classes inheriting QObject but // not exposed to Python, try to find the best-matching (most-derived) Qt // class by walking up the meta objects. @@ -682,19 +723,13 @@ static const char *typeName(const QObject *cppSelf) { const char *typeName = typeid(*cppSelf).name(); if (!Shiboken::Conversions::getConverter(typeName)) { - for (auto metaObject = cppSelf->metaObject(); metaObject; metaObject = metaObject->superClass()) { + auto *metaObject = metaObjectCandidate(cppSelf); + for (; metaObject != nullptr; metaObject = metaObject->superClass()) { const char *name = metaObject->className(); if (Shiboken::Conversions::getConverter(name)) { typeName = name; break; } - // PYSIDE-2404: Did not find the name. Load the lazy classes - // which have this name and try again. - Shiboken::Module::loadLazyClassesWithName(name); - if (Shiboken::Conversions::getConverter(name)) { - typeName = name; - break; - } } } return typeName; diff --git a/sources/pyside6/libpyside/pysideproperty.cpp b/sources/pyside6/libpyside/pysideproperty.cpp index 457415479..3720815db 100644 --- a/sources/pyside6/libpyside/pysideproperty.cpp +++ b/sources/pyside6/libpyside/pysideproperty.cpp @@ -475,6 +475,7 @@ static const char *Property_SignatureStrings[] = { "PySide6.QtCore.Property.read(self,fget:typing.Callable)->PySide6.QtCore.Property", "PySide6.QtCore.Property.setter(self,fset:typing.Callable)->PySide6.QtCore.Property", "PySide6.QtCore.Property.write(self,fset:typing.Callable)->PySide6.QtCore.Property", + "PySide6.QtCore.Property.__call__(self, func:typing.Callable)->PySide6.QtCore.Property", nullptr}; // Sentinel void init(PyObject *module) diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp index d9dd14ad5..ed0cc5d0a 100644 --- a/sources/pyside6/libpyside/pysidesignal.cpp +++ b/sources/pyside6/libpyside/pysidesignal.cpp @@ -653,8 +653,11 @@ static PyObject *signalInstanceGetItem(PyObject *self, PyObject *key) static inline void warnDisconnectFailed(PyObject *aSlot, const QByteArray &signature) { if (PyErr_Occurred() != nullptr) { // avoid "%S" invoking str() when an error is set. + PyObject *exc{}, *inst{}, *tb{}; + PyErr_Fetch(&exc, &inst, &tb); PyErr_WarnFormat(PyExc_RuntimeWarning, 0, "Failed to disconnect (%s) from signal \"%s\".", Py_TYPE(aSlot)->tp_name, signature.constData()); + PyErr_Restore(exc, inst, tb); } else { PyErr_WarnFormat(PyExc_RuntimeWarning, 0, "Failed to disconnect (%S) from signal \"%s\".", aSlot, signature.constData()); @@ -713,8 +716,7 @@ static PyObject *signalInstanceDisconnect(PyObject *self, PyObject *args) } warnDisconnectFailed(slot, source->d->signature); - Py_INCREF(Py_False); - return Py_False; + Py_RETURN_FALSE; } // PYSIDE-68: Supply the missing __get__ function @@ -1188,13 +1190,11 @@ EmitterData getEmitterData(PySideSignalInstance *signal) return result; } -QByteArrayList getArgsFromSignature(const char *signature, bool *isShortCircuit) +QByteArrayList getArgsFromSignature(const char *signature) { QByteArray qsignature = QByteArray(signature).trimmed(); QByteArrayList result; - if (isShortCircuit) - *isShortCircuit = !qsignature.contains(u'('); if (qsignature.contains("()") || qsignature.contains("(void)")) return result; if (qsignature.endsWith(')')) { @@ -1278,24 +1278,21 @@ QByteArray getCallbackSignature(const char *signal, QObject *receiver, functionName = Shiboken::String::toCString(slotArgs.functionName); Q_ASSERT(!functionName.isEmpty()); - bool isShortCircuit = false; - if (functionName.startsWith('<') && functionName.endsWith('>')) { // fix "<lambda>" functionName[0] = '_'; functionName[functionName.size() - 1] = '_'; } QByteArray signature = encodeName ? codeCallbackName(callback, functionName) : functionName; - QByteArrayList args = getArgsFromSignature(signal, &isShortCircuit); + QByteArrayList args = getArgsFromSignature(signal); - if (!isShortCircuit) { - signature.append(u'('); - if (numArgs == -1) - numArgs = std::numeric_limits<qsizetype>::max(); + signature.append(u'('); + if (numArgs != -1) { while (!args.isEmpty() && (args.size() > (numArgs - useSelf))) args.removeLast(); - signature.append(args.join(',')); - signature.append(')'); } + signature.append(args.join(',')); + signature.append(')'); + return signature; } diff --git a/sources/pyside6/libpyside/pysidesignal.h b/sources/pyside6/libpyside/pysidesignal.h index 589fc2c92..7493f94b5 100644 --- a/sources/pyside6/libpyside/pysidesignal.h +++ b/sources/pyside6/libpyside/pysidesignal.h @@ -142,12 +142,10 @@ PYSIDE_API QByteArray getCallbackSignature(const char *signal, QObject *receiver * This function parses the signature and then returns a list of argument types. * * @param signature The signal signature - * @param isShortCircuit If this is a shortCircuit(python<->python) signal * @return Return true if this is a Qt Signal, otherwise return false * @todo replace return type by QList<QByteArray> **/ -QByteArrayList getArgsFromSignature(const char *signature, - bool *isShortCircuit = nullptr); +QByteArrayList getArgsFromSignature(const char *signature); } // namespace PySide::Signal diff --git a/sources/pyside6/libpyside/signalmanager.cpp b/sources/pyside6/libpyside/signalmanager.cpp index 557f130e0..f4c2bbf43 100644 --- a/sources/pyside6/libpyside/signalmanager.cpp +++ b/sources/pyside6/libpyside/signalmanager.cpp @@ -43,7 +43,6 @@ using namespace Qt::StringLiterals; static PyObject *metaObjectAttr = nullptr; static PyObject *parseArguments(const QMetaMethod &method, void **args); -static bool emitShortCircuitSignal(QObject *source, int signalIndex, PyObject *args); static bool qAppRunning = false; @@ -474,16 +473,7 @@ bool SignalManager::emitSignal(QObject *source, const char *signal, PyObject *ar signal++; int signalIndex = source->metaObject()->indexOfSignal(signal); - if (signalIndex != -1) { - // cryptic but works! - // if the signature doesn't have a '(' it's a shor circuited signal, i.e. std::find - // returned the string null terminator. - bool isShortCircuit = !*std::find(signal, signal + std::strlen(signal), '('); - return isShortCircuit - ? emitShortCircuitSignal(source, signalIndex, args) - : MetaFunction::call(source, signalIndex, args); - } - return false; + return signalIndex != -1 && MetaFunction::call(source, signalIndex, args); } // Handle errors from meta calls. Requires GIL and PyErr_Occurred() @@ -589,7 +579,7 @@ int SignalManager::SignalManagerPrivate::qtMethodMetacall(QObject *object, PyErr_Format(PyExc_AttributeError, "Slot '%s::%s' not found.", metaObject->className(), method.methodSignature().constData()); } else { - SignalManager::callPythonMetaMethod(method, args, pyMethod, false); + SignalManager::callPythonMetaMethod(method, args, pyMethod); } } // WARNING Isn't safe to call any metaObject and/or object methods beyond this point @@ -635,13 +625,12 @@ int SignalManager::qt_metacall(QObject *object, QMetaObject::Call call, int id, return id; } -int SignalManager::callPythonMetaMethod(const QMetaMethod &method, void **args, PyObject *pyMethod, bool isShortCuit) +int SignalManager::callPythonMetaMethod(const QMetaMethod &method, void **args, PyObject *pyMethod) { Q_ASSERT(pyMethod); Shiboken::GilState gil; - PyObject *pyArguments = isShortCuit - ? reinterpret_cast<PyObject *>(args[1]) : parseArguments(method, args); + PyObject *pyArguments = parseArguments(method, args); if (pyArguments) { QScopedPointer<Shiboken::Conversions::SpecificConverter> retConverter; @@ -656,8 +645,7 @@ int SignalManager::callPythonMetaMethod(const QMetaMethod &method, void **args, Shiboken::AutoDecRef retval(PyObject_CallObject(pyMethod, pyArguments)); - if (!isShortCuit && pyArguments) - Py_DECREF(pyArguments); + Py_DECREF(pyArguments); if (!retval.isNull() && retval != Py_None && !PyErr_Occurred() && retConverter) retConverter->toCpp(retval, args[0]); @@ -824,11 +812,4 @@ static PyObject *parseArguments(const QMetaMethod &method, void **args) return preparedArgs; } -static bool emitShortCircuitSignal(QObject *source, int signalIndex, PyObject *args) -{ - void *signalArgs[2] = {nullptr, args}; - source->qt_metacall(QMetaObject::InvokeMetaMethod, signalIndex, signalArgs); - return true; -} - #include "signalmanager.moc" diff --git a/sources/pyside6/libpyside/signalmanager.h b/sources/pyside6/libpyside/signalmanager.h index c531d6630..397700df1 100644 --- a/sources/pyside6/libpyside/signalmanager.h +++ b/sources/pyside6/libpyside/signalmanager.h @@ -81,7 +81,7 @@ public: void purgeEmptyGlobalReceivers(); // Utility function to call a python method usign args received in qt_metacall - static int callPythonMetaMethod(const QMetaMethod& method, void** args, PyObject* obj, bool isShortCuit); + static int callPythonMetaMethod(const QMetaMethod& method, void** args, PyObject* obj); static void deleteGlobalReceiver(const QObject *globalReceiver); diff --git a/sources/pyside6/plugins/designer/CMakeLists.txt b/sources/pyside6/plugins/designer/CMakeLists.txt index c86d328cf..717652314 100644 --- a/sources/pyside6/plugins/designer/CMakeLists.txt +++ b/sources/pyside6/plugins/designer/CMakeLists.txt @@ -19,6 +19,9 @@ target_sources(PySidePlugin PRIVATE ) # See libshiboken/CMakeLists.txt + +target_compile_definitions(PySidePlugin PRIVATE -DQT_NO_KEYWORDS=1) + if(PYTHON_LIMITED_API) target_compile_definitions(PySidePlugin PRIVATE "-DPy_LIMITED_API=0x03050000") endif() diff --git a/sources/pyside6/plugins/designer/designercustomwidgets.cpp b/sources/pyside6/plugins/designer/designercustomwidgets.cpp index d23156a9d..dc8bdf435 100644 --- a/sources/pyside6/plugins/designer/designercustomwidgets.cpp +++ b/sources/pyside6/plugins/designer/designercustomwidgets.cpp @@ -17,6 +17,7 @@ #include <QtCore/QVariant> #include <string_view> +#include <utility> using namespace Qt::StringLiterals; @@ -123,26 +124,29 @@ static bool runPyScriptFile(const QString &fileName, QString *errorMessage) return ok; } +static std::pair<int, int> pythonVersion() +{ + // read environment set by pyside_tool.py + bool majorOk{}; + bool minorOk{}; + const int majorVersion = qEnvironmentVariableIntValue("PY_MAJOR_VERSION", &majorOk); + const int minorVersion = qEnvironmentVariableIntValue("PY_MINOR_VERSION", &minorOk); + if (majorOk && minorVersion) + return {majorVersion, minorVersion}; + return {PY_MAJOR_VERSION, PY_MINOR_VERSION}; +} + static void initVirtualEnvironment() { static const char virtualEnvVar[] = "VIRTUAL_ENV"; - // As of Python 3.8/Windows, Python is no longer able to run stand-alone in - // a virtualenv due to missing libraries. Add the path to the modules - // instead. macOS seems to be showing the same issues. + // Since Python 3.8 (Windows, macOS), Python is no longer able to run stand + // -alone in a virtualenv due to missing libraries. Add the path to the modules + // instead. const auto os = QOperatingSystemVersion::currentType(); - bool ok; - int majorVersion = qEnvironmentVariableIntValue("PY_MAJOR_VERSION", &ok); - int minorVersion = qEnvironmentVariableIntValue("PY_MINOR_VERSION", &ok); - if (!ok) { - majorVersion = PY_MAJOR_VERSION; - minorVersion = PY_MINOR_VERSION; - } - if (!qEnvironmentVariableIsSet(virtualEnvVar) - || (os != QOperatingSystemVersion::MacOS && os != QOperatingSystemVersion::Windows) - || (majorVersion == 3 && minorVersion < 8)) { + || (os != QOperatingSystemVersion::MacOS && os != QOperatingSystemVersion::Windows)) { return; } @@ -155,11 +159,13 @@ static void initVirtualEnvironment() case QOperatingSystemVersion::Windows: pythonPath.append(virtualEnvPath + R"(\Lib\site-packages)"); break; - case QOperatingSystemVersion::MacOS: + case QOperatingSystemVersion::MacOS: { + const auto version = pythonVersion(); pythonPath.append(virtualEnvPath + "/lib/python"_ba + - QByteArray::number(majorVersion) + '.' - + QByteArray::number(minorVersion) + QByteArray::number(version.first) + '.' + + QByteArray::number(version.second) + "/site-packages"_ba); + } break; default: break; diff --git a/sources/pyside6/pyside_version.py b/sources/pyside6/pyside_version.py index bd78d3316..830b31e91 100644 --- a/sources/pyside6/pyside_version.py +++ b/sources/pyside6/pyside_version.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations major_version = "@pyside_MAJOR_VERSION@" minor_version = "@pyside_MINOR_VERSION@" diff --git a/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py b/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py index 23e2d6e7e..e44cab0ce 100644 --- a/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py +++ b/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Q3DExtras''' diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test.py index f3c971285..80c5107ac 100644 --- a/sources/pyside6/tests/QtAsyncio/qasyncio_test.py +++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtAsyncio''' diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_task.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_task.py index 7ef2bb90d..c2f56d01a 100644 --- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_task.py +++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_task.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtAsyncio''' diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_taskgroup.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_taskgroup.py index aa8ce4718..5f8579bac 100644 --- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_taskgroup.py +++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_cancel_taskgroup.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtAsyncio''' diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_chain.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_chain.py index a0a949720..a8e5bb198 100644 --- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_chain.py +++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_chain.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtAsyncio''' diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_executor.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_executor.py index 25e680b39..641d374df 100644 --- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_executor.py +++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_executor.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtAsyncio''' diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_queues.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_queues.py index 0bd98c361..2df39ee02 100644 --- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_queues.py +++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_queues.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtAsyncio''' diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_threadsafe.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_threadsafe.py index 5b52db239..489354349 100644 --- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_threadsafe.py +++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_threadsafe.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtAsyncio''' diff --git a/sources/pyside6/tests/QtAsyncio/qasyncio_test_time.py b/sources/pyside6/tests/QtAsyncio/qasyncio_test_time.py index 07a126644..66f0433df 100644 --- a/sources/pyside6/tests/QtAsyncio/qasyncio_test_time.py +++ b/sources/pyside6/tests/QtAsyncio/qasyncio_test_time.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtAsyncio''' diff --git a/sources/pyside6/tests/QtBluetooth/localdevice.py b/sources/pyside6/tests/QtBluetooth/localdevice.py index 21801106f..0627333e6 100644 --- a/sources/pyside6/tests/QtBluetooth/localdevice.py +++ b/sources/pyside6/tests/QtBluetooth/localdevice.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QBluetoothLocalDevice''' diff --git a/sources/pyside6/tests/QtBluetooth/lowenergy_characteristics.py b/sources/pyside6/tests/QtBluetooth/lowenergy_characteristics.py index 0f7298fec..2bc623b7e 100644 --- a/sources/pyside6/tests/QtBluetooth/lowenergy_characteristics.py +++ b/sources/pyside6/tests/QtBluetooth/lowenergy_characteristics.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QLowEnergyServiceData''' diff --git a/sources/pyside6/tests/QtCharts/qcharts_numpy_test.py b/sources/pyside6/tests/QtCharts/qcharts_numpy_test.py index 8154020c0..7c88d364e 100644 --- a/sources/pyside6/tests/QtCharts/qcharts_numpy_test.py +++ b/sources/pyside6/tests/QtCharts/qcharts_numpy_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QCharts/numpy''' diff --git a/sources/pyside6/tests/QtCharts/qcharts_test.py b/sources/pyside6/tests/QtCharts/qcharts_test.py index 8d57c07eb..fbb93cb8b 100644 --- a/sources/pyside6/tests/QtCharts/qcharts_test.py +++ b/sources/pyside6/tests/QtCharts/qcharts_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QCharts''' diff --git a/sources/pyside6/tests/QtCore/CMakeLists.txt b/sources/pyside6/tests/QtCore/CMakeLists.txt index f584bfde6..f0228d943 100644 --- a/sources/pyside6/tests/QtCore/CMakeLists.txt +++ b/sources/pyside6/tests/QtCore/CMakeLists.txt @@ -34,6 +34,7 @@ PYSIDE_TEST(bug_1313.py) PYSIDE_TEST(bug_PYSIDE-41.py) PYSIDE_TEST(bug_PYSIDE-42.py) PYSIDE_TEST(bug_PYSIDE-164.py) +PYSIDE_TEST(bug_PYSIDE-2745.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(classinfo_test.py) PYSIDE_TEST(child_event_test.py) diff --git a/sources/pyside6/tests/QtCore/attr_cache_py3k.py b/sources/pyside6/tests/QtCore/attr_cache_py3k.py index c82dbbea3..ca66e0e17 100644 --- a/sources/pyside6/tests/QtCore/attr_cache_py3k.py +++ b/sources/pyside6/tests/QtCore/attr_cache_py3k.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations ''' Unit tests for attribute cache in Python 3 diff --git a/sources/pyside6/tests/QtCore/blocking_signals_test.py b/sources/pyside6/tests/QtCore/blocking_signals_test.py index 493abb071..48d8ab7b9 100644 --- a/sources/pyside6/tests/QtCore/blocking_signals_test.py +++ b/sources/pyside6/tests/QtCore/blocking_signals_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test case for QObject.signalsBlocked() and blockSignal()''' diff --git a/sources/pyside6/tests/QtCore/bug_1019.py b/sources/pyside6/tests/QtCore/bug_1019.py index 4a35956b1..0257dda94 100644 --- a/sources/pyside6/tests/QtCore/bug_1019.py +++ b/sources/pyside6/tests/QtCore/bug_1019.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_1063.py b/sources/pyside6/tests/QtCore/bug_1063.py index 88c4bb51e..fec6836a1 100644 --- a/sources/pyside6/tests/QtCore/bug_1063.py +++ b/sources/pyside6/tests/QtCore/bug_1063.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' unit test for BUG #1063 ''' diff --git a/sources/pyside6/tests/QtCore/bug_1069.py b/sources/pyside6/tests/QtCore/bug_1069.py index 760918cd9..746897a80 100644 --- a/sources/pyside6/tests/QtCore/bug_1069.py +++ b/sources/pyside6/tests/QtCore/bug_1069.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' unit test for BUG #1069 ''' diff --git a/sources/pyside6/tests/QtCore/bug_1313.py b/sources/pyside6/tests/QtCore/bug_1313.py index ecc22c43b..3d66a6d2c 100644 --- a/sources/pyside6/tests/QtCore/bug_1313.py +++ b/sources/pyside6/tests/QtCore/bug_1313.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' unit test for BUG #1313 ''' diff --git a/sources/pyside6/tests/QtCore/bug_278_test.py b/sources/pyside6/tests/QtCore/bug_278_test.py index 8d2f4b47e..d929dc10c 100644 --- a/sources/pyside6/tests/QtCore/bug_278_test.py +++ b/sources/pyside6/tests/QtCore/bug_278_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_300_test.py b/sources/pyside6/tests/QtCore/bug_300_test.py index b9768bf9d..1862dc56a 100644 --- a/sources/pyside6/tests/QtCore/bug_300_test.py +++ b/sources/pyside6/tests/QtCore/bug_300_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_324.py b/sources/pyside6/tests/QtCore/bug_324.py index 0aa17c465..a93f94089 100644 --- a/sources/pyside6/tests/QtCore/bug_324.py +++ b/sources/pyside6/tests/QtCore/bug_324.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 324: http://bugs.openbossa.org/show_bug.cgi?id=324''' diff --git a/sources/pyside6/tests/QtCore/bug_332.py b/sources/pyside6/tests/QtCore/bug_332.py index 8d55bc87f..9e910de1f 100644 --- a/sources/pyside6/tests/QtCore/bug_332.py +++ b/sources/pyside6/tests/QtCore/bug_332.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_408.py b/sources/pyside6/tests/QtCore/bug_408.py index 30459172c..e8bc45636 100644 --- a/sources/pyside6/tests/QtCore/bug_408.py +++ b/sources/pyside6/tests/QtCore/bug_408.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_428.py b/sources/pyside6/tests/QtCore/bug_428.py index 8fb5d4827..11617aaf7 100644 --- a/sources/pyside6/tests/QtCore/bug_428.py +++ b/sources/pyside6/tests/QtCore/bug_428.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_462.py b/sources/pyside6/tests/QtCore/bug_462.py index 04a42fe08..830a4c148 100644 --- a/sources/pyside6/tests/QtCore/bug_462.py +++ b/sources/pyside6/tests/QtCore/bug_462.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_505.py b/sources/pyside6/tests/QtCore/bug_505.py index e8655a84e..8c4a045df 100644 --- a/sources/pyside6/tests/QtCore/bug_505.py +++ b/sources/pyside6/tests/QtCore/bug_505.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtCore/bug_515.py b/sources/pyside6/tests/QtCore/bug_515.py index 4e270a441..f63e86c95 100644 --- a/sources/pyside6/tests/QtCore/bug_515.py +++ b/sources/pyside6/tests/QtCore/bug_515.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ Unittest for bug #515 """ """ http://bugs.openbossa.org/show_bug.cgi?id=515 """ diff --git a/sources/pyside6/tests/QtCore/bug_606.py b/sources/pyside6/tests/QtCore/bug_606.py index 4fed16b6e..8e6a9384a 100644 --- a/sources/pyside6/tests/QtCore/bug_606.py +++ b/sources/pyside6/tests/QtCore/bug_606.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_656.py b/sources/pyside6/tests/QtCore/bug_656.py index 066dc1a02..75131326c 100644 --- a/sources/pyside6/tests/QtCore/bug_656.py +++ b/sources/pyside6/tests/QtCore/bug_656.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_686.py b/sources/pyside6/tests/QtCore/bug_686.py index 6425a4b86..808e42b72 100644 --- a/sources/pyside6/tests/QtCore/bug_686.py +++ b/sources/pyside6/tests/QtCore/bug_686.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_699.py b/sources/pyside6/tests/QtCore/bug_699.py index 02da46ff1..dbd686cdd 100644 --- a/sources/pyside6/tests/QtCore/bug_699.py +++ b/sources/pyside6/tests/QtCore/bug_699.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_706.py b/sources/pyside6/tests/QtCore/bug_706.py index 7db773240..1fa04f77f 100644 --- a/sources/pyside6/tests/QtCore/bug_706.py +++ b/sources/pyside6/tests/QtCore/bug_706.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_820.py b/sources/pyside6/tests/QtCore/bug_820.py index ba0d33068..182fea41c 100644 --- a/sources/pyside6/tests/QtCore/bug_820.py +++ b/sources/pyside6/tests/QtCore/bug_820.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import functools import os diff --git a/sources/pyside6/tests/QtCore/bug_826.py b/sources/pyside6/tests/QtCore/bug_826.py index 95edc0a7c..0e639e697 100644 --- a/sources/pyside6/tests/QtCore/bug_826.py +++ b/sources/pyside6/tests/QtCore/bug_826.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_829.py b/sources/pyside6/tests/QtCore/bug_829.py index 9a57e0399..89790c001 100644 --- a/sources/pyside6/tests/QtCore/bug_829.py +++ b/sources/pyside6/tests/QtCore/bug_829.py @@ -1,6 +1,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # Copyright (C) 2011 Thomas Perl <thp.io/about> # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations # Test case for PySide bug 829 diff --git a/sources/pyside6/tests/QtCore/bug_835.py b/sources/pyside6/tests/QtCore/bug_835.py index 6d91b6e0a..ffc599ee9 100644 --- a/sources/pyside6/tests/QtCore/bug_835.py +++ b/sources/pyside6/tests/QtCore/bug_835.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_920.py b/sources/pyside6/tests/QtCore/bug_920.py index 23c8d6201..d39c44547 100644 --- a/sources/pyside6/tests/QtCore/bug_920.py +++ b/sources/pyside6/tests/QtCore/bug_920.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_927.py b/sources/pyside6/tests/QtCore/bug_927.py index 1ecea61b2..fb1ffdde1 100644 --- a/sources/pyside6/tests/QtCore/bug_927.py +++ b/sources/pyside6/tests/QtCore/bug_927.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys @@ -24,7 +25,7 @@ class thread_function(): class Task(QRunnable): def run(self): - QThread.sleep(2) # Sleep 2 seconds + QThread.msleep(100) class QThreadPoolTest(unittest.TestCase): @@ -34,15 +35,15 @@ class QThreadPoolTest(unittest.TestCase): for i in range(3): task = Task() QThreadPool.globalInstance().start(task) - time.sleep(1) # Sleep 1 second + time.sleep(0.05) - QThreadPool.globalInstance().waitForDone() + self.assertTrue(QThreadPool.globalInstance().waitForDone()) def testCallable(self): global thread_function_called tp = QThreadPool.globalInstance() tp.start(thread_function) - tp.waitForDone() + self.assertTrue(tp.waitForDone()) self.assertTrue(thread_function_called) diff --git a/sources/pyside6/tests/QtCore/bug_931.py b/sources/pyside6/tests/QtCore/bug_931.py index f233c2a26..f710e1fbb 100644 --- a/sources/pyside6/tests/QtCore/bug_931.py +++ b/sources/pyside6/tests/QtCore/bug_931.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_938.py b/sources/pyside6/tests/QtCore/bug_938.py index 3aca25947..63607cd40 100644 --- a/sources/pyside6/tests/QtCore/bug_938.py +++ b/sources/pyside6/tests/QtCore/bug_938.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_953.py b/sources/pyside6/tests/QtCore/bug_953.py index a9cacc97e..b772b8536 100644 --- a/sources/pyside6/tests/QtCore/bug_953.py +++ b/sources/pyside6/tests/QtCore/bug_953.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtCore/bug_987.py b/sources/pyside6/tests/QtCore/bug_987.py index a8c9799e0..82494fe4b 100644 --- a/sources/pyside6/tests/QtCore/bug_987.py +++ b/sources/pyside6/tests/QtCore/bug_987.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_994.py b/sources/pyside6/tests/QtCore/bug_994.py index 464fe3120..258d40dd8 100644 --- a/sources/pyside6/tests/QtCore/bug_994.py +++ b/sources/pyside6/tests/QtCore/bug_994.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py b/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py index 84859af84..2a082eeb6 100644 --- a/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py +++ b/sources/pyside6/tests/QtCore/bug_PYSIDE-164.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_PYSIDE-2745.py b/sources/pyside6/tests/QtCore/bug_PYSIDE-2745.py new file mode 100644 index 000000000..99f2e498f --- /dev/null +++ b/sources/pyside6/tests/QtCore/bug_PYSIDE-2745.py @@ -0,0 +1,38 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations + +import os +import sys +import unittest + +from pathlib import Path +sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) +from init_paths import init_test_paths +init_test_paths(False) + +from PySide6.QtCore import QTimer + +from helper.usesqapplication import UsesQApplication + + +class TestBugPYSIDE2745(UsesQApplication): + + def setUp(self): + UsesQApplication.setUp(self) + self.counter = 0 + + def fail(self): + self.counter += 1 + raise Exception() + + def test_fail(self): + QTimer.singleShot(0, self.fail) + QTimer.singleShot(0, self.fail) + QTimer.singleShot(1, self.app.quit) + self.app.exec() + self.assertEqual(self.counter, 2) + + +if __name__ == '__main__': + unittest.main() diff --git a/sources/pyside6/tests/QtCore/bug_PYSIDE-41.py b/sources/pyside6/tests/QtCore/bug_PYSIDE-41.py index 2830f8050..02a43d83a 100644 --- a/sources/pyside6/tests/QtCore/bug_PYSIDE-41.py +++ b/sources/pyside6/tests/QtCore/bug_PYSIDE-41.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py b/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py index b602b7569..1572e6de3 100644 --- a/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py +++ b/sources/pyside6/tests/QtCore/bug_PYSIDE-42.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/child_event_test.py b/sources/pyside6/tests/QtCore/child_event_test.py index 6b17ddc93..a6b8d3d50 100644 --- a/sources/pyside6/tests/QtCore/child_event_test.py +++ b/sources/pyside6/tests/QtCore/child_event_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for QObject.childEvent and QTimer.childEvent overloading''' diff --git a/sources/pyside6/tests/QtCore/classinfo_test.py b/sources/pyside6/tests/QtCore/classinfo_test.py index 0b0a0b4b6..626ae308e 100644 --- a/sources/pyside6/tests/QtCore/classinfo_test.py +++ b/sources/pyside6/tests/QtCore/classinfo_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import sys import os diff --git a/sources/pyside6/tests/QtCore/deepcopy_test.py b/sources/pyside6/tests/QtCore/deepcopy_test.py index e130628e3..c41f7bbb0 100644 --- a/sources/pyside6/tests/QtCore/deepcopy_test.py +++ b/sources/pyside6/tests/QtCore/deepcopy_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations from copy import deepcopy import os diff --git a/sources/pyside6/tests/QtCore/deletelater_test.py b/sources/pyside6/tests/QtCore/deletelater_test.py index 0ee078428..5d31ef367 100644 --- a/sources/pyside6/tests/QtCore/deletelater_test.py +++ b/sources/pyside6/tests/QtCore/deletelater_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QTimer.singleShot''' diff --git a/sources/pyside6/tests/QtCore/destroysignal_test.py b/sources/pyside6/tests/QtCore/destroysignal_test.py index ad087b489..5c743fe4d 100644 --- a/sources/pyside6/tests/QtCore/destroysignal_test.py +++ b/sources/pyside6/tests/QtCore/destroysignal_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtCore/duck_punching_test.py b/sources/pyside6/tests/QtCore/duck_punching_test.py index 145863c3e..e2204eca8 100644 --- a/sources/pyside6/tests/QtCore/duck_punching_test.py +++ b/sources/pyside6/tests/QtCore/duck_punching_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for duck punching new implementations of C++ virtual methods into object instances.''' diff --git a/sources/pyside6/tests/QtCore/emoji_string_test.py b/sources/pyside6/tests/QtCore/emoji_string_test.py index 78dee1893..6b4db7d99 100644 --- a/sources/pyside6/tests/QtCore/emoji_string_test.py +++ b/sources/pyside6/tests/QtCore/emoji_string_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ emoji-string-test.py diff --git a/sources/pyside6/tests/QtCore/errormessages_with_features_test.py b/sources/pyside6/tests/QtCore/errormessages_with_features_test.py index 97c4f942e..6ed1a665f 100644 --- a/sources/pyside6/tests/QtCore/errormessages_with_features_test.py +++ b/sources/pyside6/tests/QtCore/errormessages_with_features_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/feature_with_uic/window.py b/sources/pyside6/tests/QtCore/feature_with_uic/window.py index c55bcaf92..0a94d2ecd 100644 --- a/sources/pyside6/tests/QtCore/feature_with_uic/window.py +++ b/sources/pyside6/tests/QtCore/feature_with_uic/window.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, QMetaObject, QObject, QPoint, QRect, diff --git a/sources/pyside6/tests/QtCore/feature_with_uic_test.py b/sources/pyside6/tests/QtCore/feature_with_uic_test.py index 2ffc9970e..ff8ac2147 100644 --- a/sources/pyside6/tests/QtCore/feature_with_uic_test.py +++ b/sources/pyside6/tests/QtCore/feature_with_uic_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +from __future__ import annotations """ feature_with_uic_test.py diff --git a/sources/pyside6/tests/QtCore/hash_test.py b/sources/pyside6/tests/QtCore/hash_test.py index aee2f516c..91edc5a09 100644 --- a/sources/pyside6/tests/QtCore/hash_test.py +++ b/sources/pyside6/tests/QtCore/hash_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/inherits_test.py b/sources/pyside6/tests/QtCore/inherits_test.py index 1422616d8..9008c2161 100644 --- a/sources/pyside6/tests/QtCore/inherits_test.py +++ b/sources/pyside6/tests/QtCore/inherits_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/loggingcategorymacros_test.py b/sources/pyside6/tests/QtCore/loggingcategorymacros_test.py index a808f0c3d..2879b8874 100644 --- a/sources/pyside6/tests/QtCore/loggingcategorymacros_test.py +++ b/sources/pyside6/tests/QtCore/loggingcategorymacros_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """Tests for category logging macros qCDebug, qCInfo, qCWarning, qCCritical""" diff --git a/sources/pyside6/tests/QtCore/max_signals.py b/sources/pyside6/tests/QtCore/max_signals.py index 95952dfbf..64f3c0bb3 100644 --- a/sources/pyside6/tests/QtCore/max_signals.py +++ b/sources/pyside6/tests/QtCore/max_signals.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/missing_symbols_test.py b/sources/pyside6/tests/QtCore/missing_symbols_test.py index 7cf6d3e3e..020a0263a 100644 --- a/sources/pyside6/tests/QtCore/missing_symbols_test.py +++ b/sources/pyside6/tests/QtCore/missing_symbols_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''(Very) Simple test case for missing names from QtCore''' diff --git a/sources/pyside6/tests/QtCore/mockclass_test.py b/sources/pyside6/tests/QtCore/mockclass_test.py index c7e465b24..57d1ddd58 100644 --- a/sources/pyside6/tests/QtCore/mockclass_test.py +++ b/sources/pyside6/tests/QtCore/mockclass_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations # Test case for PySide bug 634 # http://bugs.pyside.org/show_bug.cgi?id=634 diff --git a/sources/pyside6/tests/QtCore/multiple_feature_test.py b/sources/pyside6/tests/QtCore/multiple_feature_test.py index 0f51ace6b..1a31dda22 100644 --- a/sources/pyside6/tests/QtCore/multiple_feature_test.py +++ b/sources/pyside6/tests/QtCore/multiple_feature_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/python_conversion.py b/sources/pyside6/tests/QtCore/python_conversion.py index 28a271b61..e023ee5b5 100644 --- a/sources/pyside6/tests/QtCore/python_conversion.py +++ b/sources/pyside6/tests/QtCore/python_conversion.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QLineF''' diff --git a/sources/pyside6/tests/QtCore/qabs_test.py b/sources/pyside6/tests/QtCore/qabs_test.py index 2b22b1e17..5f08fe4bc 100644 --- a/sources/pyside6/tests/QtCore/qabs_test.py +++ b/sources/pyside6/tests/QtCore/qabs_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py b/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py index bb9a2222a..20d070a03 100644 --- a/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py +++ b/sources/pyside6/tests/QtCore/qabstractitemmodel_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qanimationgroup_test.py b/sources/pyside6/tests/QtCore/qanimationgroup_test.py index 9b9b0e622..f3eec76bf 100644 --- a/sources/pyside6/tests/QtCore/qanimationgroup_test.py +++ b/sources/pyside6/tests/QtCore/qanimationgroup_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qbitarray_test.py b/sources/pyside6/tests/QtCore/qbitarray_test.py index 70452eab1..239453da7 100644 --- a/sources/pyside6/tests/QtCore/qbitarray_test.py +++ b/sources/pyside6/tests/QtCore/qbitarray_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests if QBitArray class is iterable and also '~' (__invert__) and bitwise operators''' diff --git a/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py b/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py index aea9778d7..9c508d381 100644 --- a/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py +++ b/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QByteArray concatenation with '+' operator''' diff --git a/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py b/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py index a2201a716..cd14941bc 100644 --- a/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py +++ b/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qbytearray_operator_test.py b/sources/pyside6/tests/QtCore/qbytearray_operator_test.py index 0064e4dd6..c0e8b55e3 100644 --- a/sources/pyside6/tests/QtCore/qbytearray_operator_test.py +++ b/sources/pyside6/tests/QtCore/qbytearray_operator_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QByteArray operators''' diff --git a/sources/pyside6/tests/QtCore/qbytearray_test.py b/sources/pyside6/tests/QtCore/qbytearray_test.py index cb8f9a431..6f130ad6e 100644 --- a/sources/pyside6/tests/QtCore/qbytearray_test.py +++ b/sources/pyside6/tests/QtCore/qbytearray_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QByteArray''' diff --git a/sources/pyside6/tests/QtCore/qcalendar_test.py b/sources/pyside6/tests/QtCore/qcalendar_test.py index 0137677f3..0861cd269 100644 --- a/sources/pyside6/tests/QtCore/qcalendar_test.py +++ b/sources/pyside6/tests/QtCore/qcalendar_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QCalendar (5.14)''' diff --git a/sources/pyside6/tests/QtCore/qcbor_test.py b/sources/pyside6/tests/QtCore/qcbor_test.py index 312c9e5c7..8d49c7151 100644 --- a/sources/pyside6/tests/QtCore/qcbor_test.py +++ b/sources/pyside6/tests/QtCore/qcbor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QCbor''' diff --git a/sources/pyside6/tests/QtCore/qcollator_test.py b/sources/pyside6/tests/QtCore/qcollator_test.py index 9d1052b24..1be545582 100644 --- a/sources/pyside6/tests/QtCore/qcollator_test.py +++ b/sources/pyside6/tests/QtCore/qcollator_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QCollator''' diff --git a/sources/pyside6/tests/QtCore/qcommandlineparser_test.py b/sources/pyside6/tests/QtCore/qcommandlineparser_test.py index c562065ae..df17f95ee 100644 --- a/sources/pyside6/tests/QtCore/qcommandlineparser_test.py +++ b/sources/pyside6/tests/QtCore/qcommandlineparser_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QCommandLineParser and QCommandLineOption''' diff --git a/sources/pyside6/tests/QtCore/qcoreapplication_argv_test.py b/sources/pyside6/tests/QtCore/qcoreapplication_argv_test.py index 3c8500923..9871eb97f 100644 --- a/sources/pyside6/tests/QtCore/qcoreapplication_argv_test.py +++ b/sources/pyside6/tests/QtCore/qcoreapplication_argv_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py b/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py index 968765020..4daab45bb 100644 --- a/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py +++ b/sources/pyside6/tests/QtCore/qcoreapplication_instance_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QCoreApplication.instance static method''' diff --git a/sources/pyside6/tests/QtCore/qcoreapplication_test.py b/sources/pyside6/tests/QtCore/qcoreapplication_test.py index edd4dc8e2..f8ea5a0f1 100644 --- a/sources/pyside6/tests/QtCore/qcoreapplication_test.py +++ b/sources/pyside6/tests/QtCore/qcoreapplication_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qdatastream_test.py b/sources/pyside6/tests/QtCore/qdatastream_test.py index 517f466aa..5850974a1 100644 --- a/sources/pyside6/tests/QtCore/qdatastream_test.py +++ b/sources/pyside6/tests/QtCore/qdatastream_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QDataStream''' diff --git a/sources/pyside6/tests/QtCore/qdate_test.py b/sources/pyside6/tests/QtCore/qdate_test.py index 611292227..6979c62fb 100644 --- a/sources/pyside6/tests/QtCore/qdate_test.py +++ b/sources/pyside6/tests/QtCore/qdate_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QDate''' diff --git a/sources/pyside6/tests/QtCore/qdatetime_test.py b/sources/pyside6/tests/QtCore/qdatetime_test.py index 96e353112..fa9a988be 100644 --- a/sources/pyside6/tests/QtCore/qdatetime_test.py +++ b/sources/pyside6/tests/QtCore/qdatetime_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import datetime import os diff --git a/sources/pyside6/tests/QtCore/qdir_test.py b/sources/pyside6/tests/QtCore/qdir_test.py index 702c7f13a..ba360629b 100644 --- a/sources/pyside6/tests/QtCore/qdir_test.py +++ b/sources/pyside6/tests/QtCore/qdir_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qeasingcurve_test.py b/sources/pyside6/tests/QtCore/qeasingcurve_test.py index b202dbefb..b39563bb9 100644 --- a/sources/pyside6/tests/QtCore/qeasingcurve_test.py +++ b/sources/pyside6/tests/QtCore/qeasingcurve_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qenum_test.py b/sources/pyside6/tests/QtCore/qenum_test.py index 45a8e9124..e064ea40d 100644 --- a/sources/pyside6/tests/QtCore/qenum_test.py +++ b/sources/pyside6/tests/QtCore/qenum_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QEnum and QFlags''' diff --git a/sources/pyside6/tests/QtCore/qevent_test.py b/sources/pyside6/tests/QtCore/qevent_test.py index 244a14f13..d2ab7d1eb 100644 --- a/sources/pyside6/tests/QtCore/qevent_test.py +++ b/sources/pyside6/tests/QtCore/qevent_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtCore.QEvent''' diff --git a/sources/pyside6/tests/QtCore/qfile_test.py b/sources/pyside6/tests/QtCore/qfile_test.py index 0af5c2650..4535159de 100644 --- a/sources/pyside6/tests/QtCore/qfile_test.py +++ b/sources/pyside6/tests/QtCore/qfile_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qfileinfo_test.py b/sources/pyside6/tests/QtCore/qfileinfo_test.py index dfdfd7fa2..1836ca8a3 100644 --- a/sources/pyside6/tests/QtCore/qfileinfo_test.py +++ b/sources/pyside6/tests/QtCore/qfileinfo_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qfileread_test.py b/sources/pyside6/tests/QtCore/qfileread_test.py index c66a27f8a..250f16ce1 100644 --- a/sources/pyside6/tests/QtCore/qfileread_test.py +++ b/sources/pyside6/tests/QtCore/qfileread_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qflags_test.py b/sources/pyside6/tests/QtCore/qflags_test.py index 2a5306685..31b6f60f0 100644 --- a/sources/pyside6/tests/QtCore/qflags_test.py +++ b/sources/pyside6/tests/QtCore/qflags_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QFlags''' diff --git a/sources/pyside6/tests/QtCore/qhandle_test.py b/sources/pyside6/tests/QtCore/qhandle_test.py index e0f4f3f7a..2b59a2d8b 100644 --- a/sources/pyside6/tests/QtCore/qhandle_test.py +++ b/sources/pyside6/tests/QtCore/qhandle_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QEnum and QFlags''' diff --git a/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py b/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py index 9c5ae4370..041b006ca 100644 --- a/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py +++ b/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for qInstallMsgHandler''' diff --git a/sources/pyside6/tests/QtCore/qiodevice_buffered_read_test.py b/sources/pyside6/tests/QtCore/qiodevice_buffered_read_test.py index ea735112a..a20e41be8 100644 --- a/sources/pyside6/tests/QtCore/qiodevice_buffered_read_test.py +++ b/sources/pyside6/tests/QtCore/qiodevice_buffered_read_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for buffered read methods of QIODevice''' diff --git a/sources/pyside6/tests/QtCore/qiopipe_test.py b/sources/pyside6/tests/QtCore/qiopipe_test.py index 53a6ba70a..908a3a892 100644 --- a/sources/pyside6/tests/QtCore/qiopipe_test.py +++ b/sources/pyside6/tests/QtCore/qiopipe_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for the QIOPipe class''' diff --git a/sources/pyside6/tests/QtCore/qjsondocument_test.py b/sources/pyside6/tests/QtCore/qjsondocument_test.py index a50f185ff..63683fd3f 100644 --- a/sources/pyside6/tests/QtCore/qjsondocument_test.py +++ b/sources/pyside6/tests/QtCore/qjsondocument_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QJsonDocument/nullptr_t''' diff --git a/sources/pyside6/tests/QtCore/qlinef_test.py b/sources/pyside6/tests/QtCore/qlinef_test.py index 90ae50159..7c9e668df 100644 --- a/sources/pyside6/tests/QtCore/qlinef_test.py +++ b/sources/pyside6/tests/QtCore/qlinef_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QLineF''' diff --git a/sources/pyside6/tests/QtCore/qlocale_test.py b/sources/pyside6/tests/QtCore/qlocale_test.py index 05b0d3219..6ad933d8f 100644 --- a/sources/pyside6/tests/QtCore/qlocale_test.py +++ b/sources/pyside6/tests/QtCore/qlocale_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QLocale''' diff --git a/sources/pyside6/tests/QtCore/qlockfile_test.py b/sources/pyside6/tests/QtCore/qlockfile_test.py index 6dca9235c..e6e614b26 100644 --- a/sources/pyside6/tests/QtCore/qlockfile_test.py +++ b/sources/pyside6/tests/QtCore/qlockfile_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QLockFile''' diff --git a/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py b/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py index 74e6bceb9..92778a78b 100644 --- a/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py +++ b/sources/pyside6/tests/QtCore/qmessageauthenticationcode_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QMessageAuthenticationCode''' diff --git a/sources/pyside6/tests/QtCore/qmetaobject_test.py b/sources/pyside6/tests/QtCore/qmetaobject_test.py index 4b3051711..ff8ed859e 100644 --- a/sources/pyside6/tests/QtCore/qmetaobject_test.py +++ b/sources/pyside6/tests/QtCore/qmetaobject_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for static methos conflicts with class methods''' diff --git a/sources/pyside6/tests/QtCore/qmetatype_test.py b/sources/pyside6/tests/QtCore/qmetatype_test.py index f8e0ba1c0..cdd02e5ba 100644 --- a/sources/pyside6/tests/QtCore/qmetatype_test.py +++ b/sources/pyside6/tests/QtCore/qmetatype_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for QMetaType''' diff --git a/sources/pyside6/tests/QtCore/qmimedatabase_test.py b/sources/pyside6/tests/QtCore/qmimedatabase_test.py index 6a63edb85..c2b967a26 100644 --- a/sources/pyside6/tests/QtCore/qmimedatabase_test.py +++ b/sources/pyside6/tests/QtCore/qmimedatabase_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QMimeDatabase''' diff --git a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py index ec37ca6a0..e3dfce8b9 100644 --- a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py +++ b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test case for QAbstractListModel.createIndex and QModelIndex.internalPointer''' diff --git a/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py b/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py index 508526cca..4bdd3922b 100644 --- a/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py +++ b/sources/pyside6/tests/QtCore/qobject_children_segfault_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for parent-child relationship''' diff --git a/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py b/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py index b3bfaf007..af9e081d9 100644 --- a/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py +++ b/sources/pyside6/tests/QtCore/qobject_connect_notify_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test case for QObject::connectNotify()''' diff --git a/sources/pyside6/tests/QtCore/qobject_destructor.py b/sources/pyside6/tests/QtCore/qobject_destructor.py index 2b7b40f25..9bb80459a 100644 --- a/sources/pyside6/tests/QtCore/qobject_destructor.py +++ b/sources/pyside6/tests/QtCore/qobject_destructor.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py index ab7a1b6ad..a011f7240 100644 --- a/sources/pyside6/tests/QtCore/qobject_event_filter_test.py +++ b/sources/pyside6/tests/QtCore/qobject_event_filter_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QObject.eventFilter''' diff --git a/sources/pyside6/tests/QtCore/qobject_inherits_test.py b/sources/pyside6/tests/QtCore/qobject_inherits_test.py index 0bd4fba75..bdd927fe2 100644 --- a/sources/pyside6/tests/QtCore/qobject_inherits_test.py +++ b/sources/pyside6/tests/QtCore/qobject_inherits_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QObject methods''' diff --git a/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py b/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py index f1a4cb0b5..b12c3c77e 100644 --- a/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py +++ b/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for the bug #378 http://bugs.openbossa.org/show_bug.cgi?id=378 diff --git a/sources/pyside6/tests/QtCore/qobject_parent_test.py b/sources/pyside6/tests/QtCore/qobject_parent_test.py index 6265f77b1..103a3eb03 100644 --- a/sources/pyside6/tests/QtCore/qobject_parent_test.py +++ b/sources/pyside6/tests/QtCore/qobject_parent_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for parent-child relationship''' diff --git a/sources/pyside6/tests/QtCore/qobject_property_test.py b/sources/pyside6/tests/QtCore/qobject_property_test.py index 4efb25cb4..37936205e 100644 --- a/sources/pyside6/tests/QtCore/qobject_property_test.py +++ b/sources/pyside6/tests/QtCore/qobject_property_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QObject property and setProperty''' diff --git a/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py b/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py index 926698b4b..5ab5d12c3 100644 --- a/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py +++ b/sources/pyside6/tests/QtCore/qobject_protected_methods_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QObject protected methods''' diff --git a/sources/pyside6/tests/QtCore/qobject_test.py b/sources/pyside6/tests/QtCore/qobject_test.py index ecfc3dff0..176ab34b8 100644 --- a/sources/pyside6/tests/QtCore/qobject_test.py +++ b/sources/pyside6/tests/QtCore/qobject_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QObject methods''' diff --git a/sources/pyside6/tests/QtCore/qobject_timer_event_test.py b/sources/pyside6/tests/QtCore/qobject_timer_event_test.py index 9e657c27f..ce0c12b2d 100644 --- a/sources/pyside6/tests/QtCore/qobject_timer_event_test.py +++ b/sources/pyside6/tests/QtCore/qobject_timer_event_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for QObject.timerEvent overloading''' diff --git a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py index 9123c5155..f3df03a0c 100644 --- a/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py +++ b/sources/pyside6/tests/QtCore/qobject_tr_as_instance_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QObject's tr static methods.''' diff --git a/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py b/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py index d887029ac..7365e7212 100644 --- a/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py +++ b/sources/pyside6/tests/QtCore/qoperatingsystemversion_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qpoint_test.py b/sources/pyside6/tests/QtCore/qpoint_test.py index b9d5afa37..9770b5662 100644 --- a/sources/pyside6/tests/QtCore/qpoint_test.py +++ b/sources/pyside6/tests/QtCore/qpoint_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QPoint and QPointF''' diff --git a/sources/pyside6/tests/QtCore/qprocess_test.py b/sources/pyside6/tests/QtCore/qprocess_test.py index ba4d29102..6466b8575 100644 --- a/sources/pyside6/tests/QtCore/qprocess_test.py +++ b/sources/pyside6/tests/QtCore/qprocess_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QProcess''' diff --git a/sources/pyside6/tests/QtCore/qproperty_decorator.py b/sources/pyside6/tests/QtCore/qproperty_decorator.py index 19f2bd251..7d6fbc91d 100644 --- a/sources/pyside6/tests/QtCore/qproperty_decorator.py +++ b/sources/pyside6/tests/QtCore/qproperty_decorator.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtCore/qrandomgenerator_test.py b/sources/pyside6/tests/QtCore/qrandomgenerator_test.py index c13a8b24a..6ae69b6b3 100644 --- a/sources/pyside6/tests/QtCore/qrandomgenerator_test.py +++ b/sources/pyside6/tests/QtCore/qrandomgenerator_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qrect_test.py b/sources/pyside6/tests/QtCore/qrect_test.py index 8a14abc5a..fb91654f2 100644 --- a/sources/pyside6/tests/QtCore/qrect_test.py +++ b/sources/pyside6/tests/QtCore/qrect_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QRect''' diff --git a/sources/pyside6/tests/QtCore/qregularexpression_test.py b/sources/pyside6/tests/QtCore/qregularexpression_test.py index a88c2dc24..ae7281d75 100644 --- a/sources/pyside6/tests/QtCore/qregularexpression_test.py +++ b/sources/pyside6/tests/QtCore/qregularexpression_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QRegularExpression''' diff --git a/sources/pyside6/tests/QtCore/qresource_test.py b/sources/pyside6/tests/QtCore/qresource_test.py index 1cdd2c785..0f7b920e8 100644 --- a/sources/pyside6/tests/QtCore/qresource_test.py +++ b/sources/pyside6/tests/QtCore/qresource_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QResource usage''' diff --git a/sources/pyside6/tests/QtCore/qrunnable_test.py b/sources/pyside6/tests/QtCore/qrunnable_test.py index d52f50ce1..1b743a8e9 100644 --- a/sources/pyside6/tests/QtCore/qrunnable_test.py +++ b/sources/pyside6/tests/QtCore/qrunnable_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QRunnable''' diff --git a/sources/pyside6/tests/QtCore/qsettings_test.py b/sources/pyside6/tests/QtCore/qsettings_test.py index 64ceffd70..5f86c9fbb 100644 --- a/sources/pyside6/tests/QtCore/qsettings_test.py +++ b/sources/pyside6/tests/QtCore/qsettings_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QDate''' diff --git a/sources/pyside6/tests/QtCore/qsharedmemory_client.py b/sources/pyside6/tests/QtCore/qsharedmemory_client.py index d16c36da9..05640d7fe 100644 --- a/sources/pyside6/tests/QtCore/qsharedmemory_client.py +++ b/sources/pyside6/tests/QtCore/qsharedmemory_client.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Client for the unit test of QSharedMemory''' diff --git a/sources/pyside6/tests/QtCore/qsharedmemory_test.py b/sources/pyside6/tests/QtCore/qsharedmemory_test.py index ed8a47939..9ec976ac6 100644 --- a/sources/pyside6/tests/QtCore/qsharedmemory_test.py +++ b/sources/pyside6/tests/QtCore/qsharedmemory_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QSharedMemory''' diff --git a/sources/pyside6/tests/QtCore/qsize_test.py b/sources/pyside6/tests/QtCore/qsize_test.py index bc324ba73..3de779bd6 100644 --- a/sources/pyside6/tests/QtCore/qsize_test.py +++ b/sources/pyside6/tests/QtCore/qsize_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QSize''' diff --git a/sources/pyside6/tests/QtCore/qslot_object_test.py b/sources/pyside6/tests/QtCore/qslot_object_test.py index a95afb090..5412680df 100644 --- a/sources/pyside6/tests/QtCore/qslot_object_test.py +++ b/sources/pyside6/tests/QtCore/qslot_object_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qsocketnotifier_test.py b/sources/pyside6/tests/QtCore/qsocketnotifier_test.py index 2e812947c..beb90314a 100644 --- a/sources/pyside6/tests/QtCore/qsocketnotifier_test.py +++ b/sources/pyside6/tests/QtCore/qsocketnotifier_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QUuid''' diff --git a/sources/pyside6/tests/QtCore/qsrand_test.py b/sources/pyside6/tests/QtCore/qsrand_test.py index fef44261b..d0e071dcf 100644 --- a/sources/pyside6/tests/QtCore/qsrand_test.py +++ b/sources/pyside6/tests/QtCore/qsrand_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtCore/qstandardpaths_test.py b/sources/pyside6/tests/QtCore/qstandardpaths_test.py index b8274769b..0846e2a68 100644 --- a/sources/pyside6/tests/QtCore/qstandardpaths_test.py +++ b/sources/pyside6/tests/QtCore/qstandardpaths_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QStandardPaths''' diff --git a/sources/pyside6/tests/QtCore/qstorageinfo_test.py b/sources/pyside6/tests/QtCore/qstorageinfo_test.py index 5869d9f00..44b3ce303 100644 --- a/sources/pyside6/tests/QtCore/qstorageinfo_test.py +++ b/sources/pyside6/tests/QtCore/qstorageinfo_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QStorageInfo''' diff --git a/sources/pyside6/tests/QtCore/qstring_test.py b/sources/pyside6/tests/QtCore/qstring_test.py index d740eeeef..397dceb1e 100644 --- a/sources/pyside6/tests/QtCore/qstring_test.py +++ b/sources/pyside6/tests/QtCore/qstring_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QString''' diff --git a/sources/pyside6/tests/QtCore/qsysinfo_test.py b/sources/pyside6/tests/QtCore/qsysinfo_test.py index 602852fab..71a39bb5d 100644 --- a/sources/pyside6/tests/QtCore/qsysinfo_test.py +++ b/sources/pyside6/tests/QtCore/qsysinfo_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qtextstream_test.py b/sources/pyside6/tests/QtCore/qtextstream_test.py index d4ed94e14..99aae2187 100644 --- a/sources/pyside6/tests/QtCore/qtextstream_test.py +++ b/sources/pyside6/tests/QtCore/qtextstream_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QTextStream''' diff --git a/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py b/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py index a179c936f..6fbc8432e 100644 --- a/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py +++ b/sources/pyside6/tests/QtCore/qthread_prod_cons_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Producer-Consumer test/example with QThread''' diff --git a/sources/pyside6/tests/QtCore/qthread_signal_test.py b/sources/pyside6/tests/QtCore/qthread_signal_test.py index 4e312dcc8..93c83ea6e 100644 --- a/sources/pyside6/tests/QtCore/qthread_signal_test.py +++ b/sources/pyside6/tests/QtCore/qthread_signal_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for connecting signals between threads''' diff --git a/sources/pyside6/tests/QtCore/qthread_test.py b/sources/pyside6/tests/QtCore/qthread_test.py index 4d26e0597..856283a23 100644 --- a/sources/pyside6/tests/QtCore/qthread_test.py +++ b/sources/pyside6/tests/QtCore/qthread_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QThread''' diff --git a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py index 2ccaa300e..9b187104c 100644 --- a/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py +++ b/sources/pyside6/tests/QtCore/qtimer_singleshot_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QTimer.singleShot''' diff --git a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py index 70f151989..985ba9d76 100644 --- a/sources/pyside6/tests/QtCore/qtimer_timeout_test.py +++ b/sources/pyside6/tests/QtCore/qtimer_timeout_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for timeout() signals from QTimer object.''' diff --git a/sources/pyside6/tests/QtCore/qtimezone_test.py b/sources/pyside6/tests/QtCore/qtimezone_test.py index ad953f1cc..3bfadc662 100644 --- a/sources/pyside6/tests/QtCore/qtimezone_test.py +++ b/sources/pyside6/tests/QtCore/qtimezone_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/qtnamespace_test.py b/sources/pyside6/tests/QtCore/qtnamespace_test.py index c08c727ec..3e41a87b5 100644 --- a/sources/pyside6/tests/QtCore/qtnamespace_test.py +++ b/sources/pyside6/tests/QtCore/qtnamespace_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test suite for QtCore.Qt namespace''' diff --git a/sources/pyside6/tests/QtCore/qurl_test.py b/sources/pyside6/tests/QtCore/qurl_test.py index df16c74e0..1e9310fe7 100644 --- a/sources/pyside6/tests/QtCore/qurl_test.py +++ b/sources/pyside6/tests/QtCore/qurl_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test suite for QtCore.QUrl''' diff --git a/sources/pyside6/tests/QtCore/qurlquery_test.py b/sources/pyside6/tests/QtCore/qurlquery_test.py index 36eb29475..d510908d9 100644 --- a/sources/pyside6/tests/QtCore/qurlquery_test.py +++ b/sources/pyside6/tests/QtCore/qurlquery_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QUrlQuery''' diff --git a/sources/pyside6/tests/QtCore/quuid_test.py b/sources/pyside6/tests/QtCore/quuid_test.py index 45c6fc89d..c4a3f8311 100644 --- a/sources/pyside6/tests/QtCore/quuid_test.py +++ b/sources/pyside6/tests/QtCore/quuid_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QUuid''' diff --git a/sources/pyside6/tests/QtCore/qversionnumber_test.py b/sources/pyside6/tests/QtCore/qversionnumber_test.py index 23f6ba639..db259646b 100644 --- a/sources/pyside6/tests/QtCore/qversionnumber_test.py +++ b/sources/pyside6/tests/QtCore/qversionnumber_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QVersionNumber''' diff --git a/sources/pyside6/tests/QtCore/repr_test.py b/sources/pyside6/tests/QtCore/repr_test.py index 87cceaa82..cf3ebd6a6 100644 --- a/sources/pyside6/tests/QtCore/repr_test.py +++ b/sources/pyside6/tests/QtCore/repr_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/resources_mc.py b/sources/pyside6/tests/QtCore/resources_mc.py index 05766a22a..36f596cc1 100644 --- a/sources/pyside6/tests/QtCore/resources_mc.py +++ b/sources/pyside6/tests/QtCore/resources_mc.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations # Resource object code # diff --git a/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py b/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py index de8f67bb3..2fda6640c 100644 --- a/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py +++ b/sources/pyside6/tests/QtCore/setprop_on_ctor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/signal_sender.py b/sources/pyside6/tests/QtCore/signal_sender.py index 2552591e5..464c50e3d 100644 --- a/sources/pyside6/tests/QtCore/signal_sender.py +++ b/sources/pyside6/tests/QtCore/signal_sender.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py index 82087ab9a..f14cf21e2 100644 --- a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py +++ b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/staticMetaObject_test.py b/sources/pyside6/tests/QtCore/staticMetaObject_test.py index 223c334d3..0fd207b41 100644 --- a/sources/pyside6/tests/QtCore/staticMetaObject_test.py +++ b/sources/pyside6/tests/QtCore/staticMetaObject_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtCore/static_method_test.py b/sources/pyside6/tests/QtCore/static_method_test.py index bbf96e44a..7515c5f6f 100644 --- a/sources/pyside6/tests/QtCore/static_method_test.py +++ b/sources/pyside6/tests/QtCore/static_method_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for overloads involving static and non-static versions of a method.''' diff --git a/sources/pyside6/tests/QtCore/thread_signals_test.py b/sources/pyside6/tests/QtCore/thread_signals_test.py index a453d1ac1..ffef4cda0 100644 --- a/sources/pyside6/tests/QtCore/thread_signals_test.py +++ b/sources/pyside6/tests/QtCore/thread_signals_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test case for QObject.signalsBlocked() and blockSignal()''' diff --git a/sources/pyside6/tests/QtCore/tr_noop_test.py b/sources/pyside6/tests/QtCore/tr_noop_test.py index a3b2e257f..7340660be 100644 --- a/sources/pyside6/tests/QtCore/tr_noop_test.py +++ b/sources/pyside6/tests/QtCore/tr_noop_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtCore/translation_test.py b/sources/pyside6/tests/QtCore/translation_test.py index da09e47b6..07f1fa580 100644 --- a/sources/pyside6/tests/QtCore/translation_test.py +++ b/sources/pyside6/tests/QtCore/translation_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests to test QTranslator and translation in general.''' diff --git a/sources/pyside6/tests/QtCore/unaryoperator_test.py b/sources/pyside6/tests/QtCore/unaryoperator_test.py index 7b38685c8..2a935afc2 100644 --- a/sources/pyside6/tests/QtCore/unaryoperator_test.py +++ b/sources/pyside6/tests/QtCore/unaryoperator_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests the presence of unary operator __neg__ on the QPoint class''' diff --git a/sources/pyside6/tests/QtCore/unicode_test.py b/sources/pyside6/tests/QtCore/unicode_test.py index 73ce96c77..b45c8bedf 100644 --- a/sources/pyside6/tests/QtCore/unicode_test.py +++ b/sources/pyside6/tests/QtCore/unicode_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QString conversion to/from Python Unicode''' diff --git a/sources/pyside6/tests/QtCore/versioninfo_test.py b/sources/pyside6/tests/QtCore/versioninfo_test.py index 63414378a..342c3adf0 100644 --- a/sources/pyside6/tests/QtCore/versioninfo_test.py +++ b/sources/pyside6/tests/QtCore/versioninfo_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtDBus/test_dbus.py b/sources/pyside6/tests/QtDBus/test_dbus.py index a37db9421..452934271 100644 --- a/sources/pyside6/tests/QtDBus/test_dbus.py +++ b/sources/pyside6/tests/QtDBus/test_dbus.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QDBus''' diff --git a/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py b/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py index 98ada6d47..bfa497eb4 100644 --- a/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py +++ b/sources/pyside6/tests/QtDataVisualization/datavisualization_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtDataVisualization''' diff --git a/sources/pyside6/tests/QtGui/bug_1091.py b/sources/pyside6/tests/QtGui/bug_1091.py index 9b9f35807..b1e2f0b09 100644 --- a/sources/pyside6/tests/QtGui/bug_1091.py +++ b/sources/pyside6/tests/QtGui/bug_1091.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' unit test for BUG #1091 ''' diff --git a/sources/pyside6/tests/QtGui/bug_367.py b/sources/pyside6/tests/QtGui/bug_367.py index 771fa5a4b..1b447be72 100644 --- a/sources/pyside6/tests/QtGui/bug_367.py +++ b/sources/pyside6/tests/QtGui/bug_367.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 367: http://bugs.openbossa.org/show_bug.cgi?id=367''' diff --git a/sources/pyside6/tests/QtGui/bug_493.py b/sources/pyside6/tests/QtGui/bug_493.py index ba8b67bbb..faf265755 100644 --- a/sources/pyside6/tests/QtGui/bug_493.py +++ b/sources/pyside6/tests/QtGui/bug_493.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/bug_606.py b/sources/pyside6/tests/QtGui/bug_606.py index 80b79f640..332c207c6 100644 --- a/sources/pyside6/tests/QtGui/bug_606.py +++ b/sources/pyside6/tests/QtGui/bug_606.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/bug_617.py b/sources/pyside6/tests/QtGui/bug_617.py index d90d1e754..fb793e6ee 100644 --- a/sources/pyside6/tests/QtGui/bug_617.py +++ b/sources/pyside6/tests/QtGui/bug_617.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/bug_652.py b/sources/pyside6/tests/QtGui/bug_652.py index 17d6c3b77..77b5d5251 100644 --- a/sources/pyside6/tests/QtGui/bug_652.py +++ b/sources/pyside6/tests/QtGui/bug_652.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtGui/bug_660.py b/sources/pyside6/tests/QtGui/bug_660.py index 4ab8e9f19..e45b40596 100644 --- a/sources/pyside6/tests/QtGui/bug_660.py +++ b/sources/pyside6/tests/QtGui/bug_660.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/bug_716.py b/sources/pyside6/tests/QtGui/bug_716.py index 90d78ea89..fd5745078 100644 --- a/sources/pyside6/tests/QtGui/bug_716.py +++ b/sources/pyside6/tests/QtGui/bug_716.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/bug_740.py b/sources/pyside6/tests/QtGui/bug_740.py index ece314cc8..c1b41c2ab 100644 --- a/sources/pyside6/tests/QtGui/bug_740.py +++ b/sources/pyside6/tests/QtGui/bug_740.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/bug_743.py b/sources/pyside6/tests/QtGui/bug_743.py index a870e4bf1..127981f1f 100644 --- a/sources/pyside6/tests/QtGui/bug_743.py +++ b/sources/pyside6/tests/QtGui/bug_743.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/bug_785.py b/sources/pyside6/tests/QtGui/bug_785.py index 04425f063..a218398a9 100644 --- a/sources/pyside6/tests/QtGui/bug_785.py +++ b/sources/pyside6/tests/QtGui/bug_785.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/bug_991.py b/sources/pyside6/tests/QtGui/bug_991.py index e74adc198..2bac8f542 100644 --- a/sources/pyside6/tests/QtGui/bug_991.py +++ b/sources/pyside6/tests/QtGui/bug_991.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py b/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py index 6519eef61..bd5ab4ba0 100644 --- a/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py +++ b/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for PYSIDE-344, imul/idiv are used instead of mul/div, modifying the argument passed in''' diff --git a/sources/pyside6/tests/QtGui/deepcopy_test.py b/sources/pyside6/tests/QtGui/deepcopy_test.py index 9a13eb485..b53b34ade 100644 --- a/sources/pyside6/tests/QtGui/deepcopy_test.py +++ b/sources/pyside6/tests/QtGui/deepcopy_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations from copy import deepcopy import os diff --git a/sources/pyside6/tests/QtGui/event_filter_test.py b/sources/pyside6/tests/QtGui/event_filter_test.py index 01d8fbc02..ff894dbd0 100644 --- a/sources/pyside6/tests/QtGui/event_filter_test.py +++ b/sources/pyside6/tests/QtGui/event_filter_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py index ba438f8e0..e26d43254 100644 --- a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py +++ b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QImage''' diff --git a/sources/pyside6/tests/QtGui/pyside_reload_test.py b/sources/pyside6/tests/QtGui/pyside_reload_test.py index 1ac65f709..1045dd5be 100644 --- a/sources/pyside6/tests/QtGui/pyside_reload_test.py +++ b/sources/pyside6/tests/QtGui/pyside_reload_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import importlib import importlib.util diff --git a/sources/pyside6/tests/QtGui/qbrush_test.py b/sources/pyside6/tests/QtGui/qbrush_test.py index 69262328b..997ffc152 100644 --- a/sources/pyside6/tests/QtGui/qbrush_test.py +++ b/sources/pyside6/tests/QtGui/qbrush_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QBrush''' diff --git a/sources/pyside6/tests/QtGui/qcolor_reduce_test.py b/sources/pyside6/tests/QtGui/qcolor_reduce_test.py index 609951be6..a99ad6458 100644 --- a/sources/pyside6/tests/QtGui/qcolor_reduce_test.py +++ b/sources/pyside6/tests/QtGui/qcolor_reduce_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import pickle diff --git a/sources/pyside6/tests/QtGui/qcolor_test.py b/sources/pyside6/tests/QtGui/qcolor_test.py index bbd558f10..d98fcc9b4 100644 --- a/sources/pyside6/tests/QtGui/qcolor_test.py +++ b/sources/pyside6/tests/QtGui/qcolor_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import colorsys import gc diff --git a/sources/pyside6/tests/QtGui/qcursor_test.py b/sources/pyside6/tests/QtGui/qcursor_test.py index 1494fe370..80964efb8 100644 --- a/sources/pyside6/tests/QtGui/qcursor_test.py +++ b/sources/pyside6/tests/QtGui/qcursor_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test for Bug 630 - Fails to resolve overload for QCursor(QBitmap, QBitmap, int, int) http://bugs.openbossa.org/show_bug.cgi?id=630 diff --git a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py index f2c86abf7..8de7160e9 100644 --- a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py +++ b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qdesktopservices_test.py b/sources/pyside6/tests/QtGui/qdesktopservices_test.py index 8d578152d..668a16a80 100644 --- a/sources/pyside6/tests/QtGui/qdesktopservices_test.py +++ b/sources/pyside6/tests/QtGui/qdesktopservices_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QDesktopServices''' diff --git a/sources/pyside6/tests/QtGui/qfont_test.py b/sources/pyside6/tests/QtGui/qfont_test.py index f81d47ec6..1971cc555 100644 --- a/sources/pyside6/tests/QtGui/qfont_test.py +++ b/sources/pyside6/tests/QtGui/qfont_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qfontmetrics_test.py b/sources/pyside6/tests/QtGui/qfontmetrics_test.py index 98c4c8f96..257a3dae3 100644 --- a/sources/pyside6/tests/QtGui/qfontmetrics_test.py +++ b/sources/pyside6/tests/QtGui/qfontmetrics_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for inject codes and modifications on QFontMetrics and QFontMetricsF''' diff --git a/sources/pyside6/tests/QtGui/qguiapplication_test.py b/sources/pyside6/tests/QtGui/qguiapplication_test.py index a3d0942aa..4112cd695 100644 --- a/sources/pyside6/tests/QtGui/qguiapplication_test.py +++ b/sources/pyside6/tests/QtGui/qguiapplication_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qicon_test.py b/sources/pyside6/tests/QtGui/qicon_test.py index 18ef3d815..ac83ee297 100644 --- a/sources/pyside6/tests/QtGui/qicon_test.py +++ b/sources/pyside6/tests/QtGui/qicon_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qimage_test.py b/sources/pyside6/tests/QtGui/qimage_test.py index 5912bf318..c87cfcf4b 100644 --- a/sources/pyside6/tests/QtGui/qimage_test.py +++ b/sources/pyside6/tests/QtGui/qimage_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QImage''' diff --git a/sources/pyside6/tests/QtGui/qimage_win_test.py b/sources/pyside6/tests/QtGui/qimage_win_test.py index 2d9cb96f1..f8ceb4aa9 100644 --- a/sources/pyside6/tests/QtGui/qimage_win_test.py +++ b/sources/pyside6/tests/QtGui/qimage_win_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QImage/Windows''' diff --git a/sources/pyside6/tests/QtGui/qitemselection_test.py b/sources/pyside6/tests/QtGui/qitemselection_test.py index 179bff745..26fd76ad8 100644 --- a/sources/pyside6/tests/QtGui/qitemselection_test.py +++ b/sources/pyside6/tests/QtGui/qitemselection_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qkeysequence_test.py b/sources/pyside6/tests/QtGui/qkeysequence_test.py index 3d72fb50a..a6f3188d4 100644 --- a/sources/pyside6/tests/QtGui/qkeysequence_test.py +++ b/sources/pyside6/tests/QtGui/qkeysequence_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qpainter_test.py b/sources/pyside6/tests/QtGui/qpainter_test.py index 103b91ad6..e03bcfa63 100644 --- a/sources/pyside6/tests/QtGui/qpainter_test.py +++ b/sources/pyside6/tests/QtGui/qpainter_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtGui/qpdfwriter_test.py b/sources/pyside6/tests/QtGui/qpdfwriter_test.py index 2dca2aca2..1379f8e80 100644 --- a/sources/pyside6/tests/QtGui/qpdfwriter_test.py +++ b/sources/pyside6/tests/QtGui/qpdfwriter_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qpen_test.py b/sources/pyside6/tests/QtGui/qpen_test.py index 7e8604606..2f4d48e16 100644 --- a/sources/pyside6/tests/QtGui/qpen_test.py +++ b/sources/pyside6/tests/QtGui/qpen_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qpixelformat_test.py b/sources/pyside6/tests/QtGui/qpixelformat_test.py index 869d15952..32d34a577 100644 --- a/sources/pyside6/tests/QtGui/qpixelformat_test.py +++ b/sources/pyside6/tests/QtGui/qpixelformat_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit test for QPixelFormat''' diff --git a/sources/pyside6/tests/QtGui/qpixmap_constructor.py b/sources/pyside6/tests/QtGui/qpixmap_constructor.py index dd658af52..e78774eec 100644 --- a/sources/pyside6/tests/QtGui/qpixmap_constructor.py +++ b/sources/pyside6/tests/QtGui/qpixmap_constructor.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qpixmap_test.py b/sources/pyside6/tests/QtGui/qpixmap_test.py index b80ae2ad5..b83831ba9 100644 --- a/sources/pyside6/tests/QtGui/qpixmap_test.py +++ b/sources/pyside6/tests/QtGui/qpixmap_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qpixmapcache_test.py b/sources/pyside6/tests/QtGui/qpixmapcache_test.py index 2ecb439d3..b9328bc05 100644 --- a/sources/pyside6/tests/QtGui/qpixmapcache_test.py +++ b/sources/pyside6/tests/QtGui/qpixmapcache_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qpolygonf_test.py b/sources/pyside6/tests/QtGui/qpolygonf_test.py index 8a283fddc..ea5a73db8 100644 --- a/sources/pyside6/tests/QtGui/qpolygonf_test.py +++ b/sources/pyside6/tests/QtGui/qpolygonf_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qradialgradient_test.py b/sources/pyside6/tests/QtGui/qradialgradient_test.py index ebab42b15..5c48cf3eb 100644 --- a/sources/pyside6/tests/QtGui/qradialgradient_test.py +++ b/sources/pyside6/tests/QtGui/qradialgradient_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qrasterwindow_test.py b/sources/pyside6/tests/QtGui/qrasterwindow_test.py index 4920902d5..038ce8836 100644 --- a/sources/pyside6/tests/QtGui/qrasterwindow_test.py +++ b/sources/pyside6/tests/QtGui/qrasterwindow_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit test for QBackingStore, QRasterWindow and QStaticText''' diff --git a/sources/pyside6/tests/QtGui/qregion_test.py b/sources/pyside6/tests/QtGui/qregion_test.py index df14fc3e0..97410f925 100644 --- a/sources/pyside6/tests/QtGui/qregion_test.py +++ b/sources/pyside6/tests/QtGui/qregion_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qshortcut_test.py b/sources/pyside6/tests/QtGui/qshortcut_test.py index f2650589a..91bf1cd18 100644 --- a/sources/pyside6/tests/QtGui/qshortcut_test.py +++ b/sources/pyside6/tests/QtGui/qshortcut_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test the QShortcut constructor''' diff --git a/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py b/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py index 55aca9113..05cf5db10 100644 --- a/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py +++ b/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py b/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py index f68374263..f5410b367 100644 --- a/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py +++ b/sources/pyside6/tests/QtGui/qstring_qkeysequence_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests conversions of QString to and from QKeySequence.''' diff --git a/sources/pyside6/tests/QtGui/qstylehints_test.py b/sources/pyside6/tests/QtGui/qstylehints_test.py index d2b21d30d..213bdf8b1 100644 --- a/sources/pyside6/tests/QtGui/qstylehints_test.py +++ b/sources/pyside6/tests/QtGui/qstylehints_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit test for QStyleHints''' diff --git a/sources/pyside6/tests/QtGui/qtextdocument_functions.py b/sources/pyside6/tests/QtGui/qtextdocument_functions.py index 2ac72df56..0350c93ac 100644 --- a/sources/pyside6/tests/QtGui/qtextdocument_functions.py +++ b/sources/pyside6/tests/QtGui/qtextdocument_functions.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py b/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py index b74c6704f..e96c14a22 100644 --- a/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py +++ b/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py b/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py index 4f72b98e7..b8401d960 100644 --- a/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py +++ b/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qtextline_test.py b/sources/pyside6/tests/QtGui/qtextline_test.py index c34a4c98a..7b8032e9b 100644 --- a/sources/pyside6/tests/QtGui/qtextline_test.py +++ b/sources/pyside6/tests/QtGui/qtextline_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/qtransform_test.py b/sources/pyside6/tests/QtGui/qtransform_test.py index dc51a74e6..0bc28c330 100644 --- a/sources/pyside6/tests/QtGui/qtransform_test.py +++ b/sources/pyside6/tests/QtGui/qtransform_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/repr_test.py b/sources/pyside6/tests/QtGui/repr_test.py index 2858e7175..5bf8ade37 100644 --- a/sources/pyside6/tests/QtGui/repr_test.py +++ b/sources/pyside6/tests/QtGui/repr_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py index 6e9a661ce..232f90c92 100644 --- a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py +++ b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtGui/xpm_data.py b/sources/pyside6/tests/QtGui/xpm_data.py index 3603d8190..d5502d170 100644 --- a/sources/pyside6/tests/QtGui/xpm_data.py +++ b/sources/pyside6/tests/QtGui/xpm_data.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test data for QImage''' diff --git a/sources/pyside6/tests/QtHelp/help_test.py b/sources/pyside6/tests/QtHelp/help_test.py index 4ded7763c..9e5c879da 100644 --- a/sources/pyside6/tests/QtHelp/help_test.py +++ b/sources/pyside6/tests/QtHelp/help_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtHelp/helpsearchengine_test.py b/sources/pyside6/tests/QtHelp/helpsearchengine_test.py index b25e643f6..fed84febf 100644 --- a/sources/pyside6/tests/QtHelp/helpsearchengine_test.py +++ b/sources/pyside6/tests/QtHelp/helpsearchengine_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtLocation/location.py b/sources/pyside6/tests/QtLocation/location.py index 8fbd55f02..d2297af63 100644 --- a/sources/pyside6/tests/QtLocation/location.py +++ b/sources/pyside6/tests/QtLocation/location.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit test for Location''' diff --git a/sources/pyside6/tests/QtMultimedia/audio_test.py b/sources/pyside6/tests/QtMultimedia/audio_test.py index af359e525..4469e9ab2 100644 --- a/sources/pyside6/tests/QtMultimedia/audio_test.py +++ b/sources/pyside6/tests/QtMultimedia/audio_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QHttp''' diff --git a/sources/pyside6/tests/QtMultimediaWidgets/qmultimediawidgets.py b/sources/pyside6/tests/QtMultimediaWidgets/qmultimediawidgets.py index 968558a13..a25ab3e3f 100644 --- a/sources/pyside6/tests/QtMultimediaWidgets/qmultimediawidgets.py +++ b/sources/pyside6/tests/QtMultimediaWidgets/qmultimediawidgets.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtMultimediaWidgets''' diff --git a/sources/pyside6/tests/QtNetwork/accessManager_test.py b/sources/pyside6/tests/QtNetwork/accessManager_test.py index 87711b278..3aab2fee5 100644 --- a/sources/pyside6/tests/QtNetwork/accessManager_test.py +++ b/sources/pyside6/tests/QtNetwork/accessManager_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QHttp''' diff --git a/sources/pyside6/tests/QtNetwork/bug_1084.py b/sources/pyside6/tests/QtNetwork/bug_1084.py index 515220c80..892bf0324 100644 --- a/sources/pyside6/tests/QtNetwork/bug_1084.py +++ b/sources/pyside6/tests/QtNetwork/bug_1084.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' unit test for BUG #1084 ''' diff --git a/sources/pyside6/tests/QtNetwork/bug_446.py b/sources/pyside6/tests/QtNetwork/bug_446.py index f28ddb369..861cff77b 100644 --- a/sources/pyside6/tests/QtNetwork/bug_446.py +++ b/sources/pyside6/tests/QtNetwork/bug_446.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtNetwork/dnslookup_test.py b/sources/pyside6/tests/QtNetwork/dnslookup_test.py index c50a6b5d4..d05f614fd 100644 --- a/sources/pyside6/tests/QtNetwork/dnslookup_test.py +++ b/sources/pyside6/tests/QtNetwork/dnslookup_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QDnsLookup''' diff --git a/sources/pyside6/tests/QtNetwork/qhostinfo_test.py b/sources/pyside6/tests/QtNetwork/qhostinfo_test.py index 8d8d2cae4..19aac4f30 100644 --- a/sources/pyside6/tests/QtNetwork/qhostinfo_test.py +++ b/sources/pyside6/tests/QtNetwork/qhostinfo_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for QHostInfo.''' diff --git a/sources/pyside6/tests/QtNetwork/qipv6address_test.py b/sources/pyside6/tests/QtNetwork/qipv6address_test.py index 67b103d3c..6cd3f1993 100644 --- a/sources/pyside6/tests/QtNetwork/qipv6address_test.py +++ b/sources/pyside6/tests/QtNetwork/qipv6address_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QIPv6Address''' diff --git a/sources/pyside6/tests/QtNetwork/qpassworddigestor_test.py b/sources/pyside6/tests/QtNetwork/qpassworddigestor_test.py index db7a90da9..dfeaea86a 100644 --- a/sources/pyside6/tests/QtNetwork/qpassworddigestor_test.py +++ b/sources/pyside6/tests/QtNetwork/qpassworddigestor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QPasswordDigestor''' diff --git a/sources/pyside6/tests/QtNetwork/tcpserver_test.py b/sources/pyside6/tests/QtNetwork/tcpserver_test.py index 845afdfae..7d1b127d2 100644 --- a/sources/pyside6/tests/QtNetwork/tcpserver_test.py +++ b/sources/pyside6/tests/QtNetwork/tcpserver_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QTCPServer''' diff --git a/sources/pyside6/tests/QtNetwork/udpsocket_test.py b/sources/pyside6/tests/QtNetwork/udpsocket_test.py index 950849801..fc92c6f2c 100644 --- a/sources/pyside6/tests/QtNetwork/udpsocket_test.py +++ b/sources/pyside6/tests/QtNetwork/udpsocket_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QUdpSocket''' diff --git a/sources/pyside6/tests/QtNfc/test_nfc.py b/sources/pyside6/tests/QtNfc/test_nfc.py index a73c52153..2a2053a97 100644 --- a/sources/pyside6/tests/QtNfc/test_nfc.py +++ b/sources/pyside6/tests/QtNfc/test_nfc.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtNfc''' diff --git a/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py b/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py index e4ff6feb4..a1433ca4c 100644 --- a/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py +++ b/sources/pyside6/tests/QtOpenGL/qopenglbuffer_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit tests for QOpenGLBuffer''' diff --git a/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py b/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py index 3e6bc4c9d..88ae85a2e 100644 --- a/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py +++ b/sources/pyside6/tests/QtOpenGL/qopenglwindow_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit test for QOpenGLContext, QOpenGLTexture, QOpenGLWindow and related classes''' diff --git a/sources/pyside6/tests/QtPositioning/positioning.py b/sources/pyside6/tests/QtPositioning/positioning.py index d8e670247..4538895eb 100644 --- a/sources/pyside6/tests/QtPositioning/positioning.py +++ b/sources/pyside6/tests/QtPositioning/positioning.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit test for Positioning''' diff --git a/sources/pyside6/tests/QtPrintSupport/bug_500.py b/sources/pyside6/tests/QtPrintSupport/bug_500.py index 1ba5b35e2..aaeb249fa 100644 --- a/sources/pyside6/tests/QtPrintSupport/bug_500.py +++ b/sources/pyside6/tests/QtPrintSupport/bug_500.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtPrintSupport/returnquadruplesofnumbers_test.py b/sources/pyside6/tests/QtPrintSupport/returnquadruplesofnumbers_test.py index 97b3505da..cac218b26 100644 --- a/sources/pyside6/tests/QtPrintSupport/returnquadruplesofnumbers_test.py +++ b/sources/pyside6/tests/QtPrintSupport/returnquadruplesofnumbers_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/bug_1029.py b/sources/pyside6/tests/QtQml/bug_1029.py index 69ca5c18d..21896a899 100644 --- a/sources/pyside6/tests/QtQml/bug_1029.py +++ b/sources/pyside6/tests/QtQml/bug_1029.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtQml/bug_451.py b/sources/pyside6/tests/QtQml/bug_451.py index d81a99d94..81537b4a5 100644 --- a/sources/pyside6/tests/QtQml/bug_451.py +++ b/sources/pyside6/tests/QtQml/bug_451.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 451: http://bugs.openbossa.org/show_bug.cgi?id=451 diff --git a/sources/pyside6/tests/QtQml/bug_456.py b/sources/pyside6/tests/QtQml/bug_456.py index 7743ee3fd..02ab16ebf 100644 --- a/sources/pyside6/tests/QtQml/bug_456.py +++ b/sources/pyside6/tests/QtQml/bug_456.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/bug_557.py b/sources/pyside6/tests/QtQml/bug_557.py index eb43973f6..e1e2b1cb4 100644 --- a/sources/pyside6/tests/QtQml/bug_557.py +++ b/sources/pyside6/tests/QtQml/bug_557.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/bug_726.py b/sources/pyside6/tests/QtQml/bug_726.py index 56c1e70f1..b0a2fb4ed 100644 --- a/sources/pyside6/tests/QtQml/bug_726.py +++ b/sources/pyside6/tests/QtQml/bug_726.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/bug_814.py b/sources/pyside6/tests/QtQml/bug_814.py index 0e7858b6c..2a3f5aa6f 100644 --- a/sources/pyside6/tests/QtQml/bug_814.py +++ b/sources/pyside6/tests/QtQml/bug_814.py @@ -2,6 +2,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # Copyright (C) 2011 Thomas Perl <m@thp.io> # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations # Test case for PySide bug 814 # http://bugs.pyside.org/show_bug.cgi?id=814 diff --git a/sources/pyside6/tests/QtQml/bug_825.py b/sources/pyside6/tests/QtQml/bug_825.py index a8bd304ec..66e278796 100644 --- a/sources/pyside6/tests/QtQml/bug_825.py +++ b/sources/pyside6/tests/QtQml/bug_825.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ This is the corrected version for Python 3. diff --git a/sources/pyside6/tests/QtQml/bug_825_old.py b/sources/pyside6/tests/QtQml/bug_825_old.py index c44fa75f4..c87651d72 100644 --- a/sources/pyside6/tests/QtQml/bug_825_old.py +++ b/sources/pyside6/tests/QtQml/bug_825_old.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ This is the now incorrect old version from Python 2. diff --git a/sources/pyside6/tests/QtQml/bug_847.py b/sources/pyside6/tests/QtQml/bug_847.py index 947eb494e..55e3d1d9b 100644 --- a/sources/pyside6/tests/QtQml/bug_847.py +++ b/sources/pyside6/tests/QtQml/bug_847.py @@ -2,6 +2,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # Copyright (C) 2011 Thomas Perl <m@thp.io> # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations # Testcase for PySide bug 847 # Released under the same terms as PySide itself diff --git a/sources/pyside6/tests/QtQml/bug_915.py b/sources/pyside6/tests/QtQml/bug_915.py index 3095eba2a..1962db120 100644 --- a/sources/pyside6/tests/QtQml/bug_915.py +++ b/sources/pyside6/tests/QtQml/bug_915.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/bug_926.py b/sources/pyside6/tests/QtQml/bug_926.py index 085e9a68f..f15860c46 100644 --- a/sources/pyside6/tests/QtQml/bug_926.py +++ b/sources/pyside6/tests/QtQml/bug_926.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import sys import os diff --git a/sources/pyside6/tests/QtQml/bug_951.py b/sources/pyside6/tests/QtQml/bug_951.py index 8a512d06f..5cb4bb538 100644 --- a/sources/pyside6/tests/QtQml/bug_951.py +++ b/sources/pyside6/tests/QtQml/bug_951.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/bug_995.py b/sources/pyside6/tests/QtQml/bug_995.py index 868c584e2..490f0ccc1 100644 --- a/sources/pyside6/tests/QtQml/bug_995.py +++ b/sources/pyside6/tests/QtQml/bug_995.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/bug_997.py b/sources/pyside6/tests/QtQml/bug_997.py index 501c221c3..af489036d 100644 --- a/sources/pyside6/tests/QtQml/bug_997.py +++ b/sources/pyside6/tests/QtQml/bug_997.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/connect_python_qml.py b/sources/pyside6/tests/QtQml/connect_python_qml.py index 2e60aec4f..8b2a51127 100644 --- a/sources/pyside6/tests/QtQml/connect_python_qml.py +++ b/sources/pyside6/tests/QtQml/connect_python_qml.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test case for bug #442 diff --git a/sources/pyside6/tests/QtQml/groupedproperty.py b/sources/pyside6/tests/QtQml/groupedproperty.py index 4554d4b31..d3ddb625c 100644 --- a/sources/pyside6/tests/QtQml/groupedproperty.py +++ b/sources/pyside6/tests/QtQml/groupedproperty.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """Test grouped properties (PYSIDE-1836).""" diff --git a/sources/pyside6/tests/QtQml/javascript_exceptions.py b/sources/pyside6/tests/QtQml/javascript_exceptions.py index e2b530aaf..290a0e957 100644 --- a/sources/pyside6/tests/QtQml/javascript_exceptions.py +++ b/sources/pyside6/tests/QtQml/javascript_exceptions.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/listproperty.py b/sources/pyside6/tests/QtQml/listproperty.py index 884600d29..0ffa8fd21 100644 --- a/sources/pyside6/tests/QtQml/listproperty.py +++ b/sources/pyside6/tests/QtQml/listproperty.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/qmlregistertype_test.py b/sources/pyside6/tests/QtQml/qmlregistertype_test.py index 0042d6fd3..587a3b9b0 100644 --- a/sources/pyside6/tests/QtQml/qmlregistertype_test.py +++ b/sources/pyside6/tests/QtQml/qmlregistertype_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/qqmlapplicationengine_test.py b/sources/pyside6/tests/QtQml/qqmlapplicationengine_test.py index ea54e9e25..7a44d95bf 100644 --- a/sources/pyside6/tests/QtQml/qqmlapplicationengine_test.py +++ b/sources/pyside6/tests/QtQml/qqmlapplicationengine_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for QQmlApplicationEngine''' diff --git a/sources/pyside6/tests/QtQml/qqmlcomponent_test.py b/sources/pyside6/tests/QtQml/qqmlcomponent_test.py index 5521c64fa..c507603a6 100644 --- a/sources/pyside6/tests/QtQml/qqmlcomponent_test.py +++ b/sources/pyside6/tests/QtQml/qqmlcomponent_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py index 12a73e398..e5b6418a2 100644 --- a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py +++ b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py index abdb4529e..51e97567e 100644 --- a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py +++ b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QQmlNetwork''' diff --git a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py index 25341b0b2..f53b4f5a3 100644 --- a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py +++ b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/qquickview_test.py b/sources/pyside6/tests/QtQml/qquickview_test.py index 226509669..9e4b45c5c 100644 --- a/sources/pyside6/tests/QtQml/qquickview_test.py +++ b/sources/pyside6/tests/QtQml/qquickview_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QQuickView''' diff --git a/sources/pyside6/tests/QtQml/registerattached.py b/sources/pyside6/tests/QtQml/registerattached.py index dd300dc89..f6784f516 100644 --- a/sources/pyside6/tests/QtQml/registerattached.py +++ b/sources/pyside6/tests/QtQml/registerattached.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/registerextended.py b/sources/pyside6/tests/QtQml/registerextended.py index b87b5aaaf..ee8cb45f2 100644 --- a/sources/pyside6/tests/QtQml/registerextended.py +++ b/sources/pyside6/tests/QtQml/registerextended.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/registerforeign.py b/sources/pyside6/tests/QtQml/registerforeign.py index d9a982d95..5b280bf2c 100644 --- a/sources/pyside6/tests/QtQml/registerforeign.py +++ b/sources/pyside6/tests/QtQml/registerforeign.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/registerparserstatus.py b/sources/pyside6/tests/QtQml/registerparserstatus.py index bbcc14635..9c2b93ca9 100644 --- a/sources/pyside6/tests/QtQml/registerparserstatus.py +++ b/sources/pyside6/tests/QtQml/registerparserstatus.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/registerqmlfile.py b/sources/pyside6/tests/QtQml/registerqmlfile.py index 335652e5d..39e5ab75a 100644 --- a/sources/pyside6/tests/QtQml/registerqmlfile.py +++ b/sources/pyside6/tests/QtQml/registerqmlfile.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/registersingletontype.py b/sources/pyside6/tests/QtQml/registersingletontype.py index 6beca1131..7136a751d 100644 --- a/sources/pyside6/tests/QtQml/registersingletontype.py +++ b/sources/pyside6/tests/QtQml/registersingletontype.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/registertype.py b/sources/pyside6/tests/QtQml/registertype.py index 6c9874f32..4d59386f9 100644 --- a/sources/pyside6/tests/QtQml/registertype.py +++ b/sources/pyside6/tests/QtQml/registertype.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/registeruncreatabletype.py b/sources/pyside6/tests/QtQml/registeruncreatabletype.py index 3a4df69f6..86fd4801b 100644 --- a/sources/pyside6/tests/QtQml/registeruncreatabletype.py +++ b/sources/pyside6/tests/QtQml/registeruncreatabletype.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/signal_arguments.py b/sources/pyside6/tests/QtQml/signal_arguments.py index f5b0f8bd3..485ec2b4f 100644 --- a/sources/pyside6/tests/QtQml/signal_arguments.py +++ b/sources/pyside6/tests/QtQml/signal_arguments.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtQml/signal_types.py b/sources/pyside6/tests/QtQml/signal_types.py index 240c0fd6e..4ecc19da1 100644 --- a/sources/pyside6/tests/QtQml/signal_types.py +++ b/sources/pyside6/tests/QtQml/signal_types.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import json import os diff --git a/sources/pyside6/tests/QtQuickTest/quicktestmainwithsetup/tst_quicktestmainwithsetup.py b/sources/pyside6/tests/QtQuickTest/quicktestmainwithsetup/tst_quicktestmainwithsetup.py index 33b2db08f..2e45960cd 100644 --- a/sources/pyside6/tests/QtQuickTest/quicktestmainwithsetup/tst_quicktestmainwithsetup.py +++ b/sources/pyside6/tests/QtQuickTest/quicktestmainwithsetup/tst_quicktestmainwithsetup.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtScxml/test_dynamic.py b/sources/pyside6/tests/QtScxml/test_dynamic.py index 212d6f7c1..9ba2fa704 100644 --- a/sources/pyside6/tests/QtScxml/test_dynamic.py +++ b/sources/pyside6/tests/QtScxml/test_dynamic.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtSensors/sensors.py b/sources/pyside6/tests/QtSensors/sensors.py index 84bd1a92f..b92b9173e 100644 --- a/sources/pyside6/tests/QtSensors/sensors.py +++ b/sources/pyside6/tests/QtSensors/sensors.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QSensor''' diff --git a/sources/pyside6/tests/QtSerialPort/serial.py b/sources/pyside6/tests/QtSerialPort/serial.py index f1e54f2ac..6107b2a92 100644 --- a/sources/pyside6/tests/QtSerialPort/serial.py +++ b/sources/pyside6/tests/QtSerialPort/serial.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QSerialPort''' diff --git a/sources/pyside6/tests/QtSql/bug_1013.py b/sources/pyside6/tests/QtSql/bug_1013.py index b47aecb77..40f74fac9 100644 --- a/sources/pyside6/tests/QtSql/bug_1013.py +++ b/sources/pyside6/tests/QtSql/bug_1013.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py b/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py index a3e70a3a7..3a20833c3 100644 --- a/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py +++ b/sources/pyside6/tests/QtSql/qsqldatabaseandqueries_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QtSql database creation, destruction and queries''' diff --git a/sources/pyside6/tests/QtSql/qvarianttype_test.py b/sources/pyside6/tests/QtSql/qvarianttype_test.py index 3999be20e..7d4646ab1 100644 --- a/sources/pyside6/tests/QtSql/qvarianttype_test.py +++ b/sources/pyside6/tests/QtSql/qvarianttype_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QVariant::Type converter''' import os diff --git a/sources/pyside6/tests/QtStateMachine/bug_1031.py b/sources/pyside6/tests/QtStateMachine/bug_1031.py index 7fe5fc1e6..8552d5e8e 100644 --- a/sources/pyside6/tests/QtStateMachine/bug_1031.py +++ b/sources/pyside6/tests/QtStateMachine/bug_1031.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtStateMachine/qabstracttransition_test.py b/sources/pyside6/tests/QtStateMachine/qabstracttransition_test.py index 9c52bfd59..09d3a9d3d 100644 --- a/sources/pyside6/tests/QtStateMachine/qabstracttransition_test.py +++ b/sources/pyside6/tests/QtStateMachine/qabstracttransition_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtStateMachine/qstate_test.py b/sources/pyside6/tests/QtStateMachine/qstate_test.py index 4a33141c8..cd0be1620 100644 --- a/sources/pyside6/tests/QtStateMachine/qstate_test.py +++ b/sources/pyside6/tests/QtStateMachine/qstate_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtStateMachine/qstatemachine_test.py b/sources/pyside6/tests/QtStateMachine/qstatemachine_test.py index 5e17b3a1f..43e9311cd 100644 --- a/sources/pyside6/tests/QtStateMachine/qstatemachine_test.py +++ b/sources/pyside6/tests/QtStateMachine/qstatemachine_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtStateMachine/setprop_on_ctor_test.py b/sources/pyside6/tests/QtStateMachine/setprop_on_ctor_test.py index 48f397282..273a31df2 100644 --- a/sources/pyside6/tests/QtStateMachine/setprop_on_ctor_test.py +++ b/sources/pyside6/tests/QtStateMachine/setprop_on_ctor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtSvg/qsvggenerator_test.py b/sources/pyside6/tests/QtSvg/qsvggenerator_test.py index a06cefb37..9c926d367 100644 --- a/sources/pyside6/tests/QtSvg/qsvggenerator_test.py +++ b/sources/pyside6/tests/QtSvg/qsvggenerator_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py b/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py index b4422001f..9e850d5d2 100644 --- a/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py +++ b/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py b/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py index 552d6f49a..e43008ca3 100644 --- a/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py +++ b/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtTest/click_test.py b/sources/pyside6/tests/QtTest/click_test.py index da8b2dcf6..311ffd4e6 100644 --- a/sources/pyside6/tests/QtTest/click_test.py +++ b/sources/pyside6/tests/QtTest/click_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''QtTest mouse click functionalities''' diff --git a/sources/pyside6/tests/QtTest/eventfilter_test.py b/sources/pyside6/tests/QtTest/eventfilter_test.py index c57974c0d..07b8c4eb0 100644 --- a/sources/pyside6/tests/QtTest/eventfilter_test.py +++ b/sources/pyside6/tests/QtTest/eventfilter_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for QKeyEvent''' diff --git a/sources/pyside6/tests/QtTest/qsignalspy_test.py b/sources/pyside6/tests/QtTest/qsignalspy_test.py index 06f05b4b8..b4bc0397f 100644 --- a/sources/pyside6/tests/QtTest/qsignalspy_test.py +++ b/sources/pyside6/tests/QtTest/qsignalspy_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''QtTest QSignalSpy''' diff --git a/sources/pyside6/tests/QtTest/qvalidator_test.py b/sources/pyside6/tests/QtTest/qvalidator_test.py index 2382b8605..081b77b55 100644 --- a/sources/pyside6/tests/QtTest/qvalidator_test.py +++ b/sources/pyside6/tests/QtTest/qvalidator_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtTest/touchevent_test.py b/sources/pyside6/tests/QtTest/touchevent_test.py index bc07c25ed..2e72ec00b 100644 --- a/sources/pyside6/tests/QtTest/touchevent_test.py +++ b/sources/pyside6/tests/QtTest/touchevent_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtTextToSpeech/qtexttospeech_test.py b/sources/pyside6/tests/QtTextToSpeech/qtexttospeech_test.py index 6ff66c047..544dba269 100644 --- a/sources/pyside6/tests/QtTextToSpeech/qtexttospeech_test.py +++ b/sources/pyside6/tests/QtTextToSpeech/qtexttospeech_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QTextToSpeech methods''' diff --git a/sources/pyside6/tests/QtUiTools/bug_1060.py b/sources/pyside6/tests/QtUiTools/bug_1060.py index 52624a2a9..64522946e 100644 --- a/sources/pyside6/tests/QtUiTools/bug_1060.py +++ b/sources/pyside6/tests/QtUiTools/bug_1060.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' unit test for BUG #1060 ''' diff --git a/sources/pyside6/tests/QtUiTools/bug_360.py b/sources/pyside6/tests/QtUiTools/bug_360.py index 8ca764eae..4ad1b926a 100644 --- a/sources/pyside6/tests/QtUiTools/bug_360.py +++ b/sources/pyside6/tests/QtUiTools/bug_360.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/bug_376.py b/sources/pyside6/tests/QtUiTools/bug_376.py index eefc1fe05..4f0e7f427 100644 --- a/sources/pyside6/tests/QtUiTools/bug_376.py +++ b/sources/pyside6/tests/QtUiTools/bug_376.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/bug_392.py b/sources/pyside6/tests/QtUiTools/bug_392.py index 4d69fdbec..2d70d1c6b 100644 --- a/sources/pyside6/tests/QtUiTools/bug_392.py +++ b/sources/pyside6/tests/QtUiTools/bug_392.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/bug_426.py b/sources/pyside6/tests/QtUiTools/bug_426.py index 3a568e4e2..41c22f99e 100644 --- a/sources/pyside6/tests/QtUiTools/bug_426.py +++ b/sources/pyside6/tests/QtUiTools/bug_426.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/bug_552.py b/sources/pyside6/tests/QtUiTools/bug_552.py index 06a6b72a4..abcd122d5 100644 --- a/sources/pyside6/tests/QtUiTools/bug_552.py +++ b/sources/pyside6/tests/QtUiTools/bug_552.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/bug_797.py b/sources/pyside6/tests/QtUiTools/bug_797.py index 3dae7afb7..22dd55387 100644 --- a/sources/pyside6/tests/QtUiTools/bug_797.py +++ b/sources/pyside6/tests/QtUiTools/bug_797.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/bug_909.py b/sources/pyside6/tests/QtUiTools/bug_909.py index cd4d50a0b..e1a1df8f6 100644 --- a/sources/pyside6/tests/QtUiTools/bug_909.py +++ b/sources/pyside6/tests/QtUiTools/bug_909.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/bug_913.py b/sources/pyside6/tests/QtUiTools/bug_913.py index 85df29d11..47cbfd706 100644 --- a/sources/pyside6/tests/QtUiTools/bug_913.py +++ b/sources/pyside6/tests/QtUiTools/bug_913.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/bug_958.py b/sources/pyside6/tests/QtUiTools/bug_958.py index 2f8dfab62..3f0ba8d99 100644 --- a/sources/pyside6/tests/QtUiTools/bug_958.py +++ b/sources/pyside6/tests/QtUiTools/bug_958.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/bug_965.py b/sources/pyside6/tests/QtUiTools/bug_965.py index 2308cbeed..ee11f1d2c 100644 --- a/sources/pyside6/tests/QtUiTools/bug_965.py +++ b/sources/pyside6/tests/QtUiTools/bug_965.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/loadUiType_test.py b/sources/pyside6/tests/QtUiTools/loadUiType_test.py index b0842318c..34233d362 100644 --- a/sources/pyside6/tests/QtUiTools/loadUiType_test.py +++ b/sources/pyside6/tests/QtUiTools/loadUiType_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/ui_test.py b/sources/pyside6/tests/QtUiTools/ui_test.py index 4e2fa808b..f2fbea1a1 100644 --- a/sources/pyside6/tests/QtUiTools/ui_test.py +++ b/sources/pyside6/tests/QtUiTools/ui_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtUiTools/uiloader_test.py b/sources/pyside6/tests/QtUiTools/uiloader_test.py index 19e26912e..c69364189 100644 --- a/sources/pyside6/tests/QtUiTools/uiloader_test.py +++ b/sources/pyside6/tests/QtUiTools/uiloader_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWebEngineCore/qwebenginecookiestore_test.py b/sources/pyside6/tests/QtWebEngineCore/qwebenginecookiestore_test.py index a30c72a8e..beadda0a5 100644 --- a/sources/pyside6/tests/QtWebEngineCore/qwebenginecookiestore_test.py +++ b/sources/pyside6/tests/QtWebEngineCore/qwebenginecookiestore_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys import unittest diff --git a/sources/pyside6/tests/QtWebEngineCore/web_engine_custom_scheme.py b/sources/pyside6/tests/QtWebEngineCore/web_engine_custom_scheme.py index 10c8e88d7..4d1cb6b0b 100644 --- a/sources/pyside6/tests/QtWebEngineCore/web_engine_custom_scheme.py +++ b/sources/pyside6/tests/QtWebEngineCore/web_engine_custom_scheme.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWebEngineWidgets/pyside-474-qtwebengineview.py b/sources/pyside6/tests/QtWebEngineWidgets/pyside-474-qtwebengineview.py index 3739e956a..13a970deb 100644 --- a/sources/pyside6/tests/QtWebEngineWidgets/pyside-474-qtwebengineview.py +++ b/sources/pyside6/tests/QtWebEngineWidgets/pyside-474-qtwebengineview.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations from functools import partial import os diff --git a/sources/pyside6/tests/QtWidgets/action_clear.py b/sources/pyside6/tests/QtWidgets/action_clear.py index 5563a4899..c81871df4 100644 --- a/sources/pyside6/tests/QtWidgets/action_clear.py +++ b/sources/pyside6/tests/QtWidgets/action_clear.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/add_action_test.py b/sources/pyside6/tests/QtWidgets/add_action_test.py index 3ca1660a9..5d74356fd 100644 --- a/sources/pyside6/tests/QtWidgets/add_action_test.py +++ b/sources/pyside6/tests/QtWidgets/add_action_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for QMenuBar.addAction(identifier, callback) calls''' diff --git a/sources/pyside6/tests/QtWidgets/api2_test.py b/sources/pyside6/tests/QtWidgets/api2_test.py index e38672016..1df67d002 100644 --- a/sources/pyside6/tests/QtWidgets/api2_test.py +++ b/sources/pyside6/tests/QtWidgets/api2_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for PySide API2 support''' diff --git a/sources/pyside6/tests/QtWidgets/application_test.py b/sources/pyside6/tests/QtWidgets/application_test.py index 1b2477fd7..fecebe0bf 100644 --- a/sources/pyside6/tests/QtWidgets/application_test.py +++ b/sources/pyside6/tests/QtWidgets/application_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_1002.py b/sources/pyside6/tests/QtWidgets/bug_1002.py index 98ae66c47..a8f836ce5 100644 --- a/sources/pyside6/tests/QtWidgets/bug_1002.py +++ b/sources/pyside6/tests/QtWidgets/bug_1002.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/bug_1006.py b/sources/pyside6/tests/QtWidgets/bug_1006.py index 74bf5e2da..87d73c4ec 100644 --- a/sources/pyside6/tests/QtWidgets/bug_1006.py +++ b/sources/pyside6/tests/QtWidgets/bug_1006.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/bug_1048.py b/sources/pyside6/tests/QtWidgets/bug_1048.py index 9d83e2f30..4edad1870 100644 --- a/sources/pyside6/tests/QtWidgets/bug_1048.py +++ b/sources/pyside6/tests/QtWidgets/bug_1048.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_1077.py b/sources/pyside6/tests/QtWidgets/bug_1077.py index c9559609f..66226b480 100644 --- a/sources/pyside6/tests/QtWidgets/bug_1077.py +++ b/sources/pyside6/tests/QtWidgets/bug_1077.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' unit test for BUG #1077 ''' diff --git a/sources/pyside6/tests/QtWidgets/bug_172.py b/sources/pyside6/tests/QtWidgets/bug_172.py index 2637d6d61..6f2895e47 100644 --- a/sources/pyside6/tests/QtWidgets/bug_172.py +++ b/sources/pyside6/tests/QtWidgets/bug_172.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_243.py b/sources/pyside6/tests/QtWidgets/bug_243.py index af189837f..7987be96e 100644 --- a/sources/pyside6/tests/QtWidgets/bug_243.py +++ b/sources/pyside6/tests/QtWidgets/bug_243.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 243: http://bugs.openbossa.org/show_bug.cgi?id=243''' diff --git a/sources/pyside6/tests/QtWidgets/bug_307.py b/sources/pyside6/tests/QtWidgets/bug_307.py index 673d5183d..90a80073e 100644 --- a/sources/pyside6/tests/QtWidgets/bug_307.py +++ b/sources/pyside6/tests/QtWidgets/bug_307.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import colorsys import os diff --git a/sources/pyside6/tests/QtWidgets/bug_338.py b/sources/pyside6/tests/QtWidgets/bug_338.py index 695b4238a..463c20527 100644 --- a/sources/pyside6/tests/QtWidgets/bug_338.py +++ b/sources/pyside6/tests/QtWidgets/bug_338.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 338: http://bugs.openbossa.org/show_bug.cgi?id=338''' diff --git a/sources/pyside6/tests/QtWidgets/bug_389.py b/sources/pyside6/tests/QtWidgets/bug_389.py index 024908e85..39e0aa5d6 100644 --- a/sources/pyside6/tests/QtWidgets/bug_389.py +++ b/sources/pyside6/tests/QtWidgets/bug_389.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 389: http://bugs.openbossa.org/show_bug.cgi?id=389''' diff --git a/sources/pyside6/tests/QtWidgets/bug_400.py b/sources/pyside6/tests/QtWidgets/bug_400.py index 79dfa49fc..da446fe04 100644 --- a/sources/pyside6/tests/QtWidgets/bug_400.py +++ b/sources/pyside6/tests/QtWidgets/bug_400.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 400: http://bugs.openbossa.org/show_bug.cgi?id=400''' diff --git a/sources/pyside6/tests/QtWidgets/bug_429.py b/sources/pyside6/tests/QtWidgets/bug_429.py index e95c113f3..8b37d9332 100644 --- a/sources/pyside6/tests/QtWidgets/bug_429.py +++ b/sources/pyside6/tests/QtWidgets/bug_429.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_430.py b/sources/pyside6/tests/QtWidgets/bug_430.py index 6ef9ec7f4..a0fac6189 100644 --- a/sources/pyside6/tests/QtWidgets/bug_430.py +++ b/sources/pyside6/tests/QtWidgets/bug_430.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_433.py b/sources/pyside6/tests/QtWidgets/bug_433.py index c7fbe4b3e..5adcacccc 100644 --- a/sources/pyside6/tests/QtWidgets/bug_433.py +++ b/sources/pyside6/tests/QtWidgets/bug_433.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_467.py b/sources/pyside6/tests/QtWidgets/bug_467.py index af383e811..a71a06c8d 100644 --- a/sources/pyside6/tests/QtWidgets/bug_467.py +++ b/sources/pyside6/tests/QtWidgets/bug_467.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 367: http://bugs.openbossa.org/show_bug.cgi?id=467''' diff --git a/sources/pyside6/tests/QtWidgets/bug_480.py b/sources/pyside6/tests/QtWidgets/bug_480.py index 2fc955561..89976ac50 100644 --- a/sources/pyside6/tests/QtWidgets/bug_480.py +++ b/sources/pyside6/tests/QtWidgets/bug_480.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_512.py b/sources/pyside6/tests/QtWidgets/bug_512.py index dab367727..e8cfecd60 100644 --- a/sources/pyside6/tests/QtWidgets/bug_512.py +++ b/sources/pyside6/tests/QtWidgets/bug_512.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 512: http://bugs.openbossa.org/show_bug.cgi?id=512''' diff --git a/sources/pyside6/tests/QtWidgets/bug_525.py b/sources/pyside6/tests/QtWidgets/bug_525.py index 3c49cd377..7775ed1b6 100644 --- a/sources/pyside6/tests/QtWidgets/bug_525.py +++ b/sources/pyside6/tests/QtWidgets/bug_525.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_546.py b/sources/pyside6/tests/QtWidgets/bug_546.py index fcec2f6d7..c5e054c3f 100644 --- a/sources/pyside6/tests/QtWidgets/bug_546.py +++ b/sources/pyside6/tests/QtWidgets/bug_546.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_547.py b/sources/pyside6/tests/QtWidgets/bug_547.py index dcbe20ee8..d2b393950 100644 --- a/sources/pyside6/tests/QtWidgets/bug_547.py +++ b/sources/pyside6/tests/QtWidgets/bug_547.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ Unittest for bug #547 """ """ http://bugs.openbossa.org/show_bug.cgi?id=547 """ diff --git a/sources/pyside6/tests/QtWidgets/bug_549.py b/sources/pyside6/tests/QtWidgets/bug_549.py index 8efa6e679..b0cd683f3 100644 --- a/sources/pyside6/tests/QtWidgets/bug_549.py +++ b/sources/pyside6/tests/QtWidgets/bug_549.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_569.py b/sources/pyside6/tests/QtWidgets/bug_569.py index 0f95aed02..4da978f6c 100644 --- a/sources/pyside6/tests/QtWidgets/bug_569.py +++ b/sources/pyside6/tests/QtWidgets/bug_569.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_575.py b/sources/pyside6/tests/QtWidgets/bug_575.py index f9a927817..d1d529168 100644 --- a/sources/pyside6/tests/QtWidgets/bug_575.py +++ b/sources/pyside6/tests/QtWidgets/bug_575.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ Unittest for bug #575 """ """ http://bugs.openbossa.org/show_bug.cgi?id=575 """ diff --git a/sources/pyside6/tests/QtWidgets/bug_576.py b/sources/pyside6/tests/QtWidgets/bug_576.py index 4a17e7aa8..7f546df1d 100644 --- a/sources/pyside6/tests/QtWidgets/bug_576.py +++ b/sources/pyside6/tests/QtWidgets/bug_576.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ Unittest for bug #576 """ """ http://bugs.openbossa.org/show_bug.cgi?id=576 """ diff --git a/sources/pyside6/tests/QtWidgets/bug_585.py b/sources/pyside6/tests/QtWidgets/bug_585.py index e26ca9ce0..0c85a7ff6 100644 --- a/sources/pyside6/tests/QtWidgets/bug_585.py +++ b/sources/pyside6/tests/QtWidgets/bug_585.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test bug 585: http://bugs.openbossa.org/show_bug.cgi?id=585''' diff --git a/sources/pyside6/tests/QtWidgets/bug_589.py b/sources/pyside6/tests/QtWidgets/bug_589.py index a19f544a5..d6259b865 100644 --- a/sources/pyside6/tests/QtWidgets/bug_589.py +++ b/sources/pyside6/tests/QtWidgets/bug_589.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations # trimmed down diagramscene.py to demonstrate crash in sizeHint() diff --git a/sources/pyside6/tests/QtWidgets/bug_635.py b/sources/pyside6/tests/QtWidgets/bug_635.py index 66a8c58c6..6c997b276 100644 --- a/sources/pyside6/tests/QtWidgets/bug_635.py +++ b/sources/pyside6/tests/QtWidgets/bug_635.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 635: http://bugs.openbossa.org/show_bug.cgi?id=635''' diff --git a/sources/pyside6/tests/QtWidgets/bug_640.py b/sources/pyside6/tests/QtWidgets/bug_640.py index b2620b541..c3e0ed83a 100644 --- a/sources/pyside6/tests/QtWidgets/bug_640.py +++ b/sources/pyside6/tests/QtWidgets/bug_640.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_653.py b/sources/pyside6/tests/QtWidgets/bug_653.py index 1cf8390df..370e9474b 100644 --- a/sources/pyside6/tests/QtWidgets/bug_653.py +++ b/sources/pyside6/tests/QtWidgets/bug_653.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_662.py b/sources/pyside6/tests/QtWidgets/bug_662.py index e3a3130d0..36187e9aa 100644 --- a/sources/pyside6/tests/QtWidgets/bug_662.py +++ b/sources/pyside6/tests/QtWidgets/bug_662.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 662: http://bugs.openbossa.org/show_bug.cgi?id=662''' diff --git a/sources/pyside6/tests/QtWidgets/bug_667.py b/sources/pyside6/tests/QtWidgets/bug_667.py index be6700d83..1340dfba4 100644 --- a/sources/pyside6/tests/QtWidgets/bug_667.py +++ b/sources/pyside6/tests/QtWidgets/bug_667.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_668.py b/sources/pyside6/tests/QtWidgets/bug_668.py index 0c22436b3..0b2de8f04 100644 --- a/sources/pyside6/tests/QtWidgets/bug_668.py +++ b/sources/pyside6/tests/QtWidgets/bug_668.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_674.py b/sources/pyside6/tests/QtWidgets/bug_674.py index 901b29275..3326d39d5 100644 --- a/sources/pyside6/tests/QtWidgets/bug_674.py +++ b/sources/pyside6/tests/QtWidgets/bug_674.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_675.py b/sources/pyside6/tests/QtWidgets/bug_675.py index 221df88b0..e94410420 100644 --- a/sources/pyside6/tests/QtWidgets/bug_675.py +++ b/sources/pyside6/tests/QtWidgets/bug_675.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_688.py b/sources/pyside6/tests/QtWidgets/bug_688.py index 3180d08bf..20d548f91 100644 --- a/sources/pyside6/tests/QtWidgets/bug_688.py +++ b/sources/pyside6/tests/QtWidgets/bug_688.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test bug 688: http://bugs.openbossa.org/show_bug.cgi?id=688''' diff --git a/sources/pyside6/tests/QtWidgets/bug_693.py b/sources/pyside6/tests/QtWidgets/bug_693.py index 95981e272..23dd752ad 100644 --- a/sources/pyside6/tests/QtWidgets/bug_693.py +++ b/sources/pyside6/tests/QtWidgets/bug_693.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_696.py b/sources/pyside6/tests/QtWidgets/bug_696.py index 19e9978a6..8f0201e30 100644 --- a/sources/pyside6/tests/QtWidgets/bug_696.py +++ b/sources/pyside6/tests/QtWidgets/bug_696.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_711.py b/sources/pyside6/tests/QtWidgets/bug_711.py index fed330fb9..b6a11196e 100644 --- a/sources/pyside6/tests/QtWidgets/bug_711.py +++ b/sources/pyside6/tests/QtWidgets/bug_711.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_722.py b/sources/pyside6/tests/QtWidgets/bug_722.py index dc20e14cf..fa3670ca6 100644 --- a/sources/pyside6/tests/QtWidgets/bug_722.py +++ b/sources/pyside6/tests/QtWidgets/bug_722.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_728.py b/sources/pyside6/tests/QtWidgets/bug_728.py index 531adbb25..a2bbd025c 100644 --- a/sources/pyside6/tests/QtWidgets/bug_728.py +++ b/sources/pyside6/tests/QtWidgets/bug_728.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_736.py b/sources/pyside6/tests/QtWidgets/bug_736.py index af4bcbda8..2e471b04a 100644 --- a/sources/pyside6/tests/QtWidgets/bug_736.py +++ b/sources/pyside6/tests/QtWidgets/bug_736.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_750.py b/sources/pyside6/tests/QtWidgets/bug_750.py index 999f6a3db..ab637e8b3 100644 --- a/sources/pyside6/tests/QtWidgets/bug_750.py +++ b/sources/pyside6/tests/QtWidgets/bug_750.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_778.py b/sources/pyside6/tests/QtWidgets/bug_778.py index 1a7def6c7..dcbf177c4 100644 --- a/sources/pyside6/tests/QtWidgets/bug_778.py +++ b/sources/pyside6/tests/QtWidgets/bug_778.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_793.py b/sources/pyside6/tests/QtWidgets/bug_793.py index 94f42a5d3..3e7900679 100644 --- a/sources/pyside6/tests/QtWidgets/bug_793.py +++ b/sources/pyside6/tests/QtWidgets/bug_793.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_811.py b/sources/pyside6/tests/QtWidgets/bug_811.py index b3537e1f7..3e6ceb7b0 100644 --- a/sources/pyside6/tests/QtWidgets/bug_811.py +++ b/sources/pyside6/tests/QtWidgets/bug_811.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_834.py b/sources/pyside6/tests/QtWidgets/bug_834.py index 685f17e56..efa1a835b 100644 --- a/sources/pyside6/tests/QtWidgets/bug_834.py +++ b/sources/pyside6/tests/QtWidgets/bug_834.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_836.py b/sources/pyside6/tests/QtWidgets/bug_836.py index c2d3d5609..dbac5547d 100644 --- a/sources/pyside6/tests/QtWidgets/bug_836.py +++ b/sources/pyside6/tests/QtWidgets/bug_836.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_844.py b/sources/pyside6/tests/QtWidgets/bug_844.py index 913b4235c..271204e5b 100644 --- a/sources/pyside6/tests/QtWidgets/bug_844.py +++ b/sources/pyside6/tests/QtWidgets/bug_844.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import sys import os diff --git a/sources/pyside6/tests/QtWidgets/bug_854.py b/sources/pyside6/tests/QtWidgets/bug_854.py index 1dbfd4b3a..40f69a272 100644 --- a/sources/pyside6/tests/QtWidgets/bug_854.py +++ b/sources/pyside6/tests/QtWidgets/bug_854.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_860.py b/sources/pyside6/tests/QtWidgets/bug_860.py index 779feaa14..6b47ed136 100644 --- a/sources/pyside6/tests/QtWidgets/bug_860.py +++ b/sources/pyside6/tests/QtWidgets/bug_860.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_862.py b/sources/pyside6/tests/QtWidgets/bug_862.py index 49d9e24b2..eb2c58711 100644 --- a/sources/pyside6/tests/QtWidgets/bug_862.py +++ b/sources/pyside6/tests/QtWidgets/bug_862.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations # diff --git a/sources/pyside6/tests/QtWidgets/bug_871.py b/sources/pyside6/tests/QtWidgets/bug_871.py index 4ee9b575a..c5abdba84 100644 --- a/sources/pyside6/tests/QtWidgets/bug_871.py +++ b/sources/pyside6/tests/QtWidgets/bug_871.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_879.py b/sources/pyside6/tests/QtWidgets/bug_879.py index 31c656543..a2b49d954 100644 --- a/sources/pyside6/tests/QtWidgets/bug_879.py +++ b/sources/pyside6/tests/QtWidgets/bug_879.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_919.py b/sources/pyside6/tests/QtWidgets/bug_919.py index 67387ed26..3094d7483 100644 --- a/sources/pyside6/tests/QtWidgets/bug_919.py +++ b/sources/pyside6/tests/QtWidgets/bug_919.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_921.py b/sources/pyside6/tests/QtWidgets/bug_921.py index dafc1faef..5e9dcd05a 100644 --- a/sources/pyside6/tests/QtWidgets/bug_921.py +++ b/sources/pyside6/tests/QtWidgets/bug_921.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/bug_941.py b/sources/pyside6/tests/QtWidgets/bug_941.py index 336aa2f58..6e09b8ed7 100644 --- a/sources/pyside6/tests/QtWidgets/bug_941.py +++ b/sources/pyside6/tests/QtWidgets/bug_941.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_964.py b/sources/pyside6/tests/QtWidgets/bug_964.py index 86bbddf16..146873259 100644 --- a/sources/pyside6/tests/QtWidgets/bug_964.py +++ b/sources/pyside6/tests/QtWidgets/bug_964.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_967.py b/sources/pyside6/tests/QtWidgets/bug_967.py index 03af030ca..d254f2877 100644 --- a/sources/pyside6/tests/QtWidgets/bug_967.py +++ b/sources/pyside6/tests/QtWidgets/bug_967.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_972.py b/sources/pyside6/tests/QtWidgets/bug_972.py index 895cea128..1450cc16b 100644 --- a/sources/pyside6/tests/QtWidgets/bug_972.py +++ b/sources/pyside6/tests/QtWidgets/bug_972.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_979.py b/sources/pyside6/tests/QtWidgets/bug_979.py index a6c17385e..0e780c044 100644 --- a/sources/pyside6/tests/QtWidgets/bug_979.py +++ b/sources/pyside6/tests/QtWidgets/bug_979.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_988.py b/sources/pyside6/tests/QtWidgets/bug_988.py index f82ba6d27..0fd582206 100644 --- a/sources/pyside6/tests/QtWidgets/bug_988.py +++ b/sources/pyside6/tests/QtWidgets/bug_988.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/bug_998.py b/sources/pyside6/tests/QtWidgets/bug_998.py index 0f6311515..d2d236dbb 100644 --- a/sources/pyside6/tests/QtWidgets/bug_998.py +++ b/sources/pyside6/tests/QtWidgets/bug_998.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py index f7a1a1b1d..f1e9bb6ec 100644 --- a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py +++ b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/grandparent_method_test.py b/sources/pyside6/tests/QtWidgets/grandparent_method_test.py index ef848e22d..5cdc5c5af 100644 --- a/sources/pyside6/tests/QtWidgets/grandparent_method_test.py +++ b/sources/pyside6/tests/QtWidgets/grandparent_method_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for calling methods further than the direct parent''' diff --git a/sources/pyside6/tests/QtWidgets/hashabletype_test.py b/sources/pyside6/tests/QtWidgets/hashabletype_test.py index f12cceb5a..47c60fe53 100644 --- a/sources/pyside6/tests/QtWidgets/hashabletype_test.py +++ b/sources/pyside6/tests/QtWidgets/hashabletype_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for __hash__''' diff --git a/sources/pyside6/tests/QtWidgets/keep_reference_test.py b/sources/pyside6/tests/QtWidgets/keep_reference_test.py index 9d21c4580..8f00208cf 100644 --- a/sources/pyside6/tests/QtWidgets/keep_reference_test.py +++ b/sources/pyside6/tests/QtWidgets/keep_reference_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/missing_symbols_test.py b/sources/pyside6/tests/QtWidgets/missing_symbols_test.py index 076c9e7e1..904bdd894 100644 --- a/sources/pyside6/tests/QtWidgets/missing_symbols_test.py +++ b/sources/pyside6/tests/QtWidgets/missing_symbols_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''(Very) Simple test case for missing names from QtGui and QtWidgets''' diff --git a/sources/pyside6/tests/QtWidgets/paint_event_test.py b/sources/pyside6/tests/QtWidgets/paint_event_test.py index d995c2a37..8597af524 100644 --- a/sources/pyside6/tests/QtWidgets/paint_event_test.py +++ b/sources/pyside6/tests/QtWidgets/paint_event_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test paint event override in python''' diff --git a/sources/pyside6/tests/QtWidgets/parent_method_test.py b/sources/pyside6/tests/QtWidgets/parent_method_test.py index 0ab09eead..a287792e5 100644 --- a/sources/pyside6/tests/QtWidgets/parent_method_test.py +++ b/sources/pyside6/tests/QtWidgets/parent_method_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/private_mangle_test.py b/sources/pyside6/tests/QtWidgets/private_mangle_test.py index 67ad14d68..c535a4bf9 100644 --- a/sources/pyside6/tests/QtWidgets/private_mangle_test.py +++ b/sources/pyside6/tests/QtWidgets/private_mangle_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ This is the example from https://bugreports.qt.io/browse/PYSIDE-772 diff --git a/sources/pyside6/tests/QtWidgets/python_properties_test.py b/sources/pyside6/tests/QtWidgets/python_properties_test.py index ee8a38014..478031aea 100644 --- a/sources/pyside6/tests/QtWidgets/python_properties_test.py +++ b/sources/pyside6/tests/QtWidgets/python_properties_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py b/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py index 1ae3b0a35..091adfc39 100644 --- a/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py +++ b/sources/pyside6/tests/QtWidgets/qabstracttextdocumentlayout_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qaccessible_test.py b/sources/pyside6/tests/QtWidgets/qaccessible_test.py index 021cf9c6b..66c68fa27 100644 --- a/sources/pyside6/tests/QtWidgets/qaccessible_test.py +++ b/sources/pyside6/tests/QtWidgets/qaccessible_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QAccessible::installFactory().''' diff --git a/sources/pyside6/tests/QtWidgets/qaction_test.py b/sources/pyside6/tests/QtWidgets/qaction_test.py index a0049421f..629d60f33 100644 --- a/sources/pyside6/tests/QtWidgets/qaction_test.py +++ b/sources/pyside6/tests/QtWidgets/qaction_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qapp_issue_585.py b/sources/pyside6/tests/QtWidgets/qapp_issue_585.py index 0b5453af5..ec8a47569 100644 --- a/sources/pyside6/tests/QtWidgets/qapp_issue_585.py +++ b/sources/pyside6/tests/QtWidgets/qapp_issue_585.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ The bug was caused by this commit: diff --git a/sources/pyside6/tests/QtWidgets/qapp_test.py b/sources/pyside6/tests/QtWidgets/qapp_test.py index 5a66b8e33..86e7c60dd 100644 --- a/sources/pyside6/tests/QtWidgets/qapp_test.py +++ b/sources/pyside6/tests/QtWidgets/qapp_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test the presence of qApp Macro''' diff --git a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py index 8bb47bc1c..a06d81ef8 100644 --- a/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py +++ b/sources/pyside6/tests/QtWidgets/qapplication_exit_segfault_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/qapplication_test.py b/sources/pyside6/tests/QtWidgets/qapplication_test.py index 7c5b61fd9..47a3c4371 100644 --- a/sources/pyside6/tests/QtWidgets/qapplication_test.py +++ b/sources/pyside6/tests/QtWidgets/qapplication_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qcolormap_test.py b/sources/pyside6/tests/QtWidgets/qcolormap_test.py index f63a9486f..90c96372d 100644 --- a/sources/pyside6/tests/QtWidgets/qcolormap_test.py +++ b/sources/pyside6/tests/QtWidgets/qcolormap_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qdialog_test.py b/sources/pyside6/tests/QtWidgets/qdialog_test.py index cb85ce7e2..6d36dfb20 100644 --- a/sources/pyside6/tests/QtWidgets/qdialog_test.py +++ b/sources/pyside6/tests/QtWidgets/qdialog_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py index 83d6af383..6d903f85c 100644 --- a/sources/pyside6/tests/QtWidgets/qdynamic_signal.py +++ b/sources/pyside6/tests/QtWidgets/qdynamic_signal.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/qfontdialog_test.py b/sources/pyside6/tests/QtWidgets/qfontdialog_test.py index 764329732..dd4209d10 100644 --- a/sources/pyside6/tests/QtWidgets/qfontdialog_test.py +++ b/sources/pyside6/tests/QtWidgets/qfontdialog_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qformlayout_test.py b/sources/pyside6/tests/QtWidgets/qformlayout_test.py index f87ea6935..bcdaed8f7 100644 --- a/sources/pyside6/tests/QtWidgets/qformlayout_test.py +++ b/sources/pyside6/tests/QtWidgets/qformlayout_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py index cb4115b55..4bbe6b0eb 100644 --- a/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py +++ b/sources/pyside6/tests/QtWidgets/qgraphicsitem_isblocked_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py index 1114ad4fe..eb366e3c0 100644 --- a/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py +++ b/sources/pyside6/tests/QtWidgets/qgraphicsitem_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test cases related to QGraphicsItem and subclasses''' diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py index a3d28b4d3..71aba9941 100644 --- a/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py +++ b/sources/pyside6/tests/QtWidgets/qgraphicsobjectreimpl_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test cases related to QGraphicsItem and subclasses''' diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py index dee616bbe..29841a7d0 100644 --- a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py +++ b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py index 86604f27b..985bf94d2 100644 --- a/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py +++ b/sources/pyside6/tests/QtWidgets/qgraphicsscene_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Basic test cases for QGraphicsScene''' diff --git a/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py b/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py index 260653ae7..ce6e07d40 100644 --- a/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py +++ b/sources/pyside6/tests/QtWidgets/qinputdialog_get_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py b/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py index bcb4c7a61..4936260ef 100644 --- a/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py +++ b/sources/pyside6/tests/QtWidgets/qkeysequenceedit_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QKeySequenceEdit.''' diff --git a/sources/pyside6/tests/QtWidgets/qlabel_test.py b/sources/pyside6/tests/QtWidgets/qlabel_test.py index aba90b7b8..5f60d0568 100644 --- a/sources/pyside6/tests/QtWidgets/qlabel_test.py +++ b/sources/pyside6/tests/QtWidgets/qlabel_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QLabel''' diff --git a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py index df9bd7f90..94e4b9554 100644 --- a/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py +++ b/sources/pyside6/tests/QtWidgets/qlayout_ref_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QLayout handling of child widgets references''' diff --git a/sources/pyside6/tests/QtWidgets/qlayout_test.py b/sources/pyside6/tests/QtWidgets/qlayout_test.py index cc41f78b1..3df0e33dd 100644 --- a/sources/pyside6/tests/QtWidgets/qlayout_test.py +++ b/sources/pyside6/tests/QtWidgets/qlayout_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py b/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py index bc186f755..3bc0b5a3c 100644 --- a/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py +++ b/sources/pyside6/tests/QtWidgets/qlcdnumber_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qlistwidget_test.py b/sources/pyside6/tests/QtWidgets/qlistwidget_test.py index 377e63ffb..c3dd31cc4 100644 --- a/sources/pyside6/tests/QtWidgets/qlistwidget_test.py +++ b/sources/pyside6/tests/QtWidgets/qlistwidget_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py index a85c1b48f..9bfc81d65 100644 --- a/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py +++ b/sources/pyside6/tests/QtWidgets/qlistwidgetitem_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py index 2f245c8ff..9cea36313 100644 --- a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py +++ b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qmenu_test.py b/sources/pyside6/tests/QtWidgets/qmenu_test.py index a6976a637..7d1d262e4 100644 --- a/sources/pyside6/tests/QtWidgets/qmenu_test.py +++ b/sources/pyside6/tests/QtWidgets/qmenu_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/qmenuadd_test.py b/sources/pyside6/tests/QtWidgets/qmenuadd_test.py index 5b42e755f..b7138aaf7 100644 --- a/sources/pyside6/tests/QtWidgets/qmenuadd_test.py +++ b/sources/pyside6/tests/QtWidgets/qmenuadd_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test the QMenu.addAction() method''' diff --git a/sources/pyside6/tests/QtWidgets/qobject_mi_test.py b/sources/pyside6/tests/QtWidgets/qobject_mi_test.py index d90961495..4449afd8d 100644 --- a/sources/pyside6/tests/QtWidgets/qobject_mi_test.py +++ b/sources/pyside6/tests/QtWidgets/qobject_mi_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for multiple inheritance from 2 QObjects''' diff --git a/sources/pyside6/tests/QtWidgets/qpicture_test.py b/sources/pyside6/tests/QtWidgets/qpicture_test.py index b81713b57..2825c12fc 100644 --- a/sources/pyside6/tests/QtWidgets/qpicture_test.py +++ b/sources/pyside6/tests/QtWidgets/qpicture_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py index bfc04130e..b8a10e4e2 100644 --- a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py +++ b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qsplitter_test.py b/sources/pyside6/tests/QtWidgets/qsplitter_test.py index ae383f425..c00af837f 100644 --- a/sources/pyside6/tests/QtWidgets/qsplitter_test.py +++ b/sources/pyside6/tests/QtWidgets/qsplitter_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qstyle_test.py b/sources/pyside6/tests/QtWidgets/qstyle_test.py index 5a9b29dc6..e34d266ab 100644 --- a/sources/pyside6/tests/QtWidgets/qstyle_test.py +++ b/sources/pyside6/tests/QtWidgets/qstyle_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import sys import os diff --git a/sources/pyside6/tests/QtWidgets/qstyleoption_test.py b/sources/pyside6/tests/QtWidgets/qstyleoption_test.py index 06798b9e9..ef9b3b301 100644 --- a/sources/pyside6/tests/QtWidgets/qstyleoption_test.py +++ b/sources/pyside6/tests/QtWidgets/qstyleoption_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import sys import os diff --git a/sources/pyside6/tests/QtWidgets/qtableview_test.py b/sources/pyside6/tests/QtWidgets/qtableview_test.py index c43666f23..07bcf6a10 100644 --- a/sources/pyside6/tests/QtWidgets/qtableview_test.py +++ b/sources/pyside6/tests/QtWidgets/qtableview_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py index 8db45f24b..69d308c0c 100644 --- a/sources/pyside6/tests/QtWidgets/qtabwidget_test.py +++ b/sources/pyside6/tests/QtWidgets/qtabwidget_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py b/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py index 49e16e8d2..5661c4e79 100644 --- a/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py +++ b/sources/pyside6/tests/QtWidgets/qtabwidgetclear_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py b/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py index 16929f0f2..72265d9fb 100644 --- a/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py +++ b/sources/pyside6/tests/QtWidgets/qtextedit_signal_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qtextedit_test.py b/sources/pyside6/tests/QtWidgets/qtextedit_test.py index b82350293..9cfc526c1 100644 --- a/sources/pyside6/tests/QtWidgets/qtextedit_test.py +++ b/sources/pyside6/tests/QtWidgets/qtextedit_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QTextEdit and ownership problems.''' diff --git a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py index 6fa5865cf..6a328a4ce 100644 --- a/sources/pyside6/tests/QtWidgets/qtoolbar_test.py +++ b/sources/pyside6/tests/QtWidgets/qtoolbar_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QToolbar''' diff --git a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py index d069416b7..77228a928 100644 --- a/sources/pyside6/tests/QtWidgets/qtoolbox_test.py +++ b/sources/pyside6/tests/QtWidgets/qtoolbox_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/qtreeview_test.py b/sources/pyside6/tests/QtWidgets/qtreeview_test.py index fd535bfad..003475d54 100644 --- a/sources/pyside6/tests/QtWidgets/qtreeview_test.py +++ b/sources/pyside6/tests/QtWidgets/qtreeview_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/qtreewidget_test.py b/sources/pyside6/tests/QtWidgets/qtreewidget_test.py index 6c2db32b9..1ee8c45cb 100644 --- a/sources/pyside6/tests/QtWidgets/qtreewidget_test.py +++ b/sources/pyside6/tests/QtWidgets/qtreewidget_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qtreewidgetitem_test.py b/sources/pyside6/tests/QtWidgets/qtreewidgetitem_test.py index 432aba2ed..f92bb4725 100644 --- a/sources/pyside6/tests/QtWidgets/qtreewidgetitem_test.py +++ b/sources/pyside6/tests/QtWidgets/qtreewidgetitem_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ Unit tests for QTreeWidgetItem diff --git a/sources/pyside6/tests/QtWidgets/qvariant_test.py b/sources/pyside6/tests/QtWidgets/qvariant_test.py index fe0266309..0e1ecc2c9 100644 --- a/sources/pyside6/tests/QtWidgets/qvariant_test.py +++ b/sources/pyside6/tests/QtWidgets/qvariant_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py b/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py index 1d9128789..e7f754c81 100644 --- a/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py +++ b/sources/pyside6/tests/QtWidgets/qwidget_setlayout_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/qwidget_test.py b/sources/pyside6/tests/QtWidgets/qwidget_test.py index 2d503f0d4..97b9c90bb 100644 --- a/sources/pyside6/tests/QtWidgets/qwidget_test.py +++ b/sources/pyside6/tests/QtWidgets/qwidget_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import sys import os diff --git a/sources/pyside6/tests/QtWidgets/reference_count_test.py b/sources/pyside6/tests/QtWidgets/reference_count_test.py index b7d3908dd..c0944ed04 100644 --- a/sources/pyside6/tests/QtWidgets/reference_count_test.py +++ b/sources/pyside6/tests/QtWidgets/reference_count_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Reference count when the object is created in c++ side''' diff --git a/sources/pyside6/tests/QtWidgets/signature_test.py b/sources/pyside6/tests/QtWidgets/signature_test.py index f156b6717..1b3363ae2 100644 --- a/sources/pyside6/tests/QtWidgets/signature_test.py +++ b/sources/pyside6/tests/QtWidgets/signature_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import inspect import os diff --git a/sources/pyside6/tests/QtWidgets/standardpixmap_test.py b/sources/pyside6/tests/QtWidgets/standardpixmap_test.py index 564f3ff2e..de993595e 100644 --- a/sources/pyside6/tests/QtWidgets/standardpixmap_test.py +++ b/sources/pyside6/tests/QtWidgets/standardpixmap_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/test_module_template.py b/sources/pyside6/tests/QtWidgets/test_module_template.py index 92661cdff..f194ac925 100644 --- a/sources/pyside6/tests/QtWidgets/test_module_template.py +++ b/sources/pyside6/tests/QtWidgets/test_module_template.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py index 911fed475..6ae792474 100644 --- a/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py +++ b/sources/pyside6/tests/QtWidgets/virtual_protected_inheritance_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for overriding inherited protected virtual methods''' diff --git a/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py b/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py index b7d1e4f3f..0935522f0 100644 --- a/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py +++ b/sources/pyside6/tests/QtWidgets/virtual_pure_override_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/QtWidgets/wrong_return_test.py b/sources/pyside6/tests/QtWidgets/wrong_return_test.py index 009078ac1..47ef489bb 100644 --- a/sources/pyside6/tests/QtWidgets/wrong_return_test.py +++ b/sources/pyside6/tests/QtWidgets/wrong_return_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Virtual functions with wrong return type''' diff --git a/sources/pyside6/tests/QtXml/qdomdocument_test.py b/sources/pyside6/tests/QtXml/qdomdocument_test.py index cfc1c543d..bcb5ce67f 100644 --- a/sources/pyside6/tests/QtXml/qdomdocument_test.py +++ b/sources/pyside6/tests/QtXml/qdomdocument_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/init_paths.py b/sources/pyside6/tests/init_paths.py index e69ec1c15..4636aba99 100644 --- a/sources/pyside6/tests/init_paths.py +++ b/sources/pyside6/tests/init_paths.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/mac/qmacstyle_test.py b/sources/pyside6/tests/mac/qmacstyle_test.py index 18fc64286..d3925714a 100644 --- a/sources/pyside6/tests/mac/qmacstyle_test.py +++ b/sources/pyside6/tests/mac/qmacstyle_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations # Qt5: this is gone: from PySide6.QtGui import QMacStyle diff --git a/sources/pyside6/tests/manually/bug_841.py b/sources/pyside6/tests/manually/bug_841.py index 3911244ce..accadbc2d 100644 --- a/sources/pyside6/tests/manually/bug_841.py +++ b/sources/pyside6/tests/manually/bug_841.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import sys diff --git a/sources/pyside6/tests/manually/lazytiming.py b/sources/pyside6/tests/manually/lazytiming.py index 59f75bc46..78d79336c 100644 --- a/sources/pyside6/tests/manually/lazytiming.py +++ b/sources/pyside6/tests/manually/lazytiming.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ Time a repeated Python run diff --git a/sources/pyside6/tests/pysidetest/all_modules_load_test.py b/sources/pyside6/tests/pysidetest/all_modules_load_test.py index 454c2b14f..16f2369a7 100644 --- a/sources/pyside6/tests/pysidetest/all_modules_load_test.py +++ b/sources/pyside6/tests/pysidetest/all_modules_load_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/bug_1016.py b/sources/pyside6/tests/pysidetest/bug_1016.py index 219384e66..2ec2d56ee 100644 --- a/sources/pyside6/tests/pysidetest/bug_1016.py +++ b/sources/pyside6/tests/pysidetest/bug_1016.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/constructor_properties_test.py b/sources/pyside6/tests/pysidetest/constructor_properties_test.py index ec6e39821..5d77a058a 100644 --- a/sources/pyside6/tests/pysidetest/constructor_properties_test.py +++ b/sources/pyside6/tests/pysidetest/constructor_properties_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/container_test.py b/sources/pyside6/tests/pysidetest/container_test.py index c83e1f26c..04eed83bc 100644 --- a/sources/pyside6/tests/pysidetest/container_test.py +++ b/sources/pyside6/tests/pysidetest/container_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/decoratedslot_test.py b/sources/pyside6/tests/pysidetest/decoratedslot_test.py index 3ec9ac9e3..5902f41fc 100644 --- a/sources/pyside6/tests/pysidetest/decoratedslot_test.py +++ b/sources/pyside6/tests/pysidetest/decoratedslot_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/delegatecreateseditor_test.py b/sources/pyside6/tests/pysidetest/delegatecreateseditor_test.py index 8964ec1ed..665cd2ed8 100644 --- a/sources/pyside6/tests/pysidetest/delegatecreateseditor_test.py +++ b/sources/pyside6/tests/pysidetest/delegatecreateseditor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/enum_test.py b/sources/pyside6/tests/pysidetest/enum_test.py index 832834530..9816db224 100644 --- a/sources/pyside6/tests/pysidetest/enum_test.py +++ b/sources/pyside6/tests/pysidetest/enum_test.py @@ -1,5 +1,6 @@ -# Copyright (C) 2022 The Qt Company Ltd. +# Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys @@ -50,6 +51,8 @@ class ListConnectionTest(unittest.TestCase): # PYSIDE-1735: We are testing that opcodes do what they are supposed to do. # This is needed in the PyEnum forgiveness mode where we need # to introspect the code if an Enum was called with no args. + +# flake8: noqa class InvestigateOpcodesTest(unittest.TestCase): def probe_function1(self): @@ -162,25 +165,40 @@ class InvestigateOpcodesTest(unittest.TestCase): self.assertEqual(self.read_code(self.probe_function2, adaptive=True), result_3) self.assertEqual(self.get_sizes(self.probe_function2, adaptive=True), sizes_3) - if sys.version_info[:2] >= (3, 12): + if sys.version_info[:2] == (3, 12): - result_1 = [('RESUME', 151, 0), - ('LOAD_GLOBAL', 116, 0), - ('LOAD_ATTR', 106, 2), - ('STORE_FAST', 125, 1), + result_1 = [('RESUME', 151, 0), + ('LOAD_GLOBAL', 116, 0), + ('LOAD_ATTR', 106, 2), + ('STORE_FAST', 125, 1), ('RETURN_CONST', 121, 0)] - result_2 = [('RESUME', 151, 0), - ('LOAD_GLOBAL', 116, 1), - ('LOAD_ATTR', 106, 2), - ('CALL', 171, 0), - ('STORE_FAST', 125, 1), + result_2 = [('RESUME', 151, 0), + ('LOAD_GLOBAL', 116, 1), + ('LOAD_ATTR', 106, 2), + ('CALL', 171, 0), + ('STORE_FAST', 125, 1), ('RETURN_CONST', 121, 0)] + if sys.version_info[:2] >= (3, 13): + + result_1 = [('RESUME', 149, 0), + ('LOAD_GLOBAL', 91, 0), + ('LOAD_ATTR', 82, 2), + ('STORE_FAST', 110, 1), + ('RETURN_CONST', 103, 0)] + + result_2 = [('RESUME', 149, 0), + ('LOAD_GLOBAL', 91, 0), + ('LOAD_ATTR', 82, 2), + ('PUSH_NULL', 34, None), + ('CALL', 53, 0), + ('STORE_FAST', 110, 1), + ('RETURN_CONST', 103, 0)] + self.assertEqual(self.read_code(self.probe_function1), result_1) self.assertEqual(self.read_code(self.probe_function2), result_2) if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py b/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py index b58232a1b..9bc4172ec 100644 --- a/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py +++ b/sources/pyside6/tests/pysidetest/homonymoussignalandmethod_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/pysidetest/iterable_test.py b/sources/pyside6/tests/pysidetest/iterable_test.py index bdb2ae7be..1a54f1848 100644 --- a/sources/pyside6/tests/pysidetest/iterable_test.py +++ b/sources/pyside6/tests/pysidetest/iterable_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ iterable_test.py diff --git a/sources/pyside6/tests/pysidetest/list_signal_test.py b/sources/pyside6/tests/pysidetest/list_signal_test.py index da4bc298d..42524933b 100644 --- a/sources/pyside6/tests/pysidetest/list_signal_test.py +++ b/sources/pyside6/tests/pysidetest/list_signal_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py b/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py index 1d536c0ae..d4fb039ed 100644 --- a/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py +++ b/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' PYSIDE-315: https://bugreports.qt.io/browse/PYSIDE-315 Test that all signals and slots of a class (including any mixin classes) diff --git a/sources/pyside6/tests/pysidetest/mock_as_slot_test.py b/sources/pyside6/tests/pysidetest/mock_as_slot_test.py index 39f52adea..f6504a789 100644 --- a/sources/pyside6/tests/pysidetest/mock_as_slot_test.py +++ b/sources/pyside6/tests/pysidetest/mock_as_slot_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ PYSIDE-1755: https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1755 Tests that a unittest.mock.MagicMock() can be used as a slot for quick diff --git a/sources/pyside6/tests/pysidetest/modelview_test.py b/sources/pyside6/tests/pysidetest/modelview_test.py index 53231aebe..3bcfc9cdc 100644 --- a/sources/pyside6/tests/pysidetest/modelview_test.py +++ b/sources/pyside6/tests/pysidetest/modelview_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py b/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py index 49550ba55..a9808cfa3 100644 --- a/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py +++ b/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/new_inherited_functions_test.py b/sources/pyside6/tests/pysidetest/new_inherited_functions_test.py index 924a2eea7..e474e5d39 100644 --- a/sources/pyside6/tests/pysidetest/new_inherited_functions_test.py +++ b/sources/pyside6/tests/pysidetest/new_inherited_functions_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/notify_id.py b/sources/pyside6/tests/pysidetest/notify_id.py index 0c4f39f66..49ba6969f 100644 --- a/sources/pyside6/tests/pysidetest/notify_id.py +++ b/sources/pyside6/tests/pysidetest/notify_id.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/pysidetest/properties_test.py b/sources/pyside6/tests/pysidetest/properties_test.py index 8eb7812d1..00d7aad1b 100644 --- a/sources/pyside6/tests/pysidetest/properties_test.py +++ b/sources/pyside6/tests/pysidetest/properties_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/property_python_test.py b/sources/pyside6/tests/pysidetest/property_python_test.py index 1209aad4f..31c1f40c7 100644 --- a/sources/pyside6/tests/pysidetest/property_python_test.py +++ b/sources/pyside6/tests/pysidetest/property_python_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ Test for PySide's Property diff --git a/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py b/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py index 625f9cdc5..c2a608868 100644 --- a/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py +++ b/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ PYSIDE-1735: Testing different relax options for Enums diff --git a/sources/pyside6/tests/pysidetest/qapp_like_a_macro_test.py b/sources/pyside6/tests/pysidetest/qapp_like_a_macro_test.py index 2a3f34014..c53b533a1 100644 --- a/sources/pyside6/tests/pysidetest/qapp_like_a_macro_test.py +++ b/sources/pyside6/tests/pysidetest/qapp_like_a_macro_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/qvariant_test.py b/sources/pyside6/tests/pysidetest/qvariant_test.py index faefc8169..5748daee4 100644 --- a/sources/pyside6/tests/pysidetest/qvariant_test.py +++ b/sources/pyside6/tests/pysidetest/qvariant_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import enum import os diff --git a/sources/pyside6/tests/pysidetest/repr_test.py b/sources/pyside6/tests/pysidetest/repr_test.py index 863f17657..393d46967 100644 --- a/sources/pyside6/tests/pysidetest/repr_test.py +++ b/sources/pyside6/tests/pysidetest/repr_test.py @@ -1,6 +1,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # Copyright (C) 2019 Andreas Beckermann # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/shared_pointer_test.py b/sources/pyside6/tests/pysidetest/shared_pointer_test.py index 6f49d69b1..a5c833647 100644 --- a/sources/pyside6/tests/pysidetest/shared_pointer_test.py +++ b/sources/pyside6/tests/pysidetest/shared_pointer_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/pysidetest/signal_slot_warning.py b/sources/pyside6/tests/pysidetest/signal_slot_warning.py index b94281643..06ee338fd 100644 --- a/sources/pyside6/tests/pysidetest/signal_slot_warning.py +++ b/sources/pyside6/tests/pysidetest/signal_slot_warning.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' PYSIDE-315: https://bugreports.qt.io/browse/PYSIDE-315 Test that creating a signal in the wrong order triggers a warning. ''' diff --git a/sources/pyside6/tests/pysidetest/signal_tp_descr_get_test.py b/sources/pyside6/tests/pysidetest/signal_tp_descr_get_test.py index 6025d119d..2253572b0 100644 --- a/sources/pyside6/tests/pysidetest/signal_tp_descr_get_test.py +++ b/sources/pyside6/tests/pysidetest/signal_tp_descr_get_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ PYSIDE-68: Test that signals have a `__get__` function after all. diff --git a/sources/pyside6/tests/pysidetest/signalandnamespace_test.py b/sources/pyside6/tests/pysidetest/signalandnamespace_test.py index 3e91ca338..7d8c711c9 100644 --- a/sources/pyside6/tests/pysidetest/signalandnamespace_test.py +++ b/sources/pyside6/tests/pysidetest/signalandnamespace_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py b/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py index 70c9e0082..b1b69a679 100644 --- a/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py +++ b/sources/pyside6/tests/pysidetest/signalemissionfrompython_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/pysidetest/signalinstance_equality_test.py b/sources/pyside6/tests/pysidetest/signalinstance_equality_test.py index 5faaa38d4..61e59286f 100644 --- a/sources/pyside6/tests/pysidetest/signalinstance_equality_test.py +++ b/sources/pyside6/tests/pysidetest/signalinstance_equality_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py b/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py index 744b8c503..5b8df2f3e 100644 --- a/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py +++ b/sources/pyside6/tests/pysidetest/signalwithdefaultvalue_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/pysidetest/snake_case_sub.py b/sources/pyside6/tests/pysidetest/snake_case_sub.py index 4a482c35a..c5b751454 100644 --- a/sources/pyside6/tests/pysidetest/snake_case_sub.py +++ b/sources/pyside6/tests/pysidetest/snake_case_sub.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/snake_case_test.py b/sources/pyside6/tests/pysidetest/snake_case_test.py index 14e035773..f764bc6e1 100644 --- a/sources/pyside6/tests/pysidetest/snake_case_test.py +++ b/sources/pyside6/tests/pysidetest/snake_case_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/true_property_test.py b/sources/pyside6/tests/pysidetest/true_property_test.py index 62f6505dc..df68cedf1 100644 --- a/sources/pyside6/tests/pysidetest/true_property_test.py +++ b/sources/pyside6/tests/pysidetest/true_property_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/typedef_signal_test.py b/sources/pyside6/tests/pysidetest/typedef_signal_test.py index d0bdc880b..969ebb98e 100644 --- a/sources/pyside6/tests/pysidetest/typedef_signal_test.py +++ b/sources/pyside6/tests/pysidetest/typedef_signal_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/pysidetest/version_test.py b/sources/pyside6/tests/pysidetest/version_test.py index f47ffc6d0..a1280f14d 100644 --- a/sources/pyside6/tests/pysidetest/version_test.py +++ b/sources/pyside6/tests/pysidetest/version_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/registry/existence_test.py b/sources/pyside6/tests/registry/existence_test.py index 5540b6e04..2ad4c5b1b 100644 --- a/sources/pyside6/tests/registry/existence_test.py +++ b/sources/pyside6/tests/registry/existence_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ existence_test.py diff --git a/sources/pyside6/tests/registry/init_platform.py b/sources/pyside6/tests/registry/init_platform.py index 8abf30216..9e70e7b49 100644 --- a/sources/pyside6/tests/registry/init_platform.py +++ b/sources/pyside6/tests/registry/init_platform.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ init_platform.py @@ -163,6 +164,7 @@ def enum_all(): LICENSE_TEXT = """ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ diff --git a/sources/pyside6/tests/registry/scrape_testresults.py b/sources/pyside6/tests/registry/scrape_testresults.py index b7b6b58aa..89ff8d16b 100644 --- a/sources/pyside6/tests/registry/scrape_testresults.py +++ b/sources/pyside6/tests/registry/scrape_testresults.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ scrape_testresults.py diff --git a/sources/pyside6/tests/registry/util.py b/sources/pyside6/tests/registry/util.py index 5d81926a1..97978f310 100644 --- a/sources/pyside6/tests/registry/util.py +++ b/sources/pyside6/tests/registry/util.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ Supporting isolation of warnings diff --git a/sources/pyside6/tests/signals/anonymous_slot_leak_test.py b/sources/pyside6/tests/signals/anonymous_slot_leak_test.py index 560a08659..f930d7c3b 100644 --- a/sources/pyside6/tests/signals/anonymous_slot_leak_test.py +++ b/sources/pyside6/tests/signals/anonymous_slot_leak_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/args_dont_match_test.py b/sources/pyside6/tests/signals/args_dont_match_test.py index 4f56be348..36b905a52 100644 --- a/sources/pyside6/tests/signals/args_dont_match_test.py +++ b/sources/pyside6/tests/signals/args_dont_match_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/bug_189.py b/sources/pyside6/tests/signals/bug_189.py index 1c013ddea..72d604061 100644 --- a/sources/pyside6/tests/signals/bug_189.py +++ b/sources/pyside6/tests/signals/bug_189.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/bug_311.py b/sources/pyside6/tests/signals/bug_311.py index e27476172..b01caa952 100644 --- a/sources/pyside6/tests/signals/bug_311.py +++ b/sources/pyside6/tests/signals/bug_311.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/bug_312.py b/sources/pyside6/tests/signals/bug_312.py index 80d56a020..49be26382 100644 --- a/sources/pyside6/tests/signals/bug_312.py +++ b/sources/pyside6/tests/signals/bug_312.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/bug_319.py b/sources/pyside6/tests/signals/bug_319.py index 657733afb..2de53f8e2 100644 --- a/sources/pyside6/tests/signals/bug_319.py +++ b/sources/pyside6/tests/signals/bug_319.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/bug_79.py b/sources/pyside6/tests/signals/bug_79.py index 77ac621d5..99dc1bccb 100644 --- a/sources/pyside6/tests/signals/bug_79.py +++ b/sources/pyside6/tests/signals/bug_79.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import gc diff --git a/sources/pyside6/tests/signals/decorators_test.py b/sources/pyside6/tests/signals/decorators_test.py index b29339ee4..431c81d11 100644 --- a/sources/pyside6/tests/signals/decorators_test.py +++ b/sources/pyside6/tests/signals/decorators_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/disconnect_test.py b/sources/pyside6/tests/signals/disconnect_test.py index ea3782a91..61ce4d5b8 100644 --- a/sources/pyside6/tests/signals/disconnect_test.py +++ b/sources/pyside6/tests/signals/disconnect_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/invalid_callback_test.py b/sources/pyside6/tests/signals/invalid_callback_test.py index 2788c1d1a..136ffa3d8 100644 --- a/sources/pyside6/tests/signals/invalid_callback_test.py +++ b/sources/pyside6/tests/signals/invalid_callback_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for passing invalid callbacks to QObject.connect''' diff --git a/sources/pyside6/tests/signals/lambda_gui_test.py b/sources/pyside6/tests/signals/lambda_gui_test.py index 2123e7206..7eacab0c4 100644 --- a/sources/pyside6/tests/signals/lambda_gui_test.py +++ b/sources/pyside6/tests/signals/lambda_gui_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Connecting lambda to gui signals''' diff --git a/sources/pyside6/tests/signals/lambda_test.py b/sources/pyside6/tests/signals/lambda_test.py index 23fcdf5fa..e0e016f4d 100644 --- a/sources/pyside6/tests/signals/lambda_test.py +++ b/sources/pyside6/tests/signals/lambda_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Connecting lambda to signals''' diff --git a/sources/pyside6/tests/signals/leaking_signal_test.py b/sources/pyside6/tests/signals/leaking_signal_test.py index 666ae7a13..be9c4c879 100644 --- a/sources/pyside6/tests/signals/leaking_signal_test.py +++ b/sources/pyside6/tests/signals/leaking_signal_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/multiple_connections_gui_test.py b/sources/pyside6/tests/signals/multiple_connections_gui_test.py index 295369b7d..f1ad4ffd6 100644 --- a/sources/pyside6/tests/signals/multiple_connections_gui_test.py +++ b/sources/pyside6/tests/signals/multiple_connections_gui_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/multiple_connections_test.py b/sources/pyside6/tests/signals/multiple_connections_test.py index 233851797..fb03dad3c 100644 --- a/sources/pyside6/tests/signals/multiple_connections_test.py +++ b/sources/pyside6/tests/signals/multiple_connections_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations from functools import partial import os diff --git a/sources/pyside6/tests/signals/pysignal_test.py b/sources/pyside6/tests/signals/pysignal_test.py index d6f44edf8..9517b2fbc 100644 --- a/sources/pyside6/tests/signals/pysignal_test.py +++ b/sources/pyside6/tests/signals/pysignal_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/qobject_callable_connect_test.py b/sources/pyside6/tests/signals/qobject_callable_connect_test.py index a7a26d6f5..ff189332e 100644 --- a/sources/pyside6/tests/signals/qobject_callable_connect_test.py +++ b/sources/pyside6/tests/signals/qobject_callable_connect_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/qobject_destroyed_test.py b/sources/pyside6/tests/signals/qobject_destroyed_test.py index a21762b41..50bc9be15 100644 --- a/sources/pyside6/tests/signals/qobject_destroyed_test.py +++ b/sources/pyside6/tests/signals/qobject_destroyed_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/qobject_receivers_test.py b/sources/pyside6/tests/signals/qobject_receivers_test.py index 9839255ac..fb283e0cd 100644 --- a/sources/pyside6/tests/signals/qobject_receivers_test.py +++ b/sources/pyside6/tests/signals/qobject_receivers_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test case for QObject.receivers()''' diff --git a/sources/pyside6/tests/signals/qobject_sender_test.py b/sources/pyside6/tests/signals/qobject_sender_test.py index 9c1121eb8..0e8ad2c0b 100644 --- a/sources/pyside6/tests/signals/qobject_sender_test.py +++ b/sources/pyside6/tests/signals/qobject_sender_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for QObject.sender()''' diff --git a/sources/pyside6/tests/signals/ref01_test.py b/sources/pyside6/tests/signals/ref01_test.py index 1a62b2218..0a247fb3c 100644 --- a/sources/pyside6/tests/signals/ref01_test.py +++ b/sources/pyside6/tests/signals/ref01_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/ref02_test.py b/sources/pyside6/tests/signals/ref02_test.py index 54b6f4a52..be2cccc46 100644 --- a/sources/pyside6/tests/signals/ref02_test.py +++ b/sources/pyside6/tests/signals/ref02_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/ref03_test.py b/sources/pyside6/tests/signals/ref03_test.py index c43c2e549..ef2f55082 100644 --- a/sources/pyside6/tests/signals/ref03_test.py +++ b/sources/pyside6/tests/signals/ref03_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/ref04_test.py b/sources/pyside6/tests/signals/ref04_test.py index fce801456..25c733e47 100644 --- a/sources/pyside6/tests/signals/ref04_test.py +++ b/sources/pyside6/tests/signals/ref04_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/ref05_test.py b/sources/pyside6/tests/signals/ref05_test.py index fb9debf39..a7e5feac1 100644 --- a/sources/pyside6/tests/signals/ref05_test.py +++ b/sources/pyside6/tests/signals/ref05_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/ref06_test.py b/sources/pyside6/tests/signals/ref06_test.py index a827131db..7ec3baba2 100644 --- a/sources/pyside6/tests/signals/ref06_test.py +++ b/sources/pyside6/tests/signals/ref06_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/segfault_proxyparent_test.py b/sources/pyside6/tests/signals/segfault_proxyparent_test.py index cb0df0978..695959468 100644 --- a/sources/pyside6/tests/signals/segfault_proxyparent_test.py +++ b/sources/pyside6/tests/signals/segfault_proxyparent_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/self_connect_test.py b/sources/pyside6/tests/signals/self_connect_test.py index 08ca725f8..fdc786ddf 100644 --- a/sources/pyside6/tests/signals/self_connect_test.py +++ b/sources/pyside6/tests/signals/self_connect_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Using self.connect(signal, method)''' diff --git a/sources/pyside6/tests/signals/short_circuit_test.py b/sources/pyside6/tests/signals/short_circuit_test.py index 1ad4bc24c..e0453d8ec 100644 --- a/sources/pyside6/tests/signals/short_circuit_test.py +++ b/sources/pyside6/tests/signals/short_circuit_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/pyside6/tests/signals/signal2signal_connect_test.py b/sources/pyside6/tests/signals/signal2signal_connect_test.py index 31129f7a1..7d9c0bf91 100644 --- a/sources/pyside6/tests/signals/signal2signal_connect_test.py +++ b/sources/pyside6/tests/signals/signal2signal_connect_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test case for signal to signal connections.''' diff --git a/sources/pyside6/tests/signals/signal_across_threads.py b/sources/pyside6/tests/signals/signal_across_threads.py index 91b1ca986..5b18d78f7 100644 --- a/sources/pyside6/tests/signals/signal_across_threads.py +++ b/sources/pyside6/tests/signals/signal_across_threads.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for PYSIDE-1354: Ensure that slots are invoked from the receiver's thread context when using derived classes (and thus, a global receiver).''' diff --git a/sources/pyside6/tests/signals/signal_autoconnect_test.py b/sources/pyside6/tests/signals/signal_autoconnect_test.py index 51d1cea3a..5975c0bd7 100644 --- a/sources/pyside6/tests/signals/signal_autoconnect_test.py +++ b/sources/pyside6/tests/signals/signal_autoconnect_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/signal_connectiontype_support_test.py b/sources/pyside6/tests/signals/signal_connectiontype_support_test.py index 0a69c1e02..bab0b9717 100644 --- a/sources/pyside6/tests/signals/signal_connectiontype_support_test.py +++ b/sources/pyside6/tests/signals/signal_connectiontype_support_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/signal_emission_gui_test.py b/sources/pyside6/tests/signals/signal_emission_gui_test.py index 5a49b9d12..1e027c59e 100644 --- a/sources/pyside6/tests/signals/signal_emission_gui_test.py +++ b/sources/pyside6/tests/signals/signal_emission_gui_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """Tests covering signal emission and receiving to python slots""" diff --git a/sources/pyside6/tests/signals/signal_emission_test.py b/sources/pyside6/tests/signals/signal_emission_test.py index b31d89c2f..769b1839a 100644 --- a/sources/pyside6/tests/signals/signal_emission_test.py +++ b/sources/pyside6/tests/signals/signal_emission_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """Tests covering signal emission and receiving to python slots""" diff --git a/sources/pyside6/tests/signals/signal_enum_test.py b/sources/pyside6/tests/signals/signal_enum_test.py index a792e9b0c..bc79e2db1 100644 --- a/sources/pyside6/tests/signals/signal_enum_test.py +++ b/sources/pyside6/tests/signals/signal_enum_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations from enum import Enum import os diff --git a/sources/pyside6/tests/signals/signal_func_test.py b/sources/pyside6/tests/signals/signal_func_test.py index d441d4de9..511223fcf 100644 --- a/sources/pyside6/tests/signals/signal_func_test.py +++ b/sources/pyside6/tests/signals/signal_func_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/signal_manager_refcount_test.py b/sources/pyside6/tests/signals/signal_manager_refcount_test.py index 955d5b65b..d11d1704f 100644 --- a/sources/pyside6/tests/signals/signal_manager_refcount_test.py +++ b/sources/pyside6/tests/signals/signal_manager_refcount_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os diff --git a/sources/pyside6/tests/signals/signal_newenum_test.py b/sources/pyside6/tests/signals/signal_newenum_test.py index 5fbb875af..839c9e2af 100644 --- a/sources/pyside6/tests/signals/signal_newenum_test.py +++ b/sources/pyside6/tests/signals/signal_newenum_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/signal_number_limit_test.py b/sources/pyside6/tests/signals/signal_number_limit_test.py index 29825fe50..959ae6f08 100644 --- a/sources/pyside6/tests/signals/signal_number_limit_test.py +++ b/sources/pyside6/tests/signals/signal_number_limit_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/signal_object_test.py b/sources/pyside6/tests/signals/signal_object_test.py index 607f51813..84f2aba4c 100644 --- a/sources/pyside6/tests/signals/signal_object_test.py +++ b/sources/pyside6/tests/signals/signal_object_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/signal_signature_test.py b/sources/pyside6/tests/signals/signal_signature_test.py index e8f08b2d9..905b5b01b 100644 --- a/sources/pyside6/tests/signals/signal_signature_test.py +++ b/sources/pyside6/tests/signals/signal_signature_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for signal signature received by QObject::connectNotify().''' diff --git a/sources/pyside6/tests/signals/signal_with_primitive_type_test.py b/sources/pyside6/tests/signals/signal_with_primitive_type_test.py index 01492b333..96554c31b 100644 --- a/sources/pyside6/tests/signals/signal_with_primitive_type_test.py +++ b/sources/pyside6/tests/signals/signal_with_primitive_type_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/signals/slot_reference_count_test.py b/sources/pyside6/tests/signals/slot_reference_count_test.py index 9d5c73652..88c97f33d 100644 --- a/sources/pyside6/tests/signals/slot_reference_count_test.py +++ b/sources/pyside6/tests/signals/slot_reference_count_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Forced disconnection: Delete one end of the signal connection''' diff --git a/sources/pyside6/tests/signals/static_metaobject_test.py b/sources/pyside6/tests/signals/static_metaobject_test.py index d7bf73e44..b48e4bc29 100644 --- a/sources/pyside6/tests/signals/static_metaobject_test.py +++ b/sources/pyside6/tests/signals/static_metaobject_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """Tests covering signal emission and receiving to python slots""" diff --git a/sources/pyside6/tests/support/voidptr_test.py b/sources/pyside6/tests/support/voidptr_test.py index d9ea57a61..a5b6e48ef 100644 --- a/sources/pyside6/tests/support/voidptr_test.py +++ b/sources/pyside6/tests/support/voidptr_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/tools/list-class-hierarchy.py b/sources/pyside6/tests/tools/list-class-hierarchy.py index b773b7c58..2a3824f23 100644 --- a/sources/pyside6/tests/tools/list-class-hierarchy.py +++ b/sources/pyside6/tests/tools/list-class-hierarchy.py @@ -1,6 +1,7 @@ #!/usr/bin/python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations # This is a small script printing out Qt binding class hierarchies # for comparison purposes. diff --git a/sources/pyside6/tests/tools/metaobjectdump/test_metaobjectdump.py b/sources/pyside6/tests/tools/metaobjectdump/test_metaobjectdump.py index 5e7412bf5..fbfea010e 100644 --- a/sources/pyside6/tests/tools/metaobjectdump/test_metaobjectdump.py +++ b/sources/pyside6/tests/tools/metaobjectdump/test_metaobjectdump.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/pyside6/tests/tools/pyside6-android-deploy/extensive_android_deploy_test.py b/sources/pyside6/tests/tools/pyside6-android-deploy/extensive_android_deploy_test.py index 271f8eebd..c189922ed 100644 --- a/sources/pyside6/tests/tools/pyside6-android-deploy/extensive_android_deploy_test.py +++ b/sources/pyside6/tests/tools/pyside6-android-deploy/extensive_android_deploy_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ Extensive manual test of pyside6-android-deploy diff --git a/sources/pyside6/tests/tools/pyside6-android-deploy/test_pyside6_android_deploy.py b/sources/pyside6/tests/tools/pyside6-android-deploy/test_pyside6_android_deploy.py index ec575e923..a67f1a87a 100644 --- a/sources/pyside6/tests/tools/pyside6-android-deploy/test_pyside6_android_deploy.py +++ b/sources/pyside6/tests/tools/pyside6-android-deploy/test_pyside6_android_deploy.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import importlib import os diff --git a/sources/pyside6/tests/tools/pyside6-deploy/extensive_deploy_test.py b/sources/pyside6/tests/tools/pyside6-deploy/extensive_deploy_test.py index 40afc7f5c..d15795f4d 100644 --- a/sources/pyside6/tests/tools/pyside6-deploy/extensive_deploy_test.py +++ b/sources/pyside6/tests/tools/pyside6-deploy/extensive_deploy_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ Extensive manual test of pyside6-deploy diff --git a/sources/pyside6/tests/tools/pyside6-deploy/test_pyside6_deploy.py b/sources/pyside6/tests/tools/pyside6-deploy/test_pyside6_deploy.py index 02293c33e..e55f82314 100644 --- a/sources/pyside6/tests/tools/pyside6-deploy/test_pyside6_deploy.py +++ b/sources/pyside6/tests/tools/pyside6-deploy/test_pyside6_deploy.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import unittest import tempfile @@ -63,6 +64,9 @@ class DeployTestBase(LongSortedOptionTest): cls.deploy_lib = importlib.import_module("deploy_lib") cls.deploy = importlib.import_module("deploy") sys.modules["deploy"] = cls.deploy + files_to_ignore = [".cpp.o", ".qsb", ".webp"] + cls.dlls_ignore_nuitka = " ".join([f"--noinclude-dlls=*{file}" + for file in files_to_ignore]) # required for comparing long strings cls.maxDiff = None @@ -107,6 +111,7 @@ class TestPySide6DeployWidgets(DeployTestBase): f" --enable-plugin=pyside6 --output-dir={str(self.deployment_files)} --quiet" f" --noinclude-qt-translations" f" --include-qt-plugins={plugins_nuitka}" + f" {self.dlls_ignore_nuitka}" ) if sys.platform.startswith("linux"): self.expected_run_cmd += f" --linux-icon={str(self.linux_icon)} --onefile" @@ -147,7 +152,7 @@ class TestPySide6DeployWidgets(DeployTestBase): self.assertEqual(config_obj.get_value("app", "project_dir"), ".") self.assertEqual(config_obj.get_value("app", "exec_directory"), ".") self.assertEqual(config_obj.get_value("python", "packages"), - "Nuitka==2.1") + "Nuitka==2.3.2") self.assertEqual(config_obj.get_value("qt", "qml_files"), "") equ_base = "--quiet --noinclude-qt-translations" equ_value = equ_base + " --static-libpython=no" if is_pyenv_python() else equ_base @@ -170,6 +175,16 @@ class TestPySide6DeployWidgets(DeployTestBase): self.deploy.main(main_file=fake_main_file, config_file=self.config_file) self.assertTrue("Directory does not contain main.py file." in str(context.exception)) + def testStandaloneMode(self, mock_plugins): + mock_plugins.return_value = self.all_plugins + # remove --onefile from self.expected_run_cmd and replace it with --standalone + self.expected_run_cmd = self.expected_run_cmd.replace(" --onefile", " --standalone") + # test standalone mode + original_output = self.deploy.main(self.main_file, mode="standalone", dry_run=True, + force=True) + + self.assertEqual(original_output, self.expected_run_cmd) + @unittest.skipIf(sys.platform == "darwin" and int(platform.mac_ver()[0].split('.')[0]) <= 11, "Test only works on macOS version 12+") @@ -189,6 +204,7 @@ class TestPySide6DeployQml(DeployTestBase): self.deployment_files = self.temp_example_qml / "deployment" self.first_qml_file = "main.qml" self.second_qml_file = "MovingRectangle.qml" + # All the plugins included. This is different from plugins_nuitka, because Nuitka bundles # some plugins by default self.all_plugins = ["accessiblebridge", "egldeviceintegrations", "generic", "iconengines", @@ -203,6 +219,8 @@ class TestPySide6DeployQml(DeployTestBase): f"{sys.executable} -m nuitka {str(self.main_file)} --follow-imports" f" --enable-plugin=pyside6 --output-dir={str(self.deployment_files)} --quiet" f" --noinclude-qt-translations" + f" {self.dlls_ignore_nuitka}" + " --noinclude-dlls=*/qml/QtQuickEffectMaker/*" f" --include-qt-plugins={plugins_nuitka}" f" --include-data-files={str(self.temp_example_qml / self.first_qml_file)}=" f"./main.qml --include-data-files=" @@ -250,7 +268,7 @@ class TestPySide6DeployQml(DeployTestBase): self.assertEqual(config_obj.get_value("app", "project_dir"), ".") self.assertEqual(config_obj.get_value("app", "exec_directory"), ".") self.assertEqual(config_obj.get_value("python", "packages"), - "Nuitka==2.1") + "Nuitka==2.3.2") self.assertEqual(config_obj.get_value("qt", "qml_files"), "main.qml,MovingRectangle.qml") equ_base = "--quiet --noinclude-qt-translations" equ_value = equ_base + " --static-libpython=no" if is_pyenv_python() else equ_base @@ -334,6 +352,8 @@ class TestPySide6DeployWebEngine(DeployTestBase): f" --noinclude-qt-translations --include-qt-plugins=all" f" {data_files_cmd}" f" --include-qt-plugins={plugins_nuitka}" + f" {self.dlls_ignore_nuitka}" + " --noinclude-dlls=*/qml/QtQuickEffectMaker/*" ) if sys.platform != "win32": diff --git a/sources/pyside6/tests/tools/pyside6-qml/test_pyside6_qml.py b/sources/pyside6/tests/tools/pyside6-qml/test_pyside6_qml.py index fdaf3d471..6015ebc88 100644 --- a/sources/pyside6/tests/tools/pyside6-qml/test_pyside6_qml.py +++ b/sources/pyside6/tests/tools/pyside6-qml/test_pyside6_qml.py @@ -1,5 +1,6 @@ # Copyright (C) 2018 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """Test for pyside6-qml diff --git a/sources/pyside6/tests/util/color.py b/sources/pyside6/tests/util/color.py index e85be28f3..fb91beac8 100644 --- a/sources/pyside6/tests/util/color.py +++ b/sources/pyside6/tests/util/color.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Function to print a colored line to terminal''' diff --git a/sources/pyside6/tests/util/helper/basicpyslotcase.py b/sources/pyside6/tests/util/helper/basicpyslotcase.py index 500735c3a..80da149bd 100644 --- a/sources/pyside6/tests/util/helper/basicpyslotcase.py +++ b/sources/pyside6/tests/util/helper/basicpyslotcase.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc diff --git a/sources/pyside6/tests/util/helper/docmodifier.py b/sources/pyside6/tests/util/helper/docmodifier.py index cfb665640..b6de62abb 100644 --- a/sources/pyside6/tests/util/helper/docmodifier.py +++ b/sources/pyside6/tests/util/helper/docmodifier.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Helper metaclass do 'decorate' docstrings from base test case classes''' diff --git a/sources/pyside6/tests/util/helper/helper.py b/sources/pyside6/tests/util/helper/helper.py index f80753f1f..ba742099e 100644 --- a/sources/pyside6/tests/util/helper/helper.py +++ b/sources/pyside6/tests/util/helper/helper.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Helper classes and functions''' diff --git a/sources/pyside6/tests/util/helper/timedqapplication.py b/sources/pyside6/tests/util/helper/timedqapplication.py index d9250a9e0..4984ad2c0 100644 --- a/sources/pyside6/tests/util/helper/timedqapplication.py +++ b/sources/pyside6/tests/util/helper/timedqapplication.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Helper classes and functions''' diff --git a/sources/pyside6/tests/util/helper/timedqguiapplication.py b/sources/pyside6/tests/util/helper/timedqguiapplication.py index 3d9a4217c..86bc8df7d 100644 --- a/sources/pyside6/tests/util/helper/timedqguiapplication.py +++ b/sources/pyside6/tests/util/helper/timedqguiapplication.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Helper classes and functions''' diff --git a/sources/pyside6/tests/util/helper/usesqapplication.py b/sources/pyside6/tests/util/helper/usesqapplication.py index f62e320f4..44723d392 100644 --- a/sources/pyside6/tests/util/helper/usesqapplication.py +++ b/sources/pyside6/tests/util/helper/usesqapplication.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Helper classes and functions''' diff --git a/sources/pyside6/tests/util/httpd.py b/sources/pyside6/tests/util/httpd.py index 4e6be4881..9141c191c 100644 --- a/sources/pyside6/tests/util/httpd.py +++ b/sources/pyside6/tests/util/httpd.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import http.server as BaseHTTPServer import os diff --git a/sources/pyside6/tests/util/processtimer.py b/sources/pyside6/tests/util/processtimer.py index e471cf167..8187901c6 100644 --- a/sources/pyside6/tests/util/processtimer.py +++ b/sources/pyside6/tests/util/processtimer.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import time diff --git a/sources/pyside6/tests/util/test_processtimer.py b/sources/pyside6/tests/util/test_processtimer.py index cee6aa14d..417db8bec 100644 --- a/sources/pyside6/tests/util/test_processtimer.py +++ b/sources/pyside6/tests/util/test_processtimer.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations 'Tests for processtimer.py' diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp index 29566a272..f07fb96c6 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp @@ -81,7 +81,7 @@ QTextStream &operator<<(QTextStream &str, const RejectEntry &re) return str; } -static void applyCachedFunctionModifications(AbstractMetaFunction *metaFunction, +static void applyCachedFunctionModifications(const AbstractMetaFunctionPtr &metaFunction, const FunctionModificationList &functionMods) { for (const FunctionModification &mod : functionMods) { @@ -317,7 +317,7 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(const FunctionModelIte return; } - AbstractMetaFunction *metaFunction = traverseFunction(item, baseoperandClass); + auto metaFunction = traverseFunction(item, baseoperandClass); if (metaFunction == nullptr) return; @@ -350,7 +350,7 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(const FunctionModelIte } metaFunction->setFlags(flags); metaFunction->setAccess(Access::Public); - AbstractMetaClass::addFunction(baseoperandClass, AbstractMetaFunctionCPtr(metaFunction)); + AbstractMetaClass::addFunction(baseoperandClass, metaFunction); if (!metaFunction->arguments().isEmpty()) { const auto include = metaFunction->arguments().constFirst().type().typeEntry()->include(); baseoperandClass->typeEntry()->addArgumentInclude(include); @@ -371,7 +371,7 @@ bool AbstractMetaBuilderPrivate::traverseStreamOperator(const FunctionModelItem if (streamedClass == nullptr) return false; - AbstractMetaFunction *streamFunction = traverseFunction(item, streamedClass); + auto streamFunction = traverseFunction(item, streamedClass); if (!streamFunction) return false; @@ -401,7 +401,7 @@ bool AbstractMetaBuilderPrivate::traverseStreamOperator(const FunctionModelItem funcClass = streamClass; } - AbstractMetaClass::addFunction(funcClass, AbstractMetaFunctionCPtr(streamFunction)); + AbstractMetaClass::addFunction(funcClass, streamFunction); auto funcTe = funcClass->typeEntry(); if (funcClass == streamClass) funcTe->addArgumentInclude(streamedClass->typeEntry()->include()); @@ -461,7 +461,7 @@ FileModelItem AbstractMetaBuilderPrivate::buildDom(QByteArrayList arguments, + clang::languageLevelOption(level)); } FileModelItem result = clang::parse(arguments, addCompilerSupportArguments, - clangFlags, builder) + level, clangFlags, builder) ? builder.dom() : FileModelItem(); const clang::BaseVisitor::Diagnostics &diagnostics = builder.diagnostics(); if (const auto diagnosticsCount = diagnostics.size()) { @@ -555,17 +555,16 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom, if (!funcEntry || !funcEntry->generateCode()) continue; - AbstractMetaFunction *metaFunc = traverseFunction(func, nullptr); - if (!metaFunc) + auto metaFuncPtr = traverseFunction(func, nullptr); + if (!metaFuncPtr) continue; - AbstractMetaFunctionCPtr metaFuncPtr(metaFunc); - if (!funcEntry->hasSignature(metaFunc->minimalSignature())) + if (!funcEntry->hasSignature(metaFuncPtr->minimalSignature())) continue; - metaFunc->setTypeEntry(funcEntry); - applyFunctionModifications(metaFunc); - metaFunc->applyTypeModifications(); + metaFuncPtr->setTypeEntry(funcEntry); + applyFunctionModifications(metaFuncPtr); + metaFuncPtr->applyTypeModifications(); setInclude(funcEntry, func->fileName()); @@ -1348,7 +1347,7 @@ void AbstractMetaBuilderPrivate::traverseFields(const ScopeModelItem &scope_item } } -void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(AbstractMetaFunction *metaFunction) +void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(const AbstractMetaFunctionPtr &metaFunction) { if (!metaFunction->isConversionOperator()) return; @@ -1372,13 +1371,13 @@ void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(AbstractMetaF metaFunction->setType(metaType); } -AbstractMetaFunctionRawPtrList +AbstractMetaFunctionList AbstractMetaBuilderPrivate::classFunctionList(const ScopeModelItem &scopeItem, AbstractMetaClass::Attributes *constructorAttributes, const AbstractMetaClassPtr ¤tClass) { *constructorAttributes = {}; - AbstractMetaFunctionRawPtrList result; + AbstractMetaFunctionList result; const FunctionList &scopeFunctionList = scopeItem->functions(); result.reserve(scopeFunctionList.size()); const bool isNamespace = currentClass->isNamespace(); @@ -1388,7 +1387,7 @@ AbstractMetaFunctionRawPtrList } else if (function->isSpaceshipOperator() && !function->isDeleted()) { if (currentClass) AbstractMetaClass::addSynthesizedComparisonOperators(currentClass); - } else if (auto *metaFunction = traverseFunction(function, currentClass)) { + } else if (auto metaFunction = traverseFunction(function, currentClass)) { result.append(metaFunction); } else if (!function->isDeleted() && function->functionType() == CodeModel::Constructor) { auto arguments = function->arguments(); @@ -1404,11 +1403,11 @@ void AbstractMetaBuilderPrivate::traverseFunctions(const ScopeModelItem& scopeIt const AbstractMetaClassPtr &metaClass) { AbstractMetaClass::Attributes constructorAttributes; - const AbstractMetaFunctionRawPtrList functions = + const AbstractMetaFunctionList functions = classFunctionList(scopeItem, &constructorAttributes, metaClass); metaClass->setAttributes(metaClass->attributes() | constructorAttributes); - for (AbstractMetaFunction *metaFunction : functions) { + for (const auto &metaFunction : functions) { if (metaClass->isNamespace()) metaFunction->setCppAttribute(FunctionAttribute::Static); @@ -1461,23 +1460,20 @@ void AbstractMetaBuilderPrivate::traverseFunctions(const ScopeModelItem& scopeIt if (!metaFunction->isDestructor() && !(metaFunction->isPrivate() && metaFunction->functionType() == AbstractMetaFunction::ConstructorFunction)) { - if (metaFunction->isSignal() && metaClass->hasSignal(metaFunction)) - qCWarning(lcShiboken, "%s", qPrintable(msgSignalOverloaded(metaClass, metaFunction))); + if (metaFunction->isSignal() && metaClass->hasSignal(metaFunction.get())) + qCWarning(lcShiboken, "%s", qPrintable(msgSignalOverloaded(metaClass, + metaFunction.get()))); if (metaFunction->isConversionOperator()) fixReturnTypeOfConversionOperator(metaFunction); - AbstractMetaClass::addFunction(metaClass, AbstractMetaFunctionCPtr(metaFunction)); + AbstractMetaClass::addFunction(metaClass, metaFunction); applyFunctionModifications(metaFunction); } else if (metaFunction->isDestructor()) { metaClass->setHasPrivateDestructor(metaFunction->isPrivate()); metaClass->setHasProtectedDestructor(metaFunction->isProtected()); metaClass->setHasVirtualDestructor(metaFunction->isVirtual()); } - if (!metaFunction->ownerClass()) { - delete metaFunction; - metaFunction = nullptr; - } } fillAddedFunctions(metaClass); @@ -1539,7 +1535,7 @@ QStringList AbstractMetaBuilder::definitionNames(const QString &name, return result; } -void AbstractMetaBuilderPrivate::applyFunctionModifications(AbstractMetaFunction *func) +void AbstractMetaBuilderPrivate::applyFunctionModifications(const AbstractMetaFunctionPtr &func) { AbstractMetaFunction& funcRef = *func; for (const FunctionModification &mod : func->modifications(func->implementingClass())) { @@ -1677,15 +1673,14 @@ static AbstractMetaFunction::FunctionType functionTypeFromName(const QString &); bool AbstractMetaBuilderPrivate::traverseAddedGlobalFunction(const AddedFunctionPtr &addedFunc, QString *errorMessage) { - AbstractMetaFunction *metaFunction = - traverseAddedFunctionHelper(addedFunc, nullptr, errorMessage); + auto metaFunction = traverseAddedFunctionHelper(addedFunc, nullptr, errorMessage); if (metaFunction == nullptr) return false; - m_globalFunctions << AbstractMetaFunctionCPtr(metaFunction); + m_globalFunctions << metaFunction; return true; } -AbstractMetaFunction * +AbstractMetaFunctionPtr AbstractMetaBuilderPrivate::traverseAddedFunctionHelper(const AddedFunctionPtr &addedFunc, const AbstractMetaClassPtr &metaClass /* = {} */, QString *errorMessage) @@ -1696,10 +1691,10 @@ AbstractMetaFunction * msgAddedFunctionInvalidReturnType(addedFunc->name(), addedFunc->returnType().qualifiedName(), *errorMessage, metaClass); - return nullptr; + return {}; } - auto *metaFunction = new AbstractMetaFunction(addedFunc); + auto metaFunction = std::make_shared<AbstractMetaFunction>(addedFunc); metaFunction->setType(returnType.value()); metaFunction->setFunctionType(functionTypeFromName(addedFunc->name())); @@ -1717,8 +1712,7 @@ AbstractMetaFunction * msgAddedFunctionInvalidArgType(addedFunc->name(), arg.typeInfo.qualifiedName(), i + 1, *errorMessage, metaClass); - delete metaFunction; - return nullptr; + return {}; } type->decideUsagePattern(); @@ -1775,8 +1769,7 @@ bool AbstractMetaBuilderPrivate::traverseAddedMemberFunction(const AddedFunction const AbstractMetaClassPtr &metaClass, QString *errorMessage) { - AbstractMetaFunction *metaFunction = - traverseAddedFunctionHelper(addedFunc, metaClass, errorMessage); + auto metaFunction = traverseAddedFunctionHelper(addedFunc, metaClass, errorMessage); if (metaFunction == nullptr) return false; @@ -1796,12 +1789,13 @@ bool AbstractMetaBuilderPrivate::traverseAddedMemberFunction(const AddedFunction metaFunction->setDeclaringClass(metaClass); metaFunction->setImplementingClass(metaClass); - AbstractMetaClass::addFunction(metaClass, AbstractMetaFunctionCPtr(metaFunction)); + AbstractMetaClass::addFunction(metaClass, metaFunction); metaClass->setHasNonPrivateConstructor(true); return true; } -void AbstractMetaBuilderPrivate::fixArgumentNames(AbstractMetaFunction *func, const FunctionModificationList &mods) +void AbstractMetaBuilderPrivate::fixArgumentNames(const AbstractMetaFunctionPtr &func, + const FunctionModificationList &mods) { AbstractMetaArgumentList &arguments = func->arguments(); @@ -1920,7 +1914,7 @@ static AbstractMetaFunction::FunctionType functionTypeFromName(const QString &na // Apply the <array> modifications of the arguments static bool applyArrayArgumentModifications(const FunctionModificationList &functionMods, - AbstractMetaFunction *func, + const AbstractMetaFunctionPtr &func, QString *errorMessage) { for (const FunctionModification &mod : functionMods) { @@ -1981,13 +1975,14 @@ void AbstractMetaBuilderPrivate::rejectFunction(const FunctionModelItem &functio m_rejectedFunctions.insert({reason, signatureWithType, sortKey, rejectReason}); } -AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const FunctionModelItem &functionItem, - const AbstractMetaClassPtr ¤tClass) +AbstractMetaFunctionPtr + AbstractMetaBuilderPrivate::traverseFunction(const FunctionModelItem &functionItem, + const AbstractMetaClassPtr ¤tClass) { const auto *tdb = TypeDatabase::instance(); if (!functionItem->templateParameters().isEmpty()) - return nullptr; + return {}; if (functionItem->isDeleted()) { switch (functionItem->functionType()) { @@ -2001,7 +1996,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio default: break; } - return nullptr; + return {}; } const QString &functionName = functionItem->name(); const QString className = currentClass != nullptr ? @@ -2011,7 +2006,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio // Skip enum helpers generated by Q_ENUM if ((currentClass == nullptr || currentClass->isNamespace()) && (functionName == u"qt_getEnumMetaObject" || functionName == u"qt_getEnumName")) { - return nullptr; + return {}; } // Clang: Skip qt_metacast(), qt_metacall(), expanded from Q_OBJECT @@ -2019,10 +2014,10 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio if (currentClass != nullptr) { if (functionName == u"qt_check_for_QGADGET_macro" || functionName.startsWith(u"qt_meta")) { - return nullptr; + return {}; } if (functionName == u"metaObject" && className != u"QObject") - return nullptr; + return {}; } } // PySide extensions @@ -2030,7 +2025,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio if (tdb->isFunctionRejected(className, functionName, &rejectReason)) { rejectFunction(functionItem, currentClass, AbstractMetaBuilder::GenerationDisabled, rejectReason); - return nullptr; + return {}; } const QString &signature = functionSignature(functionItem); @@ -2041,22 +2036,22 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio qCInfo(lcShiboken, "%s::%s was rejected by the type database (%s).", qPrintable(className), qPrintable(signature), qPrintable(rejectReason)); } - return nullptr; + return {}; } if (functionItem->isFriend()) - return nullptr; + return {}; const auto cppAttributes = functionItem->attributes(); const bool deprecated = cppAttributes.testFlag(FunctionAttribute::Deprecated); if (deprecated && m_skipDeprecated) { rejectFunction(functionItem, currentClass, AbstractMetaBuilder::GenerationDisabled, u" is deprecated."_s); - return nullptr; + return {}; } AbstractMetaFunction::Flags flags; - auto *metaFunction = new AbstractMetaFunction(functionName); + auto metaFunction = std::make_shared<AbstractMetaFunction>(functionName); metaFunction->setCppAttributes(cppAttributes); const QByteArray cSignature = signature.toUtf8(); const QString unresolvedSignature = @@ -2089,8 +2084,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio if (tdb->isReturnTypeRejected(className, returnType.toString(), &rejectReason)) { rejectFunction(functionItem, currentClass, AbstractMetaBuilder::GenerationDisabled, rejectReason); - delete metaFunction; - return nullptr; + return {}; } TranslateTypeFlags flags; @@ -2104,8 +2098,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio qPrintable(msgSkippingFunction(functionItem, signature, reason))); rejectFunction(functionItem, currentClass, AbstractMetaBuilder::UnmatchedReturnType, reason); - delete metaFunction; - return nullptr; + return {}; } metaFunction->setType(type.value()); @@ -2136,8 +2129,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio if (tdb->isArgumentTypeRejected(className, arg->type().toString(), &rejectReason)) { rejectFunction(functionItem, currentClass, AbstractMetaBuilder::GenerationDisabled, rejectReason); - delete metaFunction; - return nullptr; + return {}; } TranslateTypeFlags flags; @@ -2164,8 +2156,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio qPrintable(msgSkippingFunction(functionItem, signature, reason))); rejectFunction(functionItem, currentClass, AbstractMetaBuilder::UnmatchedArgumentType, reason); - delete metaFunction; - return nullptr; + return {}; } auto metaType = metaTypeO.value(); @@ -2188,8 +2179,8 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio AbstractMetaArgumentList &metaArguments = metaFunction->arguments(); const FunctionModificationList functionMods = currentClass - ? AbstractMetaFunction::findClassModifications(metaFunction, currentClass) - : AbstractMetaFunction::findGlobalModifications(metaFunction); + ? AbstractMetaFunction::findClassModifications(metaFunction.get(), currentClass) + : AbstractMetaFunction::findGlobalModifications(metaFunction.get()); applyCachedFunctionModifications(metaFunction, functionMods); @@ -2214,7 +2205,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio && metaFunction->argumentName(i + 1, false, currentClass).isEmpty()) { qCWarning(lcShiboken, "%s", qPrintable(msgUnnamedArgumentDefaultExpression(currentClass, i + 1, - className, metaFunction))); + className, metaFunction.get()))); } } @@ -3129,15 +3120,14 @@ std::optional<AbstractMetaType> AbstractMetaClassPtr AbstractMetaBuilder::inheritTemplateClass(const ComplexTypeEntryPtr &te, const AbstractMetaClassCPtr &templateClass, - const AbstractMetaTypeList &templateTypes, - InheritTemplateFlags flags) + const AbstractMetaTypeList &templateTypes) { auto result = std::make_shared<AbstractMetaClass>(); result->setTypeDef(true); result->setTypeEntry(te); if (!AbstractMetaBuilderPrivate::inheritTemplate(result, templateClass, - templateTypes, flags)) { + templateTypes)) { return {}; } AbstractMetaBuilderPrivate::inheritTemplateFunctions(result); @@ -3224,12 +3214,9 @@ bool AbstractMetaBuilderPrivate::inheritTemplate(const AbstractMetaClassPtr &sub bool AbstractMetaBuilderPrivate::inheritTemplate(const AbstractMetaClassPtr &subclass, const AbstractMetaClassCPtr &templateClass, - const AbstractMetaTypeList &templateTypes, - InheritTemplateFlags flags) + const AbstractMetaTypeList &templateTypes) { subclass->setTemplateBaseClass(templateClass); - if (flags.testFlag(InheritTemplateFlag::SetEnclosingClass)) - subclass->setEnclosingClass(templateClass->enclosingClass()); subclass->setTemplateBaseClassInstantiations(templateTypes); subclass->setBaseClass(templateClass->baseClass()); return true; @@ -3319,7 +3306,7 @@ AbstractMetaFunctionPtr } QString errorMessage; - if (!applyArrayArgumentModifications(f->modifications(subclass), f.get(), + if (!applyArrayArgumentModifications(f->modifications(subclass), f, &errorMessage)) { qCWarning(lcShiboken, "While specializing %s (%s): %s", qPrintable(subclass->name()), qPrintable(templateClass->name()), diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.h b/sources/shiboken6/ApiExtractor/abstractmetabuilder.h index cbd8c7034..20261ed3c 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.h +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.h @@ -100,10 +100,9 @@ public: const AbstractMetaTypeList &templateTypes); static AbstractMetaClassPtr - inheritTemplateClass(const ComplexTypeEntryPtr &te, - const AbstractMetaClassCPtr &templateClass, - const AbstractMetaTypeList &templateTypes, - InheritTemplateFlags flags = {}); + inheritTemplateClass(const ComplexTypeEntryPtr &te, + const AbstractMetaClassCPtr &templateClass, + const AbstractMetaTypeList &templateTypes); /// Performs a template specialization of the member function. /// \param function Member function diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken6/ApiExtractor/abstractmetabuilder_p.h index d7aaba5b0..4e337339e 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder_p.h +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder_p.h @@ -98,20 +98,21 @@ public: const QSet<QString> &enumsDeclarations); void traverseEnums(const ScopeModelItem &item, const AbstractMetaClassPtr &parent, const QStringList &enumsDeclarations); - AbstractMetaFunctionRawPtrList classFunctionList(const ScopeModelItem &scopeItem, - AbstractMetaClass::Attributes *constructorAttributes, - const AbstractMetaClassPtr ¤tClass); + AbstractMetaFunctionList classFunctionList(const ScopeModelItem &scopeItem, + AbstractMetaClass::Attributes *constructorAttributes, + const AbstractMetaClassPtr ¤tClass); void traverseFunctions(const ScopeModelItem& item, const AbstractMetaClassPtr &parent); - static void applyFunctionModifications(AbstractMetaFunction *func); + static void applyFunctionModifications(const AbstractMetaFunctionPtr &func); void traverseFields(const ScopeModelItem &item, const AbstractMetaClassPtr &parent); bool traverseStreamOperator(const FunctionModelItem &functionItem, const AbstractMetaClassPtr ¤tClass); void traverseOperatorFunction(const FunctionModelItem &item, const AbstractMetaClassPtr ¤tClass); - AbstractMetaFunction *traverseAddedFunctionHelper(const AddedFunctionPtr &addedFunc, - const AbstractMetaClassPtr &metaClass, - QString *errorMessage); + AbstractMetaFunctionPtr + traverseAddedFunctionHelper(const AddedFunctionPtr &addedFunc, + const AbstractMetaClassPtr &metaClass, + QString *errorMessage); bool traverseAddedGlobalFunction(const AddedFunctionPtr &addedFunc, QString *errorMessage); bool traverseAddedMemberFunction(const AddedFunctionPtr &addedFunc, @@ -121,8 +122,9 @@ public: const AbstractMetaClassPtr ¤tClass, AbstractMetaBuilder::RejectReason reason, const QString &rejectReason); - AbstractMetaFunction *traverseFunction(const FunctionModelItem &function, - const AbstractMetaClassPtr ¤tClass); + AbstractMetaFunctionPtr + traverseFunction(const FunctionModelItem &function, + const AbstractMetaClassPtr ¤tClass); std::optional<AbstractMetaField> traverseField(const VariableModelItem &field, const AbstractMetaClassCPtr &cls); void checkFunctionModifications() const; @@ -142,7 +144,7 @@ public: * said class. * \param metaFunction conversion operator function to be fixed. */ - static void fixReturnTypeOfConversionOperator(AbstractMetaFunction *metaFunction); + static void fixReturnTypeOfConversionOperator(const AbstractMetaFunctionPtr &metaFunction); void parseQ_Properties(const AbstractMetaClassPtr &metaClass, const QStringList &declarations); @@ -190,8 +192,7 @@ public: const TypeInfo &info); static bool inheritTemplate(const AbstractMetaClassPtr &subclass, const AbstractMetaClassCPtr &templateClass, - const AbstractMetaTypeList &templateTypes, - InheritTemplateFlags flags = {}); + const AbstractMetaTypeList &templateTypes); static AbstractMetaFunctionPtr inheritTemplateFunction(const AbstractMetaFunctionCPtr &function, @@ -213,7 +214,8 @@ public: void sortLists(); void setInclude(const TypeEntryPtr &te, const QString &path) const; - static void fixArgumentNames(AbstractMetaFunction *func, const FunctionModificationList &mods); + static void fixArgumentNames(const AbstractMetaFunctionPtr &func, + const FunctionModificationList &mods); void fillAddedFunctions(const AbstractMetaClassPtr &metaClass); AbstractMetaClassCPtr resolveTypeSystemTypeDef(const AbstractMetaType &t) const; diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang_typedefs.h b/sources/shiboken6/ApiExtractor/abstractmetalang_typedefs.h index 802f549cf..27321ca2d 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetalang_typedefs.h +++ b/sources/shiboken6/ApiExtractor/abstractmetalang_typedefs.h @@ -30,6 +30,7 @@ using AbstractMetaEnumValueList = QList<AbstractMetaEnumValue>; using AbstractMetaFieldList = QList<AbstractMetaField>; using AbstractMetaFunctionRawPtrList = QList<AbstractMetaFunction *>; using AbstractMetaFunctionCList = QList<AbstractMetaFunctionCPtr>; +using AbstractMetaFunctionList = QList<AbstractMetaFunctionPtr>; using AbstractMetaTypeList = QList<AbstractMetaType>; using UsingMembers = QList<UsingMember>; diff --git a/sources/shiboken6/ApiExtractor/apiextractor.cpp b/sources/shiboken6/ApiExtractor/apiextractor.cpp index 83ee4437e..786cd0783 100644 --- a/sources/shiboken6/ApiExtractor/apiextractor.cpp +++ b/sources/shiboken6/ApiExtractor/apiextractor.cpp @@ -456,11 +456,10 @@ AbstractMetaFunctionPtr AbstractMetaClassPtr ApiExtractor::inheritTemplateClass(const ComplexTypeEntryPtr &te, const AbstractMetaClassCPtr &templateClass, - const AbstractMetaTypeList &templateTypes, - InheritTemplateFlags flags) + const AbstractMetaTypeList &templateTypes) { return AbstractMetaBuilder::inheritTemplateClass(te, templateClass, - templateTypes, flags); + templateTypes); } QString ApiExtractorPrivate::getSimplifiedContainerTypeName(const AbstractMetaType &type) @@ -606,7 +605,15 @@ void ApiExtractorPrivate::addInstantiatedSmartPointer(InstantiationCollectContex const auto ste = std::static_pointer_cast<const SmartPointerTypeEntry>(smp.smartPointer->typeEntry()); QString name = ste->getTargetName(smp.type); auto parentTypeEntry = ste->parent(); - InheritTemplateFlags flags; + + // FIXME PYSIDE 7: Make global scope the default behavior? + // Note: Also requires changing SmartPointerTypeEntry::getTargetName() + // to not strip namespaces from unnamed instances. + const bool globalScope = name.startsWith("::"_L1); + if (globalScope) { + name.remove(0, 2); + parentTypeEntry = typeSystemTypeEntry(ste); + } auto colonPos = name.lastIndexOf(u"::"); const bool withinNameSpace = colonPos != -1; @@ -617,19 +624,18 @@ void ApiExtractorPrivate::addInstantiatedSmartPointer(InstantiationCollectContex if (nameSpaces.isEmpty()) throw Exception(msgNamespaceNotFound(name)); parentTypeEntry = nameSpaces.constFirst(); - } else { - flags.setFlag(InheritTemplateFlag::SetEnclosingClass); } TypedefEntryPtr typedefEntry(new TypedefEntry(name, ste->name(), ste->version(), parentTypeEntry)); typedefEntry->setTargetLangPackage(ste->targetLangPackage()); auto instantiationEntry = TypeDatabase::initializeTypeDefEntry(typedefEntry, ste); + instantiationEntry->setParent(parentTypeEntry); smp.specialized = ApiExtractor::inheritTemplateClass(instantiationEntry, smp.smartPointer, - {instantiatedType}, flags); + {instantiatedType}); Q_ASSERT(smp.specialized); - if (withinNameSpace) { // move class to desired namespace + if (parentTypeEntry->type() != TypeEntry::TypeSystemType) { // move class to desired namespace const auto enclClass = AbstractMetaClass::findClass(m_builder->classes(), parentTypeEntry); Q_ASSERT(enclClass); auto specialized = std::const_pointer_cast<AbstractMetaClass>(smp.specialized); diff --git a/sources/shiboken6/ApiExtractor/apiextractor.h b/sources/shiboken6/ApiExtractor/apiextractor.h index feae9454c..7bff5c252 100644 --- a/sources/shiboken6/ApiExtractor/apiextractor.h +++ b/sources/shiboken6/ApiExtractor/apiextractor.h @@ -73,8 +73,7 @@ public: static AbstractMetaClassPtr inheritTemplateClass(const ComplexTypeEntryPtr &te, const AbstractMetaClassCPtr &templateClass, - const AbstractMetaTypeList &templateTypes, - InheritTemplateFlags flags = {}); + const AbstractMetaTypeList &templateTypes); private: ApiExtractorPrivate *d; diff --git a/sources/shiboken6/ApiExtractor/apiextractorflags.h b/sources/shiboken6/ApiExtractor/apiextractorflags.h index 4fe6ecc1a..6f69b8b77 100644 --- a/sources/shiboken6/ApiExtractor/apiextractorflags.h +++ b/sources/shiboken6/ApiExtractor/apiextractorflags.h @@ -15,12 +15,4 @@ enum class ApiExtractorFlag Q_DECLARE_FLAGS(ApiExtractorFlags, ApiExtractorFlag) Q_DECLARE_OPERATORS_FOR_FLAGS(ApiExtractorFlags) -enum class InheritTemplateFlag -{ - SetEnclosingClass = 0x1 -}; - -Q_DECLARE_FLAGS(InheritTemplateFlags, InheritTemplateFlag) -Q_DECLARE_OPERATORS_FOR_FLAGS(InheritTemplateFlags) - #endif // APIEXTRACTORFLAGS_H diff --git a/sources/shiboken6/ApiExtractor/apiextractorresult.cpp b/sources/shiboken6/ApiExtractor/apiextractorresult.cpp index 2a48a30d1..5a433bbeb 100644 --- a/sources/shiboken6/ApiExtractor/apiextractorresult.cpp +++ b/sources/shiboken6/ApiExtractor/apiextractorresult.cpp @@ -7,6 +7,7 @@ #include "enumtypeentry.h" #include "flagstypeentry.h" +#include "smartpointertypeentry.h" ApiExtractorResult::ApiExtractorResult() = default; @@ -50,6 +51,18 @@ const InstantiatedSmartPointers &ApiExtractorResult::instantiatedSmartPointers() return m_instantiatedSmartPointers; } +std::optional<InstantiatedSmartPointer> + ApiExtractorResult::findSmartPointerInstantiation(const SmartPointerTypeEntryCPtr &pointer, + const TypeEntryCPtr &pointee) const +{ + for (const auto &smp : m_instantiatedSmartPointers) { + const auto &i = smp.type; + if (i.typeEntry() == pointer && i.instantiations().at(0).typeEntry() == pointee) + return smp; + } + return std::nullopt; +} + const QMultiHash<QString, QString> &ApiExtractorResult::typedefTargetToName() const { return m_typedefTargetToName; diff --git a/sources/shiboken6/ApiExtractor/apiextractorresult.h b/sources/shiboken6/ApiExtractor/apiextractorresult.h index 88a2093f1..b2aae88ed 100644 --- a/sources/shiboken6/ApiExtractor/apiextractorresult.h +++ b/sources/shiboken6/ApiExtractor/apiextractorresult.h @@ -43,6 +43,9 @@ public: const AbstractMetaTypeList &instantiatedContainers() const; const InstantiatedSmartPointers &instantiatedSmartPointers() const; + std::optional<InstantiatedSmartPointer> + findSmartPointerInstantiation(const SmartPointerTypeEntryCPtr &pointer, + const TypeEntryCPtr &pointee) const; const QMultiHash<QString, QString> &typedefTargetToName() const; diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp index da6930476..6c0cf3ae2 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp @@ -235,6 +235,7 @@ static QByteArray msgCreateTranslationUnit(const QByteArrayList &clangArgs, unsi static CXTranslationUnit createTranslationUnit(CXIndex index, const QByteArrayList &args, bool addCompilerSupportArguments, + LanguageLevel level, unsigned flags = 0) { // courtesy qdoc @@ -255,7 +256,7 @@ static CXTranslationUnit createTranslationUnit(CXIndex index, QByteArrayList clangArgs; if (addCompilerSupportArguments) { - clangArgs += emulatedCompilerOptions(); + clangArgs += emulatedCompilerOptions(level); clangArgs += defaultArgs; } clangArgs += detectVulkan(); @@ -280,7 +281,7 @@ static CXTranslationUnit createTranslationUnit(CXIndex index, */ bool parse(const QByteArrayList &clangArgs, bool addCompilerSupportArguments, - unsigned clangFlags, BaseVisitor &bv) + LanguageLevel level, unsigned clangFlags, BaseVisitor &bv) { CXIndex index = clang_createIndex(0 /* excludeDeclarationsFromPCH */, 1 /* displayDiagnostics */); @@ -291,7 +292,7 @@ bool parse(const QByteArrayList &clangArgs, bool addCompilerSupportArguments, CXTranslationUnit translationUnit = createTranslationUnit(index, clangArgs, addCompilerSupportArguments, - clangFlags); + level, clangFlags); if (!translationUnit) return false; diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangparser.h b/sources/shiboken6/ApiExtractor/clangparser/clangparser.h index 4a46248e4..22e0a50cd 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/clangparser.h +++ b/sources/shiboken6/ApiExtractor/clangparser/clangparser.h @@ -14,6 +14,8 @@ #include <string_view> #include <utility> +enum class LanguageLevel; + namespace clang { struct Diagnostic; @@ -79,7 +81,7 @@ private: bool parse(const QByteArrayList &clangArgs, bool addCompilerSupportArguments, - unsigned clangFlags, BaseVisitor &ctx); + LanguageLevel level, unsigned clangFlags, BaseVisitor &ctx); } // namespace clang diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp index 4c13b141f..20224020b 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp @@ -106,7 +106,7 @@ static bool runProcess(const QString &program, const QStringList &arguments, QProcess process; process.start(program, arguments, QProcess::ReadWrite); if (!process.waitForStarted()) { - qWarning().noquote().nospace() << "Unable to start " + qCWarning(lcShiboken).noquote().nospace() << "Unable to start " << process.program() << ": " << process.errorString(); return false; } @@ -119,18 +119,18 @@ static bool runProcess(const QString &program, const QStringList &arguments, *stdOutIn = process.readAllStandardOutput(); if (!finished) { - qWarning().noquote().nospace() << process.program() << " timed out: " << stdErr; + qCWarning(lcShiboken).noquote().nospace() << process.program() << " timed out: " << stdErr; process.kill(); return false; } if (process.exitStatus() != QProcess::NormalExit) { - qWarning().noquote().nospace() << process.program() << " crashed: " << stdErr; + qCWarning(lcShiboken).noquote().nospace() << process.program() << " crashed: " << stdErr; return false; } if (process.exitCode() != 0) { - qWarning().noquote().nospace() << process.program() << " exited " + qCWarning(lcShiboken).noquote().nospace() << process.program() << " exited " << process.exitCode() << ": " << stdErr; return false; } @@ -263,8 +263,8 @@ static QString queryLlvmConfigDir(const QString &arg) return {}; const QString path = QFile::decodeName(stdOut.trimmed()); if (!QFileInfo::exists(path)) { - qWarning(R"(%s: "%s" as returned by llvm-config "%s" does not exist.)", - __FUNCTION__, qPrintable(QDir::toNativeSeparators(path)), qPrintable(arg)); + qCWarning(lcShiboken, R"(%s: "%s" as returned by llvm-config "%s" does not exist.)", + __FUNCTION__, qPrintable(QDir::toNativeSeparators(path)), qPrintable(arg)); return {}; } return path; @@ -277,7 +277,8 @@ static QString findClangLibDir() const QString path = QFile::decodeName(qgetenv(envVar)) + u"/lib"_s; if (QFileInfo::exists(path)) return path; - qWarning("%s: %s as pointed to by %s does not exist.", __FUNCTION__, qPrintable(path), envVar); + qCWarning(lcShiboken, "%s: %s as pointed to by %s does not exist.", + __FUNCTION__, qPrintable(path), envVar); } } return queryLlvmConfigDir(u"--libdir"_s); @@ -289,13 +290,23 @@ static QString findClangBuiltInIncludesDir() const QString clangPathLibDir = findClangLibDir(); if (!clangPathLibDir.isEmpty()) { QString candidate; + QString clangDirName = clangPathLibDir + u"/clang"_s; + // PYSIDE-2769: llvm-config --libdir may report /usr/lib64 on manylinux_2_28_x86_64 + // whereas the includes are under /usr/lib/clang/../include. + if (!QFileInfo::exists(clangDirName) && clangPathLibDir.endsWith("64"_L1)) { + const QString fallback = clangPathLibDir.sliced(0, clangPathLibDir.size() - 2); + clangDirName = fallback + u"/clang"_s; + qCWarning(lcShiboken, "%s: Falling back from %s to %s.", + __FUNCTION__, qPrintable(clangPathLibDir), qPrintable(fallback)); + } + QVersionNumber lastVersionNumber(1, 0, 0); - const QString clangDirName = clangPathLibDir + u"/clang"_s; QDir clangDir(clangDirName); const QFileInfoList versionDirs = clangDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); if (versionDirs.isEmpty()) - qWarning("%s: No subdirectories found in %s.", __FUNCTION__, qPrintable(clangDirName)); + qCWarning(lcShiboken, "%s: No subdirectories found in %s.", + __FUNCTION__, qPrintable(clangDirName)); for (const QFileInfo &fi : versionDirs) { const QString fileName = fi.fileName(); if (fileName.at(0).isDigit()) { @@ -365,14 +376,15 @@ static void appendClangBuiltinIncludes(HeaderPaths *p) } // Returns clang options needed for emulating the host compiler -QByteArrayList emulatedCompilerOptions() +QByteArrayList emulatedCompilerOptions(LanguageLevel level) { QByteArrayList result; HeaderPaths headerPaths; switch (compiler()) { case Compiler::Msvc: result.append("-fms-compatibility-version="_ba + msvcCompatVersion()); - result.append(QByteArrayLiteral("-fdelayed-template-parsing")); + if (level < LanguageLevel::Cpp20) + result.append("-fdelayed-template-parsing"_ba); result.append(QByteArrayLiteral("-Wno-microsoft-enum-value")); result.append("/Zc:__cplusplus"_ba); // Fix yvals_core.h: STL1000: Unexpected compiler version, expected Clang 7 or newer (MSVC2017 update) diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h index 462e8f205..f1d63b7c3 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h +++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h @@ -33,7 +33,7 @@ enum class Platform { namespace clang { QVersionNumber libClangVersion(); -QByteArrayList emulatedCompilerOptions(); +QByteArrayList emulatedCompilerOptions(LanguageLevel level); LanguageLevel emulatedCompilerLanguageLevel(); const char *languageLevelOption(LanguageLevel l); diff --git a/sources/shiboken6/ApiExtractor/messages.cpp b/sources/shiboken6/ApiExtractor/messages.cpp index b1f0b240e..170595660 100644 --- a/sources/shiboken6/ApiExtractor/messages.cpp +++ b/sources/shiboken6/ApiExtractor/messages.cpp @@ -995,3 +995,10 @@ QString msgInvalidLanguageLevel(const QString &l) { return u"Invalid argument for language level: \""_s + l + u"\"."_s; } + +QString msgCannotFindImage(const QString &href, const QString &context, + const QString &candidate) +{ + return "Cannot resolve image "_L1 + href + " for "_L1 + context + + " (tried "_L1 + QDir::toNativeSeparators(candidate) + ")."_L1; +} diff --git a/sources/shiboken6/ApiExtractor/messages.h b/sources/shiboken6/ApiExtractor/messages.h index e3f582b49..5216b26a7 100644 --- a/sources/shiboken6/ApiExtractor/messages.h +++ b/sources/shiboken6/ApiExtractor/messages.h @@ -261,4 +261,7 @@ QString msgMissingProjectFileMarker(const QString &name, const QByteArray &start QString msgInvalidLanguageLevel(const QString &l); +QString msgCannotFindImage(const QString &href, const QString &context, + const QString &candidate); + #endif // MESSAGES_H diff --git a/sources/shiboken6/ApiExtractor/typedatabase.cpp b/sources/shiboken6/ApiExtractor/typedatabase.cpp index 749c4baa3..61fd22418 100644 --- a/sources/shiboken6/ApiExtractor/typedatabase.cpp +++ b/sources/shiboken6/ApiExtractor/typedatabase.cpp @@ -88,7 +88,8 @@ static const PythonTypes &builtinPythonTypes() {u"PyObject"_s, u"true"_s, TypeSystem::CPythonType::Other}, // shiboken-specific {u"PyPathLike"_s, u"Shiboken::String::checkPath"_s, TypeSystem::CPythonType::Other}, - {u"PySequence"_s, u"Shiboken::String::checkIterable"_s, TypeSystem::CPythonType::Other}, + {u"PySequence"_s, u"Shiboken::String::checkIterableArgument"_s, + TypeSystem::CPythonType::Other}, {u"PyUnicode"_s, u"PyUnicode_Check"_s, TypeSystem::CPythonType::String}, {u"PyTypeObject"_s, u"PyType_Check"_s, TypeSystem::CPythonType::Other}, {u"str"_s, u"Shiboken::String::check"_s, TypeSystem::CPythonType::String}, diff --git a/sources/shiboken6/cmake/ShibokenHelpers.cmake b/sources/shiboken6/cmake/ShibokenHelpers.cmake index 8bc066102..cff6df95e 100644 --- a/sources/shiboken6/cmake/ShibokenHelpers.cmake +++ b/sources/shiboken6/cmake/ShibokenHelpers.cmake @@ -202,12 +202,6 @@ macro(get_python_extension_suffix) # Python_SOABI is only set by CMake 3.17+ # TODO: Lower this to CMake 3.16 if possible. if(SHIBOKEN_IS_CROSS_BUILD) - # For android platform armv7a FindPython module return Python_SOABI as empty because - # it is unable to set Python_CONFIG i.e. find `python3-config` script - # This workaround sets the Python_SOABI manually for this platform. - if(CMAKE_SYSTEM_NAME STREQUAL "Android" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a") - set(Python_SOABI "cpython-311}") - endif() if(NOT Python_SOABI) message(FATAL_ERROR "Python_SOABI variable is empty.") endif() @@ -320,6 +314,17 @@ macro(shiboken_find_required_python) "${_shiboken_backup_CMAKE_FIND_ROOT_PATH_MODE_PROGRAM}") set(CMAKE_FIND_ROOT_PATH "${_shiboken_backup_CMAKE_FIND_ROOT_PATH}") + + # For Android platform sometimes the FindPython module returns Python_SOABI as empty in + # certain scenarios eg: armv7a target, macOS host etc. This is because + # it is unable to set Python_CONFIG i.e. `python3-config` script + # This workaround sets the Python_SOABI manually for this Android platform. + # This needs to be updated manually if the Python version for Android cross compilation + # changes. + # TODO: Find a better way to set Python_SOABI for Android platform + if(CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT Python_SOABI) + set(Python_SOABI "cpython-311") + endif() else() find_package( Python diff --git a/sources/shiboken6/doc/scripts/patch_qhp.py b/sources/shiboken6/doc/scripts/patch_qhp.py index 750789698..88befaa2d 100644 --- a/sources/shiboken6/doc/scripts/patch_qhp.py +++ b/sources/shiboken6/doc/scripts/patch_qhp.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import fileinput import re diff --git a/sources/shiboken6/doc/shibokenmodule.rst b/sources/shiboken6/doc/shibokenmodule.rst index 2f1c6d166..3bc4fa6ba 100644 --- a/sources/shiboken6/doc/shibokenmodule.rst +++ b/sources/shiboken6/doc/shibokenmodule.rst @@ -125,6 +125,11 @@ To import the module: Dumps the map of wrappers existing in libshiboken to standard error. +.. function:: dumpConverters() + + Dumps the map of named converters existing in libshiboken to standard + error. + .. py:class:: VoidPtr(address, size = -1, writeable = 0) :param address: (PyBuffer, SbkObject, int, VoidPtr) diff --git a/sources/shiboken6/doc/typesystem_specifying_types.rst b/sources/shiboken6/doc/typesystem_specifying_types.rst index f65b79bb4..e979c4ee2 100644 --- a/sources/shiboken6/doc/typesystem_specifying_types.rst +++ b/sources/shiboken6/doc/typesystem_specifying_types.rst @@ -721,6 +721,9 @@ found in the code will be generated. The type name might optionally be followed an equal sign and the Python type name, for example ``instantiations="int=IntPtr,double=DoublePtr"``. It is also possible to specify a namespace delimited by ``::``. +By default, the type will be in the namespace of the smart pointer, +for example, ``std`` for ``std::shared_ptr``. Preceding +the type name by ``::`` causes it to be in the global namespace. The *optional* attribute **type** specifies the type: diff --git a/sources/shiboken6/generator/generator.cpp b/sources/shiboken6/generator/generator.cpp index b224858c5..a01326530 100644 --- a/sources/shiboken6/generator/generator.cpp +++ b/sources/shiboken6/generator/generator.cpp @@ -231,10 +231,9 @@ QString Generator::getFileNameBaseForSmartPointer(const AbstractMetaType &smartP const AbstractMetaType innerType = smartPointerType.getSmartPointerInnerType(); smartPointerType.typeEntry()->qualifiedCppName(); QString fileName = smartPointerType.typeEntry()->qualifiedCppName().toLower(); - fileName.replace(u"::"_s, u"_"_s); - fileName.append(u"_"_s); + fileName.append(u'_'); fileName.append(innerType.name().toLower()); - + fileName.replace(u"::"_s, u"_"_s); // std::shared_ptr<std::string> return fileName; } diff --git a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp index 2797ff254..1634a7e83 100644 --- a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp @@ -970,8 +970,10 @@ static QStringList enumListToToc(const AbstractMetaEnumList &enums) static QChar sortKey(const QString &key) { const auto size = key.size(); - if (size >= 2 && (key.at(0) == u'Q' || key.at(0) == u'q') && key.at(1).isUpper()) - return key.at(1); // "QClass" -> 'C', "qSin()" -> 'S' + if (size >= 2 && (key.at(0) == u'Q' || key.at(0) == u'q') + && (key.at(1).isUpper() || key.at(1).isDigit())) { + return key.at(1); // "QClass" -> 'C', "qSin()" -> 'S', 'Q3DSurfaceWidget' -> '3' + } if (size >= 3 && key.startsWith("Q_"_L1)) return key.at(2).toUpper(); // "Q_ARG" -> 'A' if (size >= 4 && key.startsWith("QT_"_L1)) @@ -1564,3 +1566,26 @@ QtXmlToSphinxLink QtDocGenerator::resolveLink(const QtXmlToSphinxLink &link) con } return resolved; } + +QtXmlToSphinxDocGeneratorInterface::Image + QtDocGenerator::resolveImage(const QString &href, const QString &context) const +{ + QString relativeSourceDir = href; + const QString source = m_options.parameters.docDataDir + u'/' + relativeSourceDir; + if (!QFileInfo::exists(source)) + throw Exception(msgCannotFindImage(href, context,source)); + + // Determine target directory from context, "Pyside2.QtGui.QPainter" ->"Pyside2/QtGui". + // FIXME: Not perfect yet, should have knowledge about namespaces (DataVis3D) or + // nested classes "Pyside2.QtGui.QTouchEvent.QTouchPoint". + QString relativeTargetDir = context; + const auto lastDot = relativeTargetDir.lastIndexOf(u'.'); + if (lastDot != -1) + relativeTargetDir.truncate(lastDot); + relativeTargetDir.replace(u'.', u'/'); + if (!relativeTargetDir.isEmpty()) + relativeTargetDir += u'/'; + relativeTargetDir += href; + + return {relativeSourceDir, relativeTargetDir}; +} diff --git a/sources/shiboken6/generator/qtdoc/qtdocgenerator.h b/sources/shiboken6/generator/qtdoc/qtdocgenerator.h index 3b1c82e74..56e15e2a1 100644 --- a/sources/shiboken6/generator/qtdoc/qtdocgenerator.h +++ b/sources/shiboken6/generator/qtdoc/qtdocgenerator.h @@ -48,6 +48,7 @@ public: const QString &methodName) const override; const QLoggingCategory &loggingCategory() const override; QtXmlToSphinxLink resolveLink(const QtXmlToSphinxLink &) const override; + Image resolveImage(const QString &href, const QString &context) const override; static QString getFuncName(const AbstractMetaFunctionCPtr &cppFunc); static QString formatArgs(const AbstractMetaFunctionCPtr &func); diff --git a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp index 55c1d2090..b8fec836c 100644 --- a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp +++ b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp @@ -1240,36 +1240,17 @@ WebXmlTag QtXmlToSphinx::parentTag() const // Copy images that are placed in a subdirectory "images" under the webxml files // by qdoc to a matching subdirectory under the "rst/PySide6/<module>" directory -static bool copyImage(const QString &href, const QString &docDataDir, - const QString &context, const QString &outputDir, +static bool copyImage(const QString &docDataDir, const QString &relativeSourceFile, + const QString &outputDir, const QString &relativeTargetFile, const QLoggingCategory &lc, QString *errorMessage) { - const QChar slash = u'/'; - const auto lastSlash = href.lastIndexOf(slash); - const QString imagePath = lastSlash != -1 ? href.left(lastSlash) : QString(); - const QString imageFileName = lastSlash != -1 ? href.right(href.size() - lastSlash - 1) : href; - QFileInfo imageSource(docDataDir + slash + href); - if (!imageSource.exists()) { - QTextStream(errorMessage) << "Image " << href << " does not exist in " - << QDir::toNativeSeparators(docDataDir); - return false; - } - // Determine directory from context, "Pyside2.QtGui.QPainter" ->"Pyside2/QtGui". - // FIXME: Not perfect yet, should have knowledge about namespaces (DataVis3D) or - // nested classes "Pyside2.QtGui.QTouchEvent.QTouchPoint". - QString relativeTargetDir = context; - const auto lastDot = relativeTargetDir.lastIndexOf(u'.'); - if (lastDot != -1) - relativeTargetDir.truncate(lastDot); - relativeTargetDir.replace(u'.', slash); - if (!imagePath.isEmpty()) - relativeTargetDir += slash + imagePath; - - const QString targetDir = outputDir + slash + relativeTargetDir; - const QString targetFileName = targetDir + slash + imageFileName; + QString targetFileName = outputDir + u'/' + relativeTargetFile; if (QFileInfo::exists(targetFileName)) return true; - if (!QFileInfo::exists(targetDir)) { + + QString relativeTargetDir = relativeTargetFile; + relativeTargetDir.truncate(qMax(relativeTargetDir.lastIndexOf(u'/'), qsizetype(0))); + if (!relativeTargetDir.isEmpty() && !QFileInfo::exists(outputDir + u'/' + relativeTargetDir)) { const QDir outDir(outputDir); if (!outDir.mkpath(relativeTargetDir)) { QTextStream(errorMessage) << "Cannot create " << QDir::toNativeSeparators(relativeTargetDir) @@ -1278,28 +1259,29 @@ static bool copyImage(const QString &href, const QString &docDataDir, } } - QFile source(imageSource.absoluteFilePath()); + QFile source(docDataDir + u'/' + relativeSourceFile); if (!source.copy(targetFileName)) { QTextStream(errorMessage) << "Cannot copy " << QDir::toNativeSeparators(source.fileName()) << " to " << QDir::toNativeSeparators(targetFileName) << ": " << source.errorString(); return false; } - qCDebug(lc).noquote().nospace() << __FUNCTION__ << " href=\"" - << href << "\", context=\"" << context << "\", docDataDir=\"" - << docDataDir << "\", outputDir=\"" << outputDir << "\", copied \"" - << source.fileName() << "\"->\"" << targetFileName << '"'; + + qCDebug(lc).noquote().nospace() << __FUNCTION__ << " \"" << relativeSourceFile + << "\"->\"" << relativeTargetFile << '"'; return true; } bool QtXmlToSphinx::copyImage(const QString &href) const { QString errorMessage; - const bool result = - ::copyImage(href, m_parameters.docDataDir, m_context, - m_parameters.outputDirectory, - m_generator->loggingCategory(), - &errorMessage); + const auto imagePaths = m_generator->resolveImage(href, m_context); + const bool result = ::copyImage(m_parameters.docDataDir, + imagePaths.source, + m_parameters.outputDirectory, + imagePaths.target, + m_generator->loggingCategory(), + &errorMessage); if (!result) throw Exception(errorMessage); return result; diff --git a/sources/shiboken6/generator/qtdoc/qtxmltosphinxinterface.h b/sources/shiboken6/generator/qtdoc/qtxmltosphinxinterface.h index 16eefad83..d4a098a12 100644 --- a/sources/shiboken6/generator/qtdoc/qtxmltosphinxinterface.h +++ b/sources/shiboken6/generator/qtdoc/qtxmltosphinxinterface.h @@ -53,6 +53,15 @@ public: virtual QtXmlToSphinxLink resolveLink(const QtXmlToSphinxLink &) const = 0; + // Resolve images paths relative to doc data directory/output directory. + struct Image + { + QString source; + QString target; + }; + + virtual Image resolveImage(const QString &href, const QString &context) const = 0; + virtual ~QtXmlToSphinxDocGeneratorInterface() = default; }; diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index 6c9cc5fec..97a38a08d 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -59,6 +59,7 @@ using namespace Qt::StringLiterals; static const char shibokenErrorsOccurred[] = "Shiboken::Errors::occurred() != nullptr"; static constexpr auto virtualMethodStaticReturnVar = "result"_L1; +static constexpr auto initFuncPrefix = "init_"_L1; static constexpr auto sbkObjectTypeF = "SbkObject_TypeF()"_L1; static const char initInheritanceFunction[] = "initInheritance"; @@ -1337,7 +1338,8 @@ void CppGenerator::writeVirtualMethodPythonOverride(TextStream &s, s << "if (" << PYTHON_RETURN_VAR << ".isNull()) {\n" << indent << "// An error happened in python code!\n" - << "Shiboken::Errors::storeErrorOrPrint();\n" + << "Shiboken::Errors::storePythonOverrideErrorOrPrint(\"" + << func->ownerClass()->name() << "\", funcName);\n" << returnStatement.statement << "\n" << outdent << "}\n"; @@ -1598,11 +1600,17 @@ static void writePointerToPythonConverter(TextStream &c, c << "auto *pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppIn));\n" << "if (pyOut) {\n" << indent << "Py_INCREF(pyOut);\nreturn pyOut;\n" << outdent - << "}\n" - << "auto *tCppIn = reinterpret_cast<const " << typeName << R"( *>(cppIn); -const char *typeName = )"; + << "}\n"; const QString nameFunc = metaClass->typeEntry()->polymorphicNameFunction(); + if (nameFunc.isEmpty() && !metaClass->hasVirtualDestructor()) { + c << "return Shiboken::Object::newObjectWithHeuristics(" + << cpythonType << ", const_cast<void *>(cppIn), false);\n"; + return; + } + + c << "auto *tCppIn = reinterpret_cast<const " << typeName << R"( *>(cppIn); +const char *typeName = )"; if (nameFunc.isEmpty()) c << "typeid(*tCppIn).name();\n"; else @@ -5098,6 +5106,17 @@ QList<PyMethodDefEntry> return result; } +QString CppGenerator::pythonSignature(const AbstractMetaType &type) const +{ + if (type.isSmartPointer() && !type.instantiations().isEmpty()) { + const auto ste = std::static_pointer_cast<const SmartPointerTypeEntry>(type.typeEntry()); + const auto instantiationTe = type.instantiations().constFirst().typeEntry(); + if (auto opt = api().findSmartPointerInstantiation(ste, instantiationTe)) + return opt->specialized->typeEntry()->qualifiedTargetLangName(); + } + return type.pythonSignature(); +} + // Format the type signature of a function parameter QString CppGenerator::signatureParameter(const AbstractMetaArgument &arg) const { @@ -5109,17 +5128,22 @@ QString CppGenerator::signatureParameter(const AbstractMetaArgument &arg) const metaType = *viewOn; s << arg.name() << ':'; - QStringList signatures(metaType.pythonSignature()); + QStringList signatures(pythonSignature(metaType)); // Implicit conversions (C++): Check for converting constructors // "QColor(Qt::GlobalColor)" or conversion operators const AbstractMetaFunctionCList conversions = api().implicitConversions(metaType); for (const auto &f : conversions) { - if (f->isConstructor() && !f->arguments().isEmpty()) - signatures << f->arguments().constFirst().type().pythonSignature(); - else if (f->isConversionOperator()) + if (f->isConstructor() && !f->arguments().isEmpty()) { + // PYSIDE-2712: modified types from converting constructors are not always correct + // candidates if they are modified by the type system reference + if (!f->arguments().constFirst().isTypeModified()) { + signatures << pythonSignature(f->arguments().constFirst().type()); + } + } else if (f->isConversionOperator()) { signatures << f->ownerClass()->fullName(); + } } const qsizetype size = signatures.size(); @@ -5176,7 +5200,7 @@ void CppGenerator::writeSignatureInfo(TextStream &s, const OverloadData &overloa QString returnType = f->pyiTypeReplaced(0); // pyi or modified type if (returnType.isEmpty() && !f->isVoid()) - returnType = f->type().pythonSignature(); + returnType = pythonSignature(f->type()); if (!returnType.isEmpty()) s << "->" << returnType; @@ -5595,6 +5619,9 @@ void CppGenerator::writeClassRegister(TextStream &s, writeConverterRegister(s, metaClass, classContext); s << '\n'; + if (classContext.forSmartPointer()) + writeSmartPointerConverterInitialization(s, classContext.preciseType()); + // class inject-code target/beginning if (!classTypeEntry->codeSnips().isEmpty()) { writeClassCodeSnips(s, classTypeEntry->codeSnips(), @@ -6030,16 +6057,20 @@ void CppGenerator::writeNbBoolFunction(const GeneratorContext &context, // Write declaration and invocation of the init function for the module init // function. -void CppGenerator::writeInitFunc(TextStream &declStr, TextStream &callStr, - const QString &initFunctionName, - const TypeEntryCPtr &enclosingEntry, - const QString &pythonName, bool lazy) +static void writeInitFuncDecl(TextStream &declStr, + const QString &functionName) { - const QString functionName = "init_"_L1 + initFunctionName; - const bool hasParent = enclosingEntry && enclosingEntry->type() != TypeEntry::TypeSystemType; - declStr << "PyTypeObject *" << functionName << "(PyObject *" - << (hasParent ? "enclosingClass" : "module") << ");\n"; + declStr << "PyTypeObject *" << functionName << "(PyObject *enclosing);\n"; +} +// Write declaration and invocation of the init function for the module init +// function. +void CppGenerator::writeInitFuncCall(TextStream &callStr, + const QString &functionName, + const TypeEntryCPtr &enclosingEntry, + const QString &pythonName, bool lazy) +{ + const bool hasParent = enclosingEntry && enclosingEntry->type() != TypeEntry::TypeSystemType; if (!lazy) { const QString enclosing = hasParent ? "reinterpret_cast<PyObject *>("_L1 + cpythonTypeNameExt(enclosingEntry) + u')' @@ -6048,18 +6079,14 @@ void CppGenerator::writeInitFunc(TextStream &declStr, TextStream &callStr, } else if (hasParent) { const QString &enclosingName = enclosingEntry->name(); const auto parts = QStringView{enclosingName}.split(u"::", Qt::SkipEmptyParts); + const QString namePathPrefix = enclosingEntry->name().replace("::"_L1, "."_L1); callStr << "Shiboken::Module::AddTypeCreationFunction(" - << "module, \"" << pythonName << "\", " << functionName << ", \""; - for (qsizetype i = 0; i < parts.size(); ++i) { - if (i > 0) - callStr << "\", \""; - callStr << parts.at(i); - } - callStr << "\");\n"; + << "module, \"" << parts[0] << "\", " + << functionName << ", \"" << namePathPrefix << '.' << pythonName << "\");\n"; } else { callStr << "Shiboken::Module::AddTypeCreationFunction(" << "module, \"" << pythonName << "\", " - << "init_" << initFunctionName << ");\n"; + << functionName << ");\n"; } } @@ -6116,9 +6143,10 @@ bool CppGenerator::finishGeneration() s_classInitDecl << te->configCondition() << '\n'; s_classPythonDefines << te->configCondition() << '\n'; } - writeInitFunc(s_classInitDecl, s_classPythonDefines, - getSimpleClassInitFunctionName(cls), - targetLangEnclosingEntry(te), cls->name()); + const QString initFunc = initFuncPrefix + getSimpleClassInitFunctionName(cls); + writeInitFuncDecl(s_classInitDecl, initFunc); + writeInitFuncCall(s_classPythonDefines, initFunc, + targetLangEnclosingEntry(te), cls->name()); if (cls->hasStaticFields()) { s_classInitDecl << "PyTypeObject *" << getSimpleClassStaticFieldsInitFunctionName(cls) << "(PyObject *module);\n"; @@ -6135,13 +6163,12 @@ bool CppGenerator::finishGeneration() for (const auto &smp : api().instantiatedSmartPointers()) { GeneratorContext context = contextForSmartPointer(smp.specialized, smp.type); const auto enclosingClass = context.metaClass()->enclosingClass(); - auto enclosingTypeEntry = enclosingClass - ? enclosingClass->typeEntry() - : targetLangEnclosingEntry(smp.type.typeEntry()); + auto enclosingTypeEntry = targetLangEnclosingEntry(smp.specialized->typeEntry()); - writeInitFunc(s_classInitDecl, s_classPythonDefines, - getInitFunctionName(context), - enclosingTypeEntry, smp.type.name()); + const QString initFunc = initFuncPrefix + getInitFunctionName(context); + writeInitFuncDecl(s_classInitDecl, initFunc); + writeInitFuncCall(s_classPythonDefines, + initFunc, enclosingTypeEntry, smp.specialized->name()); includes.insert(smp.type.instantiations().constFirst().typeEntry()->include()); } @@ -6335,18 +6362,6 @@ bool CppGenerator::finishGeneration() s << '\n'; } - // Implicit smart pointers conversions - const auto &smartPointersList = api().instantiatedSmartPointers(); - if (!smartPointersList.isEmpty()) { - s << "// SmartPointers converters.\n\n"; - for (const auto &smp : smartPointersList) { - s << "// C++ to Python conversion for smart pointer type '" - << smp.type.cppSignature() << "'.\n"; - writeSmartPointerConverterFunctions(s, smp.type); - } - s << '\n'; - } - s << "static struct PyModuleDef moduledef = {\n" << " /* m_base */ PyModuleDef_HEAD_INIT,\n" << " /* m_name */ \"" << moduleName() << "\",\n" @@ -6405,9 +6420,14 @@ bool CppGenerator::finishGeneration() s << "{nullptr, nullptr}\n" << outdent << "};\n" << "// The new global structure consisting of (type, name) pairs.\n" - << cppApiVariableName() << " = cppApi;\n" - << "// The backward compatible alias with upper case indexes.\n" - << cppApiVariableNameOld() << " = reinterpret_cast<PyTypeObject **>(cppApi);\n\n"; + << cppApiVariableName() << " = cppApi;\n"; + if (usePySideExtensions()) + s << "QT_WARNING_PUSH\nQT_WARNING_DISABLE_DEPRECATED\n"; + s << "// The backward compatible alias with upper case indexes.\n" + << cppApiVariableNameOld() << " = reinterpret_cast<PyTypeObject **>(cppApi);\n"; + if (usePySideExtensions()) + s << "QT_WARNING_POP\n"; + s << '\n'; } s << "// Create an array of primitive type converters for the current module.\n" @@ -6456,14 +6476,6 @@ bool CppGenerator::finishGeneration() s << '\n'; } - if (!smartPointersList.isEmpty()) { - s << '\n'; - for (const auto &smp : smartPointersList) { - writeSmartPointerConverterInitialization(s, smp.type); - s << '\n'; - } - } - if (!extendedConverters.isEmpty()) { s << '\n'; for (ExtendedConverterData::const_iterator it = extendedConverters.cbegin(), end = extendedConverters.cend(); it != end; ++it) { diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.h b/sources/shiboken6/generator/shiboken/cppgenerator.h index a31c2ca14..5920c9a3a 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.h +++ b/sources/shiboken6/generator/shiboken/cppgenerator.h @@ -60,10 +60,10 @@ private: void generateIncludes(TextStream &s, const GeneratorContext &classContext, const IncludeGroupList &includes = {}, const AbstractMetaClassCList &innerClasses = {}) const; - static void writeInitFunc(TextStream &declStr, TextStream &callStr, - const QString &initFunctionName, - const TypeEntryCPtr &enclosingEntry, - const QString &pythonName, bool lazy = true); + static void writeInitFuncCall(TextStream &callStr, + const QString &functionName, + const TypeEntryCPtr &enclosingEntry, + const QString &pythonName, bool lazy = true); static void writeCacheResetNative(TextStream &s, const GeneratorContext &classContext); void writeConstructorNative(TextStream &s, const GeneratorContext &classContext, const AbstractMetaFunctionCPtr &func) const; @@ -413,6 +413,7 @@ private: void writeSignatureInfo(TextStream &s, const OverloadData &overloads) const; QString signatureParameter(const AbstractMetaArgument &arg) const; + QString pythonSignature(const AbstractMetaType &type) const; /// Writes the implementation of all methods part of python sequence protocol void writeSequenceMethods(TextStream &s, const AbstractMetaClassCPtr &metaClass, @@ -550,9 +551,6 @@ private: static bool hasBoolCast(const AbstractMetaClassCPtr &metaClass) { return boolCast(metaClass).has_value(); } - std::optional<AbstractMetaType> - findSmartPointerInstantiation(const SmartPointerTypeEntryCPtr &pointer, - const TypeEntryCPtr &pointee) const; void clearTpFuncs(); static QString chopType(QString s); diff --git a/sources/shiboken6/generator/shiboken/cppgenerator_smartpointer.cpp b/sources/shiboken6/generator/shiboken/cppgenerator_smartpointer.cpp index 1b893640a..44b76f181 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator_smartpointer.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator_smartpointer.cpp @@ -86,18 +86,6 @@ static ComparisonOperatorList smartPointeeComparisons(const GeneratorContext &co return result; } -std::optional<AbstractMetaType> - CppGenerator::findSmartPointerInstantiation(const SmartPointerTypeEntryCPtr &pointer, - const TypeEntryCPtr &pointee) const -{ - for (const auto &smp : api().instantiatedSmartPointers()) { - const auto &i = smp.type; - if (i.typeEntry() == pointer && i.instantiations().at(0).typeEntry() == pointee) - return i; - } - return {}; -} - static bool hasParameterPredicate(const AbstractMetaFunctionCPtr &f) { return !f->arguments().isEmpty(); @@ -225,6 +213,8 @@ void CppGenerator::generateSmartPointerClass(TextStream &s, const GeneratorConte s << '\n'; writeConverterFunctions(s, metaClass, classContext); + // Implicit smart pointers conversions + writeSmartPointerConverterFunctions(s, classContext.preciseType()); writeClassRegister(s, metaClass, classContext, signatureStream); // class inject-code native/end @@ -252,8 +242,8 @@ void CppGenerator::writeSmartPointerConverterFunctions(TextStream &s, for (const auto &base : baseClasses) { auto baseTe = base->typeEntry(); if (smartPointerTypeEntry->matchesInstantiation(baseTe)) { - if (auto opt = findSmartPointerInstantiation(smartPointerTypeEntry, baseTe)) { - const auto smartTargetType = opt.value(); + if (auto opt = api().findSmartPointerInstantiation(smartPointerTypeEntry, baseTe)) { + const auto &smartTargetType = opt.value().type; s << "// SmartPointer derived class: " << smartTargetType.cppSignature() << "\n"; writePythonToCppConversionFunctions(s, smartPointerType, @@ -308,8 +298,8 @@ void CppGenerator::writeSmartPointerConverterInitialization(TextStream &s, for (const auto &base : classes) { auto baseTe = base->typeEntry(); - if (auto opt = findSmartPointerInstantiation(smartPointerTypeEntry, baseTe)) { - const auto smartTargetType = opt.value(); + if (auto opt = api().findSmartPointerInstantiation(smartPointerTypeEntry, baseTe)) { + const auto &smartTargetType = opt.value().type; s << "// Convert to SmartPointer derived class: [" << smartTargetType.cppSignature() << "]\n"; const QString converter = u"Shiboken::Conversions::getConverter(\""_s diff --git a/sources/shiboken6/generator/shiboken/headergenerator.cpp b/sources/shiboken6/generator/shiboken/headergenerator.cpp index 1f574b47c..7cec9c38e 100644 --- a/sources/shiboken6/generator/shiboken/headergenerator.cpp +++ b/sources/shiboken6/generator/shiboken/headergenerator.cpp @@ -198,9 +198,6 @@ void HeaderGenerator::writeWrapperClassDeclaration(TextStream &s, const auto typeEntry = metaClass->typeEntry(); InheritedOverloadSet inheritedOverloads; - // write license comment - s << licenseComment(); - // Class s << "class " << wrapperName << " : public " << metaClass->qualifiedCppName() @@ -706,8 +703,12 @@ bool HeaderGenerator::finishGeneration() macrosStream << ti; macrosStream << "};\n\n"; + // FIXME: Remove backwards compatible variable in PySide 7. macrosStream << "// This variable stores all Python types exported by this module.\n"; macrosStream << "extern Shiboken::Module::TypeInitStruct *" << cppApiVariableName() << ";\n\n"; + macrosStream << "// This variable stores all Python types exported by this module "; + macrosStream << "in a backwards compatible way with identical indexing.\n"; + macrosStream << "[[deprecated]] extern PyTypeObject **" << cppApiVariableNameOld() << ";\n\n"; macrosStream << "// This variable stores the Python module object exported by this module.\n"; macrosStream << "extern PyObject *" << pythonModuleObjectName() << ";\n\n"; macrosStream << "// This variable stores all type converters exported by this module.\n"; diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp index a1417e5d9..67fd9c994 100644 --- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp +++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp @@ -2555,7 +2555,8 @@ void ShibokenGenerator::collectFullTypeNamesArray(QStringList &typeNames) int smartPointerCountIndex = getMaxTypeIndex(); for (const auto &smp : api().instantiatedSmartPointers()) { auto entry = smp.type.typeEntry(); - typeNames[smartPointerCountIndex] = entry->qualifiedTargetLangName(); + typeNames[smartPointerCountIndex] = + smp.specialized->typeEntry()->qualifiedTargetLangName(); ++smartPointerCountIndex; } } diff --git a/sources/shiboken6/libshiboken/basewrapper.cpp b/sources/shiboken6/libshiboken/basewrapper.cpp index c11fbbfb2..8443af33d 100644 --- a/sources/shiboken6/libshiboken/basewrapper.cpp +++ b/sources/shiboken6/libshiboken/basewrapper.cpp @@ -7,13 +7,12 @@ #include "helper.h" #include "pep384ext.h" #include "sbkconverter.h" -#include "sbkenum.h" #include "sbkerrors.h" #include "sbkfeature_base.h" -#include "sbkmodule.h" #include "sbkstring.h" #include "sbkstaticstrings.h" #include "sbkstaticstrings_p.h" +#include "sbktypefactory.h" #include "autodecref.h" #include "gilstate.h" #include <string> @@ -27,7 +26,9 @@ #include "signature_p.h" #include "voidptr.h" +#include <string> #include <iostream> +#include <sstream> #if defined(__APPLE__) #include <dlfcn.h> @@ -48,7 +49,7 @@ bool walkThroughBases(PyTypeObject *currentType, Predicate predicate) const Py_ssize_t numBases = PyTuple_Size(bases); bool result = false; for (Py_ssize_t i = 0; !result && i < numBases; ++i) { - auto type = reinterpret_cast<PyTypeObject *>(PyTuple_GetItem(bases, i)); + auto *type = reinterpret_cast<PyTypeObject *>(PyTuple_GetItem(bases, i)); if (PyType_IsSubtype(type, SbkObject_TypeF()) != 0) { result = PepType_SOTP(type)->is_user_type ? walkThroughBases(type, predicate) : predicate(type); @@ -247,7 +248,7 @@ PyTypeObject *SbkObjectType_TypeF(void) static PyObject *SbkObjectGetDict(PyObject *pObj, void *) { - auto ret = SbkObject_GetDict_NoRef(pObj); + auto *ret = SbkObject_GetDict_NoRef(pObj); Py_XINCREF(ret); return ret; } @@ -262,17 +263,15 @@ static int SbkObject_tp_traverse(PyObject *self, visitproc visit, void *arg) auto *sbkSelf = reinterpret_cast<SbkObject *>(self); //Visit children - Shiboken::ParentInfo *pInfo = sbkSelf->d->parentInfo; - if (pInfo) { + if (auto *pInfo = sbkSelf->d->parentInfo) { for (SbkObject *c : pInfo->children) Py_VISIT(c); } //Visit refs - Shiboken::RefCountMap *rInfo = sbkSelf->d->referredObjects; - if (rInfo) { - for (auto it = rInfo->begin(), end = rInfo->end(); it != end; ++it) - Py_VISIT(it->second); + if (auto *rInfo = sbkSelf->d->referredObjects) { + for (const auto &p : *rInfo) + Py_VISIT(p.second); } if (sbkSelf->ob_dict) @@ -420,7 +419,9 @@ static void SbkDeallocWrapperCommon(PyObject *pyObj, bool canDelete) } } - PyObject *error_type, *error_value, *error_traceback; + PyObject *error_type{}; + PyObject *error_value{}; + PyObject *error_traceback{}; /* Save the current exception, if any. */ PyErr_Fetch(&error_type, &error_value, &error_traceback); @@ -535,7 +536,7 @@ PyObject *MakeQAppWrapper(PyTypeObject *type) static PyObject *qApp_last = nullptr; // protecting from multiple application instances - if (!(type == nullptr || qApp_last == Py_None)) { + if (type != nullptr && qApp_last != Py_None) { const char *res_name = qApp_last != nullptr ? PepType_GetNameStr(Py_TYPE(qApp_last)) : "<Unknown>"; const char *type_name = PepType_GetNameStr(type); @@ -573,9 +574,9 @@ static PyTypeObject *SbkObjectType_tp_new(PyTypeObject *metatype, PyObject *args // Before we changed to heap types, it was sufficient to remove the // Py_TPFLAGS_BASETYPE flag. That does not work, because PySide does // not respect this flag itself! - PyObject *name; - PyObject *pyBases; - PyObject *dict; + PyObject *name{}; + PyObject *pyBases{}; + PyObject *dict{}; static const char *kwlist[] = { "name", "bases", "dict", nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO!O!:sbktype", const_cast<char **>(kwlist), @@ -694,9 +695,8 @@ PyObject *SbkQApp_tp_new(PyTypeObject *subtype, PyObject *, PyObject *) auto *self = reinterpret_cast<SbkObject *>(obSelf); if (self == nullptr) return nullptr; - auto ret = _setupNew(obSelf, subtype); - auto priv = self->d; - priv->isQAppSingleton = 1; + auto *ret = _setupNew(obSelf, subtype); + self->d->isQAppSingleton = 1; return ret; } @@ -714,7 +714,7 @@ PyObject *FallbackRichCompare(PyObject *self, PyObject *other, int op) { // This is a very simple implementation that supplies a simple identity. static const char * const opstrings[] = {"<", "<=", "==", "!=", ">", ">="}; - PyObject *res; + PyObject *res{}; switch (op) { @@ -771,6 +771,19 @@ namespace Shiboken void _initMainThreadId(); // helper.cpp +static std::string msgFailedToInitializeType(const char *description) +{ + std::ostringstream stream; + stream << "[libshiboken] Failed to initialize " << description; + if (auto *error = PepErr_GetRaisedException()) { + if (auto *str = PyObject_Str(error)) + stream << ": " << Shiboken::String::toCString(str); + Py_DECREF(error); + } + stream << '.'; + return stream.str(); +} + namespace Conversions { void init(); } void init() @@ -786,11 +799,13 @@ void init() //Init private data Pep384_Init(); - if (PyType_Ready(SbkObjectType_TypeF()) < 0) - Py_FatalError("[libshiboken] Failed to initialize Shiboken.BaseWrapperType metatype."); + auto *type = SbkObjectType_TypeF(); + if (type == nullptr || PyType_Ready(type) < 0) + Py_FatalError(msgFailedToInitializeType("Shiboken.BaseWrapperType metatype").c_str()); - if (PyType_Ready(SbkObject_TypeF()) < 0) - Py_FatalError("[libshiboken] Failed to initialize Shiboken.BaseWrapper type."); + type = SbkObject_TypeF(); + if (type == nullptr || PyType_Ready(type) < 0) + Py_FatalError(msgFailedToInitializeType("Shiboken.BaseWrapper type").c_str()); VoidPtr::init(); @@ -980,13 +995,12 @@ introduceWrapperType(PyObject *enclosingObject, PyObject *bases, unsigned wrapperFlags) { - const auto basesSize = PySequence_Fast_GET_SIZE(bases); - assert(basesSize > 0); + assert(PySequence_Fast_GET_SIZE(bases) > 0); typeSpec->slots[0].pfunc = PySequence_Fast_GET_ITEM(bases, 0); auto *type = SbkType_FromSpecBasesMeta(typeSpec, bases, SbkObjectType_TypeF()); - auto sotp = PepType_SOTP(type); + auto *sotp = PepType_SOTP(type); if (wrapperFlags & DeleteInMainThread) sotp->delete_in_main_thread = 1; sotp->type_behaviour = (wrapperFlags & Value) != 0 @@ -1154,7 +1168,7 @@ bool wasCreatedByPython(SbkObject *pyObj) void callCppDestructors(SbkObject *pyObj) { - auto priv = pyObj->d; + auto *priv = pyObj->d; if (priv->isQAppSingleton && DestroyQApplication) { // PYSIDE-1470: Allow to destroy the application from Shiboken. DestroyQApplication(); @@ -1288,10 +1302,9 @@ static void recursive_invalidate(SbkObject *self, std::set<SbkObject *> &seen) } // If has ref to other objects invalidate all - if (self->d->referredObjects) { - RefCountMap &refCountMap = *(self->d->referredObjects); - for (auto it = refCountMap.begin(), end = refCountMap.end(); it != end; ++it) - recursive_invalidate(it->second, seen); + if (auto *rInfo = self->d->referredObjects) { + for (const auto &p : *rInfo) + recursive_invalidate(p.second, seen); } } @@ -1466,7 +1479,8 @@ static PyObject *newObjectWithHeuristicsHelper(PyTypeObject *instanceType, // Try type discovery in these cases. if (exactType == nullptr || exactType == instanceType) { auto resolved = BindingManager::instance().findDerivedType(cptr, instanceType); - if (resolved.first != nullptr) { + if (resolved.first != nullptr + && Shiboken::ObjectType::canDowncastTo(instanceType, resolved.first)) { exactType = resolved.first; cptr = resolved.second; } diff --git a/sources/shiboken6/libshiboken/basewrapper.h b/sources/shiboken6/libshiboken/basewrapper.h index ec5545aea..5e77d0c4f 100644 --- a/sources/shiboken6/libshiboken/basewrapper.h +++ b/sources/shiboken6/libshiboken/basewrapper.h @@ -6,7 +6,6 @@ #include "sbkpython.h" #include "shibokenmacros.h" -#include "sbktypefactory.h" #include <vector> #include <string> diff --git a/sources/shiboken6/libshiboken/bindingmanager.cpp b/sources/shiboken6/libshiboken/bindingmanager.cpp index 83c927ae5..df1079af8 100644 --- a/sources/shiboken6/libshiboken/bindingmanager.cpp +++ b/sources/shiboken6/libshiboken/bindingmanager.cpp @@ -230,10 +230,9 @@ void BindingManager::BindingManagerPrivate::assignWrapper(SbkObject *wrapper, co } } -BindingManager::BindingManager() +BindingManager::BindingManager() : + m_d(new BindingManager::BindingManagerPrivate) { - m_d = new BindingManager::BindingManagerPrivate; - #ifdef SHIBOKEN_INSTALL_FREE_DEBUG_HOOK debugInstallFreeHook(); #endif @@ -504,10 +503,11 @@ bool callInheritedInit(PyObject *self, PyObject *args, PyObject *kwds, auto *startType = Py_TYPE(self); auto *mro = startType->tp_mro; - Py_ssize_t idx, n = PyTuple_GET_SIZE(mro); + Py_ssize_t idx = 0; + const Py_ssize_t n = PyTuple_GET_SIZE(mro); auto classNameLen = std::strrchr(fullName, '.') - fullName; /* No need to check the last one: it's gonna be skipped anyway. */ - for (idx = 0; idx + 1 < n; ++idx) { + for ( ; idx + 1 < n; ++idx) { auto *lookType = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(mro, idx)); const char *lookName = lookType->tp_name; auto lookLen = long(std::strlen(lookName)); diff --git a/sources/shiboken6/libshiboken/embed/embedding_generator.py b/sources/shiboken6/libshiboken/embed/embedding_generator.py index a058fd372..51c46ce54 100644 --- a/sources/shiboken6/libshiboken/embed/embedding_generator.py +++ b/sources/shiboken6/libshiboken/embed/embedding_generator.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ embedding_generator.py diff --git a/sources/shiboken6/libshiboken/embed/module_collector.py b/sources/shiboken6/libshiboken/embed/module_collector.py index a58ce6e4f..8f7be6437 100644 --- a/sources/shiboken6/libshiboken/embed/module_collector.py +++ b/sources/shiboken6/libshiboken/embed/module_collector.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ module_collector.py diff --git a/sources/shiboken6/libshiboken/embed/signature_bootstrap.py b/sources/shiboken6/libshiboken/embed/signature_bootstrap.py index 37f95cd35..b0ba77107 100644 --- a/sources/shiboken6/libshiboken/embed/signature_bootstrap.py +++ b/sources/shiboken6/libshiboken/embed/signature_bootstrap.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ signature_bootstrap.py diff --git a/sources/shiboken6/libshiboken/pep384impl.cpp b/sources/shiboken6/libshiboken/pep384impl.cpp index f926107e2..f51296851 100644 --- a/sources/shiboken6/libshiboken/pep384impl.cpp +++ b/sources/shiboken6/libshiboken/pep384impl.cpp @@ -105,13 +105,13 @@ static PyType_Spec typeprobe_spec = { static void check_PyTypeObject_valid() { - auto *obtype = reinterpret_cast<PyObject *>(&PyType_Type); - auto *probe_tp_base = reinterpret_cast<PyTypeObject *>( - PyObject_GetAttr(obtype, Shiboken::PyMagicName::base())); + auto *typetype = &PyType_Type; + auto *obtype = reinterpret_cast<PyObject *>(typetype); + auto *probe_tp_base_obj = PyObject_GetAttr(obtype, Shiboken::PyMagicName::base()); + auto *probe_tp_base = reinterpret_cast<PyTypeObject *>(probe_tp_base_obj); auto *probe_tp_bases = PyObject_GetAttr(obtype, Shiboken::PyMagicName::bases()); - auto *check = reinterpret_cast<PyTypeObject *>( - PyType_FromSpecWithBases(&typeprobe_spec, probe_tp_bases)); - auto *typetype = reinterpret_cast<PyTypeObject *>(obtype); + auto *checkObj = PyType_FromSpecWithBases(&typeprobe_spec, probe_tp_bases); + auto *check = reinterpret_cast<PyTypeObject *>(checkObj); PyObject *w = PyObject_GetAttr(obtype, Shiboken::PyMagicName::weakrefoffset()); long probe_tp_weakrefoffset = PyLong_AsLong(w); PyObject *d = PyObject_GetAttr(obtype, Shiboken::PyMagicName::dictoffset()); @@ -149,8 +149,8 @@ check_PyTypeObject_valid() || probe_tp_mro != typetype->tp_mro || Py_TPFLAGS_DEFAULT != (check->tp_flags & Py_TPFLAGS_DEFAULT)) Py_FatalError("The structure of type objects has changed!"); - Py_DECREF(check); - Py_DECREF(probe_tp_base); + Py_DECREF(checkObj); + Py_DECREF(probe_tp_base_obj); Py_DECREF(w); Py_DECREF(d); Py_DECREF(probe_tp_bases); @@ -482,6 +482,47 @@ Pep_GetVerboseFlag() } #endif // Py_LIMITED_API +// Support for pyerrors.h + +#if defined(Py_LIMITED_API) || PY_VERSION_HEX < 0x030C0000 +// Emulate PyErr_GetRaisedException() using the deprecated PyErr_Fetch()/PyErr_Store() +PyObject *PepErr_GetRaisedException() +{ + PyObject *type{}; + PyObject *value{}; + PyObject *traceback{}; + PyErr_Fetch(&type, &value, &traceback); + Py_XINCREF(value); + PyErr_Restore(type, value, traceback); + return value; +} + +struct PepException_HEAD +{ + PyObject_HEAD + PyObject *x1; // dict + PyObject *args; +}; + +// PyException_GetArgs/PyException_SetArgs were added to the stable API in 3.12 +PyObject *PepException_GetArgs(PyObject *ex) +{ + auto *h = reinterpret_cast<PepException_HEAD *>(ex); + Py_XINCREF(h->args); + return h->args; +} + +LIBSHIBOKEN_API void PepException_SetArgs(PyObject *ex, PyObject *args) +{ + auto *h = reinterpret_cast<PepException_HEAD *>(ex); + Py_XINCREF(args); + auto *old = h->args; // Py_XSETREF() + h->args = args; + Py_XDECREF(old); + +} +#endif // Limited or < 3.12 + /***************************************************************************** * * Support for code.h @@ -722,11 +763,8 @@ PyTypeObject *PepStaticMethod_TypePtr = nullptr; static PyTypeObject * getStaticMethodType(void) { - // this works for Python 3, only - // "StaticMethodType = type(str.__dict__['maketrans'])\n"; static const char prog[] = - "from xxsubtype import spamlist\n" - "result = type(spamlist.__dict__['staticmeth'])\n"; + "result = type(str.__dict__['maketrans'])\n"; return reinterpret_cast<PyTypeObject *>(PepRun_GetResult(prog)); } @@ -858,15 +896,13 @@ PepRun_GetResult(const char *command) /* * Evaluate a string and return the variable `result` */ - PyObject *d, *v, *res; - - d = PyDict_New(); + PyObject *d = PyDict_New(); if (d == nullptr || PyDict_SetItem(d, Shiboken::PyMagicName::builtins(), PyEval_GetBuiltins()) < 0) { return nullptr; } - v = PyRun_String(command, Py_file_input, d, d); - res = v ? PyDict_GetItem(d, Shiboken::PyName::result()) : nullptr; + PyObject *v = PyRun_String(command, Py_file_input, d, d); + PyObject *res = v ? PyDict_GetItem(d, Shiboken::PyName::result()) : nullptr; Py_XDECREF(v); Py_DECREF(d); return res; @@ -874,7 +910,7 @@ PepRun_GetResult(const char *command) PyTypeObject *PepType_Type_tp_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds) { - auto ret = PyType_Type.tp_new(metatype, args, kwds); + auto *ret = PyType_Type.tp_new(metatype, args, kwds); return reinterpret_cast<PyTypeObject *>(ret); } @@ -903,7 +939,7 @@ _Pep_PrivateMangle(PyObject *self, PyObject *name) Py_INCREF(name); return name; } - size_t nlen = PyUnicode_GET_LENGTH(name); + const Py_ssize_t nlen = PyUnicode_GET_LENGTH(name); /* Don't mangle __id__ or names with dots. */ if ((PyUnicode_READ_CHAR(name, nlen-1) == '_' && PyUnicode_READ_CHAR(name, nlen-2) == '_') || @@ -917,9 +953,9 @@ _Pep_PrivateMangle(PyObject *self, PyObject *name) // PYSIDE-1436: _Py_Mangle is no longer exposed; implement it always. // The rest of this function is our own implementation of _Py_Mangle. // Please compare the original function in compile.c . - size_t plen = PyUnicode_GET_LENGTH(privateobj.object()); + Py_ssize_t plen = PyUnicode_GET_LENGTH(privateobj.object()); /* Strip leading underscores from class name */ - size_t ipriv = 0; + Py_ssize_t ipriv = 0; while (PyUnicode_READ_CHAR(privateobj.object(), ipriv) == '_') ipriv++; if (ipriv == plen) { @@ -933,8 +969,8 @@ _Pep_PrivateMangle(PyObject *self, PyObject *name) "private identifier too large to be mangled"); return nullptr; } - size_t const amount = ipriv + 1 + plen + nlen; - size_t const big_stack = 1000; + const Py_ssize_t amount = ipriv + 1 + plen + nlen; + const Py_ssize_t big_stack = 1000; wchar_t bigbuf[big_stack]; wchar_t *resbuf = amount <= big_stack ? bigbuf : (wchar_t *)malloc(sizeof(wchar_t) * amount); if (!resbuf) diff --git a/sources/shiboken6/libshiboken/pep384impl.h b/sources/shiboken6/libshiboken/pep384impl.h index ec58aac81..7188366e2 100644 --- a/sources/shiboken6/libshiboken/pep384impl.h +++ b/sources/shiboken6/libshiboken/pep384impl.h @@ -188,6 +188,17 @@ LIBSHIBOKEN_API int Pep_GetFlag(const char *name); LIBSHIBOKEN_API int Pep_GetVerboseFlag(void); #endif +// pyerrors.h +#if defined(Py_LIMITED_API) || PY_VERSION_HEX < 0x030C0000 +LIBSHIBOKEN_API PyObject *PepErr_GetRaisedException(); +LIBSHIBOKEN_API PyObject *PepException_GetArgs(PyObject *ex); +LIBSHIBOKEN_API void PepException_SetArgs(PyObject *ex, PyObject *args); +#else +# define PepErr_GetRaisedException PyErr_GetRaisedException +# define PepException_GetArgs PyException_GetArgs +# define PepException_SetArgs PyException_SetArgs +#endif + /***************************************************************************** * * RESOLVED: unicodeobject.h diff --git a/sources/shiboken6/libshiboken/sbkarrayconverter.h b/sources/shiboken6/libshiboken/sbkarrayconverter.h index f07cb1d70..dcb9bfb38 100644 --- a/sources/shiboken6/libshiboken/sbkarrayconverter.h +++ b/sources/shiboken6/libshiboken/sbkarrayconverter.h @@ -70,7 +70,7 @@ template <class T, int columns> class Array2Handle { public: - typedef T RowType[columns]; + using RowType = T[columns]; Array2Handle() = default; diff --git a/sources/shiboken6/libshiboken/sbkconverter.cpp b/sources/shiboken6/libshiboken/sbkconverter.cpp index 358827aa8..dac3fb638 100644 --- a/sources/shiboken6/libshiboken/sbkconverter.cpp +++ b/sources/shiboken6/libshiboken/sbkconverter.cpp @@ -12,7 +12,12 @@ #include "voidptr.h" #include <string> +#include <cstring> +#include <iostream> #include <unordered_map> +#include <unordered_set> +#include <map> +#include <set> static SbkConverter **PrimitiveTypeConverters; @@ -72,13 +77,110 @@ void init() initArrayConverters(); } +static void dumpPyTypeObject(std::ostream &str, PyTypeObject *t) +{ + str << "\nPython type "; + if (t == nullptr) { + str << "<None>"; + return; + } + str << '"' << t->tp_name << '"'; + if (t->tp_base != nullptr && t->tp_base != &PyBaseObject_Type) + str << '(' << t->tp_base->tp_name << ')'; +} + +static void dumpSbkConverter(std::ostream &str, const SbkConverter *c) +{ + str << "SbkConverter " << static_cast<const void *>(c) << ": "; + if (c->pointerToPython != nullptr) + str << ", C++ pointer->Python"; + if (c->copyToPython != nullptr) + str << ", copy->Python"; + if (c->toCppPointerConversion.second != nullptr) + str << ", Python->C++ pointer"; + if (!c->toCppConversions.empty()) + str << ", " << c->toCppConversions.size() << " Python->C++ conversions"; +} + +// Less than operator for a PyTypeObject for dumping the converter map +static bool pyTypeObjectLessThan(const PyTypeObject *t1, const PyTypeObject *t2) +{ + const bool isNull1 = t1 == nullptr; + const bool isNull2 = t2 == nullptr; + if (isNull1 || isNull2) + return isNull1 && !isNull2; + // Internal types (lower case) first + const bool isInternal1 = std::islower(t1->tp_name[0]); + const bool isInternal2 = std::islower(t2->tp_name[0]); + if (isInternal1 != isInternal2) + return !isInternal2; + return std::strcmp(t1->tp_name, t2->tp_name) < 0; +} + +void dumpConverters() +{ + struct PyTypeObjectLess { + + bool operator()(const PyTypeObject *t1, const PyTypeObject *t2) const { + return pyTypeObjectLessThan(t1, t2); + } + }; + + using StringSet = std::set<std::string>; + using SbkConverterNamesMap = std::unordered_map<SbkConverter *, StringSet>; + using PyTypeObjectConverterMap = std::map<PyTypeObject *, SbkConverterNamesMap, + PyTypeObjectLess>; + + auto &str = std::cerr; + + // Sort the entries by the associated PyTypeObjects and converters + PyTypeObjectConverterMap pyTypeObjectConverterMap; + for (const auto &converter : converters) { + auto *sbkConverter = converter.second; + if (sbkConverter == nullptr) { + str << "Non-existent: \"" << converter.first << "\"\n"; + continue; + } + auto *typeObject = sbkConverter->pythonType; + auto typeIt = pyTypeObjectConverterMap.find(typeObject); + if (typeIt == pyTypeObjectConverterMap.end()) + typeIt = pyTypeObjectConverterMap.insert(std::make_pair(typeObject, + SbkConverterNamesMap{})).first; + SbkConverterNamesMap &sbkConverterMap = typeIt->second; + auto convIt = sbkConverterMap.find(sbkConverter); + if (convIt == sbkConverterMap.end()) + convIt = sbkConverterMap.insert(std::make_pair(sbkConverter, + StringSet{})).first; + convIt->second.insert(converter.first); + } + + for (const auto &tc : pyTypeObjectConverterMap) { + dumpPyTypeObject(str, tc.first); + str << ", " << tc.second.size() << " converter(s):\n"; + for (const auto &cn : tc.second) { + str << " "; + dumpSbkConverter(str, cn.first); + str << ", " << cn.second.size() << " alias(es):"; + int i = 0; + for (const auto &name : cn.second) { + if ((i++ % 5) == 0) + str << "\n "; + str << " \"" << name << '"'; + } + str << '\n'; + } + } + + str << '\n'; +} + SbkConverter *createConverterObject(PyTypeObject *type, PythonToCppFunc toCppPointerConvFunc, IsConvertibleToCppFunc toCppPointerCheckFunc, CppToPythonFunc pointerToPythonFunc, CppToPythonFunc copyToPythonFunc) { - auto converter = new SbkConverter; + auto *converter = new SbkConverter; converter->pythonType = type; // PYSIDE-595: All types are heaptypes now, so provide reference. Py_XINCREF(type); @@ -422,18 +524,36 @@ void registerConverterName(SbkConverter *converter, const char *typeName) converters.insert(std::make_pair(typeName, converter)); } -static std::string getRealTypeName(const char *name) +static std::string getRealTypeName(const std::string &typeName) { - std::string typeName(name); auto size = typeName.size(); if (std::isalnum(typeName[size - 1]) == 0) return typeName.substr(0, size - 1); return typeName; } -SbkConverter *getConverter(const char *typeName) +// PYSIDE-2404: Build a negative cache of already failed lookups. +// The resulting list must be reset after each new import, +// because that can change results. Also clear the cache after +// reaching some threashold. +static std::unordered_set<std::string> nonExistingTypeNames{}; + +// Arbitrary size limit to prevent random name overflows. +static constexpr std::size_t negativeCacheLimit = 50; + +static void rememberAsNonexistent(const std::string &typeName) +{ + if (nonExistingTypeNames.size() > negativeCacheLimit) + clearNegativeLazyCache(); + converters.insert(std::make_pair(typeName, nullptr)); + nonExistingTypeNames.insert(typeName); +} + +SbkConverter *getConverter(const char *typeNameC) { + std::string typeName = typeNameC; auto it = converters.find(typeName); + // PYSIDE-2404: This can also contain explicit nullptr as a negative cache. if (it != converters.end()) return it->second; // PYSIDE-2404: Did not find the name. Load the lazy classes @@ -442,6 +562,9 @@ SbkConverter *getConverter(const char *typeName) it = converters.find(typeName); if (it != converters.end()) return it->second; + // Cache the negative result. Don't forget to clear the cache for new modules. + rememberAsNonexistent(typeName); + if (Shiboken::pyVerbose() > 0) { const std::string message = std::string("Can't find type resolver for type '") + typeName + "'."; @@ -450,6 +573,15 @@ SbkConverter *getConverter(const char *typeName) return nullptr; } +void clearNegativeLazyCache() +{ + for (const auto &typeName : nonExistingTypeNames) { + auto it = converters.find(typeName); + converters.erase(it); + } + nonExistingTypeNames.clear(); +} + SbkConverter *primitiveTypeConverter(int index) { return PrimitiveTypeConverters[index]; @@ -704,14 +836,7 @@ PyTypeObject *getPythonTypeObject(const SbkConverter *converter) PyTypeObject *getPythonTypeObject(const char *typeName) { - auto *type = getPythonTypeObject(getConverter(typeName)); - if (type == nullptr) { - // PYSIDE-2404: Did not find the name. Load the lazy classes - // which have this name and try again. - Shiboken::Module::loadLazyClassesWithName(getRealTypeName(typeName).c_str()); - type = getPythonTypeObject(getConverter(typeName)); - } - return type; + return getPythonTypeObject(getConverter(typeName)); } bool pythonTypeIsValueType(const SbkConverter *converter) diff --git a/sources/shiboken6/libshiboken/sbkconverter.h b/sources/shiboken6/libshiboken/sbkconverter.h index 0d68f3faf..2b3d50069 100644 --- a/sources/shiboken6/libshiboken/sbkconverter.h +++ b/sources/shiboken6/libshiboken/sbkconverter.h @@ -339,27 +339,29 @@ LIBSHIBOKEN_API bool pythonTypeIsObjectType(const SbkConverter *converter); /// Returns true if the Python type associated with the converter is a wrapper type. LIBSHIBOKEN_API bool pythonTypeIsWrapperType(const SbkConverter *converter); -#define SBK_PY_LONG_LONG_IDX 0 +enum : int { +SBK_PY_LONG_LONG_IDX = 0, // Qt5: name collision in QtCore after QBool is replaced by bool -#define SBK_BOOL_IDX_1 1 -#define SBK_CHAR_IDX 2 -#define SBK_CONSTCHARPTR_IDX 3 -#define SBK_DOUBLE_IDX 4 -#define SBK_FLOAT_IDX 5 -#define SBK_INT_IDX 6 -#define SBK_SIGNEDINT_IDX 6 -#define SBK_LONG_IDX 7 -#define SBK_SHORT_IDX 8 -#define SBK_SIGNEDCHAR_IDX 9 -#define SBK_STD_STRING_IDX 10 -#define SBK_STD_WSTRING_IDX 11 -#define SBK_UNSIGNEDPY_LONG_LONG_IDX 12 -#define SBK_UNSIGNEDCHAR_IDX 13 -#define SBK_UNSIGNEDINT_IDX 14 -#define SBK_UNSIGNEDLONG_IDX 15 -#define SBK_UNSIGNEDSHORT_IDX 16 -#define SBK_VOIDPTR_IDX 17 -#define SBK_NULLPTR_T_IDX 18 +SBK_BOOL_IDX_1 = 1, +SBK_CHAR_IDX = 2, +SBK_CONSTCHARPTR_IDX = 3, +SBK_DOUBLE_IDX = 4, +SBK_FLOAT_IDX = 5, +SBK_INT_IDX = 6, +SBK_SIGNEDINT_IDX = 6, +SBK_LONG_IDX = 7, +SBK_SHORT_IDX = 8, +SBK_SIGNEDCHAR_IDX = 9, +SBK_STD_STRING_IDX = 10, +SBK_STD_WSTRING_IDX = 11, +SBK_UNSIGNEDPY_LONG_LONG_IDX = 12, +SBK_UNSIGNEDCHAR_IDX = 13, +SBK_UNSIGNEDINT_IDX = 14, +SBK_UNSIGNEDLONG_IDX = 15, +SBK_UNSIGNEDSHORT_IDX = 16, +SBK_VOIDPTR_IDX = 17, +SBK_NULLPTR_T_IDX = 18 +}; template<typename T> SbkConverter *PrimitiveTypeConverter() { return nullptr; } template<> inline SbkConverter *PrimitiveTypeConverter<PY_LONG_LONG>() { return primitiveTypeConverter(SBK_PY_LONG_LONG_IDX); } diff --git a/sources/shiboken6/libshiboken/sbkconverter_p.h b/sources/shiboken6/libshiboken/sbkconverter_p.h index c886c9b9f..08fc4c8e1 100644 --- a/sources/shiboken6/libshiboken/sbkconverter_p.h +++ b/sources/shiboken6/libshiboken/sbkconverter_p.h @@ -531,6 +531,12 @@ SbkConverter *createConverterObject(PyTypeObject *type, IsConvertibleToCppFunc toCppPointerCheckFunc, CppToPythonFunc pointerToPythonFunc, CppToPythonFunc copyToPythonFunc); + +LIBSHIBOKEN_API void dumpConverters(); + +/// Interface for sbkmodule which must reset cache when new module is loaded. +LIBSHIBOKEN_API void clearNegativeLazyCache(); + } // namespace Shiboken::Conversions #endif // SBK_CONVERTER_P_H diff --git a/sources/shiboken6/libshiboken/sbkcpptonumpy.cpp b/sources/shiboken6/libshiboken/sbkcpptonumpy.cpp index 44e900f01..7637efa70 100644 --- a/sources/shiboken6/libshiboken/sbkcpptonumpy.cpp +++ b/sources/shiboken6/libshiboken/sbkcpptonumpy.cpp @@ -49,17 +49,17 @@ PyObject *createByteArray1(Py_ssize_t, const uint8_t *) PyObject *createDoubleArray1(Py_ssize_t, const double *) { - return Py_None; + Py_RETURN_NONE; } PyObject *createFloatArray1(Py_ssize_t, const float *) { - return Py_None; + Py_RETURN_NONE; } PyObject *createIntArray1(Py_ssize_t, const int *) { - return Py_None; + Py_RETURN_NONE; } #endif // !HAVE_NUMPY diff --git a/sources/shiboken6/libshiboken/sbkenum.cpp b/sources/shiboken6/libshiboken/sbkenum.cpp index d39369979..d43756249 100644 --- a/sources/shiboken6/libshiboken/sbkenum.cpp +++ b/sources/shiboken6/libshiboken/sbkenum.cpp @@ -3,13 +3,13 @@ #include "sbkenum.h" #include "sbkstring.h" +#include "helper.h" #include "sbkstaticstrings.h" #include "sbkstaticstrings_p.h" #include "sbkconverter.h" #include "basewrapper.h" #include "autodecref.h" -#include "sbkpython.h" -#include "signature.h" +#include "sbktypefactory.h" #include <cstring> #include <vector> @@ -142,7 +142,8 @@ static PyObject *missing_func(PyObject * /* self */ , PyObject *args) static auto *const _mro = Shiboken::String::createStaticString("__mro__"); static auto *const _class = Shiboken::String::createStaticString("__class__"); - PyObject *klass{}, *value{}; + PyObject *klass{}; + PyObject *value{}; if (!PyArg_UnpackTuple(args, "missing", 2, 2, &klass, &value)) Py_RETURN_NONE; if (!PyLong_Check(value)) @@ -306,6 +307,8 @@ static PyTypeObject *createEnumForPython(PyObject *scopeOrModule, enumName = PyDict_GetItem(sotp->enumTypeDict, name); } + SBK_UNUSED(getPyEnumMeta()); // enforce PyEnumModule creation + assert(PyEnumModule != nullptr); AutoDecRef PyEnumType(PyObject_GetAttr(PyEnumModule, enumName)); assert(PyEnumType.object()); bool isFlag = PyObject_IsSubclass(PyEnumType, PyFlag); diff --git a/sources/shiboken6/libshiboken/sbkerrors.cpp b/sources/shiboken6/libshiboken/sbkerrors.cpp index 1832624d5..84c080f8d 100644 --- a/sources/shiboken6/libshiboken/sbkerrors.cpp +++ b/sources/shiboken6/libshiboken/sbkerrors.cpp @@ -6,6 +6,11 @@ #include "helper.h" #include "gilstate.h" +#include <cstdio> +#include <string> + +using namespace std::literals::string_literals; + namespace Shiboken { @@ -93,6 +98,21 @@ void setWrongContainerType() PyErr_SetString(PyExc_TypeError, "Wrong type passed to container conversion."); } +// Prepend something to an exception message provided it is a single string +// argument. +static bool prependToExceptionMessage(PyObject *exc, const char *context) +{ + Shiboken::AutoDecRef args(PepException_GetArgs(exc)); + if (args.isNull() || PyTuple_Check(args.object()) == 0 || PyTuple_Size(args) != 1) + return false; + auto *oldMessage = PyTuple_GetItem(args, 0); + if (oldMessage == nullptr || PyUnicode_CheckExact(oldMessage) == 0) + return false; + auto *newMessage = PyUnicode_FromFormat("%s%U", context, oldMessage); + PepException_SetArgs(exc, PyTuple_Pack(1, newMessage)); + return true; +} + struct ErrorStore { PyObject *type; PyObject *exc; @@ -101,17 +121,42 @@ struct ErrorStore { static thread_local ErrorStore savedError{}; +static bool hasPythonContext() +{ + return _pythonContextStack & 1; +} + void storeErrorOrPrint() { // This error happened in a function with no way to return an error state. // Therefore, we handle the error when we are error checking, anyway. // But we do that only when we know that an error handler can pick it up. - if (_pythonContextStack & 1) + if (hasPythonContext()) PyErr_Fetch(&savedError.type, &savedError.exc, &savedError.traceback); else PyErr_Print(); } +// Like storeErrorOrPrint() with additional context info that is prepended +// to the exception message or printed. +static void storeErrorOrPrintWithContext(const char *context) +{ + if (hasPythonContext()) { + PyErr_Fetch(&savedError.type, &savedError.exc, &savedError.traceback); + prependToExceptionMessage(savedError.exc, context); + } else { + std::fputs(context, stderr); + PyErr_Print(); + } +} + +void storePythonOverrideErrorOrPrint(const char *className, const char *funcName) +{ + const std::string context = "Error calling Python override of "s + + className + "::"s + funcName + "(): "s; + storeErrorOrPrintWithContext(context.c_str()); +} + PyObject *occurred() { if (savedError.type) { diff --git a/sources/shiboken6/libshiboken/sbkerrors.h b/sources/shiboken6/libshiboken/sbkerrors.h index 6ff85f8e1..18ce701e7 100644 --- a/sources/shiboken6/libshiboken/sbkerrors.h +++ b/sources/shiboken6/libshiboken/sbkerrors.h @@ -50,6 +50,11 @@ LIBSHIBOKEN_API void setWrongContainerType(); /// This replaces `PyErr_Print`, which cannot report errors as exception. /// To be used in contexts where raising errors is impossible. LIBSHIBOKEN_API void storeErrorOrPrint(); + +/// Call storeErrorOrPrint() and print the context to report +/// errors when calling Python overrides of virtual functions. +LIBSHIBOKEN_API void storePythonOverrideErrorOrPrint(const char *className, const char *funcName); + /// Handle an error as in PyErr_Occurred(), but also check for errors which /// were captured by `storeErrorOrPrint`. /// To be used in normal error checks. diff --git a/sources/shiboken6/libshiboken/sbkfeature_base.cpp b/sources/shiboken6/libshiboken/sbkfeature_base.cpp index f31b8f4f7..971835c53 100644 --- a/sources/shiboken6/libshiboken/sbkfeature_base.cpp +++ b/sources/shiboken6/libshiboken/sbkfeature_base.cpp @@ -92,8 +92,12 @@ void disassembleFrame(const char *marker) PyErr_Restore(error_type, error_value, error_traceback); } -// python 3.12 -static int const CALL = 171; +// Python 3.13 +static int const LOAD_ATTR_313 = 82; +static int const CALL_313 = 53; +static int const PUSH_NULL_313 = 34; +// Python 3.12 +static int const CALL_312 = 171; // Python 3.11 static int const PRECALL = 166; // we have "big instructions" with gaps after them @@ -105,13 +109,16 @@ static int const LOAD_METHOD = 160; static int const CALL_METHOD = 161; // Python 3.6 static int const CALL_FUNCTION = 131; -static int const LOAD_ATTR = 106; +static int const LOAD_ATTR_312 = 106; // NoGil (how long will this exist in this form?) static int const LOAD_METHOD_NOGIL = 55; static int const CALL_METHOD_NOGIL = 72; static bool currentOpcode_Is_CallMethNoArgs() { + static auto number = _PepRuntimeVersion(); + static int LOAD_ATTR = number < 0x030D00 ? LOAD_ATTR_312 : LOAD_ATTR_313; + static int CALL = number < 0x030D00 ? CALL_312 : CALL_313; // PYSIDE-2221: Special case for the NoGil version: // Find out if we have such a version. // We could also ask the variable `Py_NOGIL`. @@ -148,7 +155,6 @@ static bool currentOpcode_Is_CallMethNoArgs() } uint8_t opcode2 = co_code[f_lasti + 2]; uint8_t oparg2 = co_code[f_lasti + 3]; - static auto number = _PepRuntimeVersion(); if (number < 0x030B00) return opcode1 == LOAD_METHOD && opcode2 == CALL_METHOD && oparg2 == 0; @@ -158,7 +164,7 @@ static bool currentOpcode_Is_CallMethNoArgs() // don't need to take care of them. if (opcode1 == LOAD_METHOD) f_lasti += LOAD_METHOD_GAP_311; - else if (opcode1 == LOAD_ATTR) + else if (opcode1 == LOAD_ATTR_312) f_lasti += LOAD_ATTR_GAP_311; else return false; @@ -176,6 +182,11 @@ static bool currentOpcode_Is_CallMethNoArgs() else return false; + if (number >= 0x030D00) { + int opcode3 = co_code[f_lasti + 2]; + if (opcode3 == PUSH_NULL_313) + f_lasti += 2; + } opcode2 = co_code[f_lasti + 2]; oparg2 = co_code[f_lasti + 3]; diff --git a/sources/shiboken6/libshiboken/sbkmodule.cpp b/sources/shiboken6/libshiboken/sbkmodule.cpp index 4153df27f..acadc60fa 100644 --- a/sources/shiboken6/libshiboken/sbkmodule.cpp +++ b/sources/shiboken6/libshiboken/sbkmodule.cpp @@ -7,21 +7,27 @@ #include "bindingmanager.h" #include "sbkstring.h" #include "sbkcppstring.h" +#include "sbkconverter_p.h" #include <unordered_map> #include <unordered_set> +#include <vector> #include <cstring> +/// This hash maps module objects to arrays of converters. +using ModuleConvertersMap = std::unordered_map<PyObject *, SbkConverter **> ; + /// This hash maps module objects to arrays of Python types. using ModuleTypesMap = std::unordered_map<PyObject *, Shiboken::Module::TypeInitStruct *> ; -/// This hash maps module objects to arrays of converters. -using ModuleConvertersMap = std::unordered_map<PyObject *, SbkConverter **>; +struct TypeCreationStruct +{ + Shiboken::Module::TypeCreationFunction func; + std::vector<std::string> subtypeNames; +}; -/// This hash maps type names to type creation functions. -using TypeCreationFunctionModulePair = - std::pair<Shiboken::Module::TypeCreationFunction, PyObject *>; -using NameToTypeFunctionMap = std::unordered_map<std::string, TypeCreationFunctionModulePair>; +/// This hash maps type names to type creation structs. +using NameToTypeFunctionMap = std::unordered_map<std::string, TypeCreationStruct> ; /// This hash maps module objects to maps of names to functions. using ModuleToFuncsMap = std::unordered_map<PyObject *, NameToTypeFunctionMap> ; @@ -56,8 +62,8 @@ LIBSHIBOKEN_API PyTypeObject *get(TypeInitStruct &typeStruct) AutoDecRef modName(String::fromCppStringView(names.substr(0, dotPos))); auto *modOrType = PyDict_GetItem(sysModules, modName); if (modOrType == nullptr) { - PyErr_Format(PyExc_SystemError, "Module %s should already be in sys.modules", - PyModule_GetName(modOrType)); + PyErr_Format(PyExc_SystemError, "Module \"%U\" should already be in sys.modules", + modName.object()); return nullptr; } @@ -74,6 +80,39 @@ LIBSHIBOKEN_API PyTypeObject *get(TypeInitStruct &typeStruct) return typeStruct.type; } +static void incarnateHelper(PyObject *module, const std::string_view names, + const NameToTypeFunctionMap &nameToFunc) +{ + auto dotPos = names.find('.'); + std::string::size_type startPos = 0; + auto *modOrType{module}; + while (dotPos != std::string::npos) { + auto typeName = names.substr(startPos, dotPos - startPos); + AutoDecRef obTypeName(String::fromCppStringView(typeName)); + modOrType = PyObject_GetAttr(modOrType, obTypeName); + startPos = dotPos + 1; + dotPos = names.find('.', startPos); + } + // now we have the type to create. + auto funcIter = nameToFunc.find(std::string(names)); + // - call this function that returns a PyTypeObject + auto tcStruct = funcIter->second; + auto initFunc = tcStruct.func; + PyTypeObject *type = initFunc(modOrType); + auto name = names.substr(startPos); + PyObject_SetAttrString(modOrType, name.data(), reinterpret_cast<PyObject *>(type)); +} + +static void incarnateSubtypes(PyObject *module, + const std::vector<std::string> &nameList, + NameToTypeFunctionMap &nameToFunc) +{ + for (auto const & tableIter : nameList) { + std::string_view names(tableIter); + incarnateHelper(module, names, nameToFunc); + } +} + static PyTypeObject *incarnateType(PyObject *module, const char *name, NameToTypeFunctionMap &nameToFunc) { @@ -85,13 +124,15 @@ static PyTypeObject *incarnateType(PyObject *module, const char *name, return nullptr; } // - call this function that returns a PyTypeObject - auto pair = funcIter->second; - auto initFunc = pair.first; - auto *modOrType = pair.second; + auto tcStruct = funcIter->second; + auto initFunc = tcStruct.func; + auto *modOrType{module}; // PYSIDE-2404: Make sure that no switching happens during type creation. auto saveFeature = initSelectableFeature(nullptr); PyTypeObject *type = initFunc(modOrType); + if (!tcStruct.subtypeNames.empty()) + incarnateSubtypes(module, tcStruct.subtypeNames, nameToFunc); initSelectableFeature(saveFeature); // - assign this object to the name in the module @@ -151,7 +192,7 @@ static PyObject *PyModule_lazyGetAttro(PyObject *module, PyObject *name) // - check if the attribute is present and return it. auto *attr = PyObject_GenericGetAttr(module, name); // - we handle AttributeError, only. - if (!(attr == nullptr && PyErr_ExceptionMatches(PyExc_AttributeError))) + if (attr != nullptr || PyErr_ExceptionMatches(PyExc_AttributeError) == 0) return attr; PyErr_Clear(); @@ -164,7 +205,7 @@ static PyObject *PyModule_lazyGetAttro(PyObject *module, PyObject *name) // - locate the name and retrieve the generating function const char *attrNameStr = Shiboken::String::toCString(name); auto &nameToFunc = tableIter->second; - // - create the real type (incarnateType checks this) + // - create the real type and handle subtypes auto *type = incarnateType(module, attrNameStr, nameToFunc); auto *ret = reinterpret_cast<PyObject *>(type); // - if attribute does really not exist use the original @@ -172,7 +213,6 @@ static PyObject *PyModule_lazyGetAttro(PyObject *module, PyObject *name) PyErr_Clear(); return origModuleGetattro(module, name); } - return ret; } @@ -208,6 +248,9 @@ static PyMethodDef module_methods[] = { // Python 3.8 - 3.12 static int const LOAD_CONST_312 = 100; static int const IMPORT_NAME_312 = 108; +// Python 3.13 +static int const LOAD_CONST_313 = 83; +static int const IMPORT_NAME_313 = 75; static bool isImportStar(PyObject *module) { @@ -220,6 +263,9 @@ static bool isImportStar(PyObject *module) static PyObject *const _co_consts = Shiboken::String::createStaticString("co_consts"); static PyObject *const _co_names = Shiboken::String::createStaticString("co_names"); + static int LOAD_CONST = _PepRuntimeVersion() < 0x030D00 ? LOAD_CONST_312 : LOAD_CONST_313; + static int IMPORT_NAME = _PepRuntimeVersion() < 0x030D00 ? IMPORT_NAME_312 : IMPORT_NAME_313; + auto *obFrame = reinterpret_cast<PyObject *>(PyEval_GetFrame()); if (obFrame == nullptr) return true; // better assume worst-case. @@ -234,12 +280,12 @@ static bool isImportStar(PyObject *module) AutoDecRef dec_co_code(PyObject_GetAttr(dec_f_code, _co_code)); AutoDecRef dec_f_lasti(PyObject_GetAttr(dec_frame, _f_lasti)); Py_ssize_t f_lasti = PyLong_AsSsize_t(dec_f_lasti); - Py_ssize_t code_len; + Py_ssize_t code_len{}; char *co_code{}; PyBytes_AsStringAndSize(dec_co_code, &co_code, &code_len); uint8_t opcode2 = co_code[f_lasti]; uint8_t opcode1 = co_code[f_lasti - 2]; - if (opcode1 == LOAD_CONST_312 && opcode2 == IMPORT_NAME_312) { + if (opcode1 == LOAD_CONST && opcode2 == IMPORT_NAME) { uint8_t oparg1 = co_code[f_lasti - 1]; uint8_t oparg2 = co_code[f_lasti + 1]; AutoDecRef dec_co_consts(PyObject_GetAttr(dec_f_code, _co_consts)); @@ -260,8 +306,6 @@ static bool isImportStar(PyObject *module) // PYSIDE-2404: These modules produce ambiguous names which we cannot handle, yet. static std::unordered_set<std::string> dontLazyLoad{ - "sample", - "smart", "testbinding" }; @@ -292,24 +336,22 @@ static bool shouldLazyLoad(PyObject *module) return std::strncmp(modName, "PySide6.", 8) == 0; } -void AddTypeCreationFunction(PyObject *module, - const char *name, - TypeCreationFunction func) +static int lazyLoadDefault() { - static const char *flag = getenv("PYSIDE6_OPTION_LAZY"); - static const int value = flag != nullptr ? std::atoi(flag) : 1; +#ifndef PYPY_VERSION + int result = 1; +#else + int result = 0; +#endif + if (auto *flag = getenv("PYSIDE6_OPTION_LAZY")) + result = std::atoi(flag); + return result; +} - // - locate the module in the moduleTofuncs mapping - auto tableIter = moduleToFuncs.find(module); - assert(tableIter != moduleToFuncs.end()); - // - Assign the name/generating function pair. - auto &nameToFunc = tableIter->second; - TypeCreationFunctionModulePair pair{func, module}; - auto nit = nameToFunc.find(name); - if (nit == nameToFunc.end()) - nameToFunc.insert(std::make_pair(name, pair)); - else - nit->second = pair; +void checkIfShouldLoadImmediately(PyObject *module, const std::string &name, + const NameToTypeFunctionMap &nameToFunc) +{ + static const int value = lazyLoadDefault(); // PYSIDE-2404: Lazy Loading // @@ -319,56 +361,56 @@ void AddTypeCreationFunction(PyObject *module, // 3 - lazy loading for any module. // // By default we lazy load all known modules (option = 1). - if (value == 0 // completely disabled || canNotLazyLoad(module) // for some reason we cannot lazy load || (value == 1 && !shouldLazyLoad(module)) // not a known module ) { - PyTypeObject *type = func(module); - PyModule_AddObject(module, name, reinterpret_cast<PyObject *>(type)); // steals reference + incarnateHelper(module, name, nameToFunc); } } void AddTypeCreationFunction(PyObject *module, const char *name, - TypeCreationFunction func, - const char *containerName) + TypeCreationFunction func) { - // This version could be delayed as well, but for the few cases - // we simply fetch the container type and insert directly. - AutoDecRef obContainerType(PyObject_GetAttrString(module, containerName)); - PyTypeObject *type = func(obContainerType); - PyObject_SetAttrString(obContainerType, name, reinterpret_cast<PyObject *>(type)); // steals reference -} + // - locate the module in the moduleTofuncs mapping + auto tableIter = moduleToFuncs.find(module); + assert(tableIter != moduleToFuncs.end()); + // - Assign the name/generating function tcStruct. + auto &nameToFunc = tableIter->second; + TypeCreationStruct tcStruct{func, {}}; + auto nit = nameToFunc.find(name); + if (nit == nameToFunc.end()) + nameToFunc.insert(std::make_pair(name, tcStruct)); + else + nit->second = tcStruct; -void AddTypeCreationFunction(PyObject *module, - const char *name, - TypeCreationFunction func, - const char *outerContainerName, - const char *innerContainerName) -{ - // This version has even more indirection. It is very rare, and - // we handle it directly. - AutoDecRef obOuterType(PyObject_GetAttrString(module, outerContainerName)); - AutoDecRef obInnerType(PyObject_GetAttrString(obOuterType, innerContainerName)); - PyTypeObject *type = func(obInnerType); - PyObject_SetAttrString(obInnerType, name, reinterpret_cast<PyObject *>(type)); // steals reference + checkIfShouldLoadImmediately(module, name, nameToFunc); } void AddTypeCreationFunction(PyObject *module, - const char *name, + const char *containerName, TypeCreationFunction func, - const char *containerName3, - const char *containerName2, - const char *containerName) + const char *namePath) { - // This version has even mode indirection. It is very rare, and - // we handle it directly. - AutoDecRef obContainerType3(PyObject_GetAttrString(module, containerName3)); - AutoDecRef obContainerType2(PyObject_GetAttrString(obContainerType3, containerName2)); - AutoDecRef obContainerType(PyObject_GetAttrString(obContainerType2, containerName)); - PyTypeObject *type = func(obContainerType); - PyObject_SetAttrString(obContainerType, name, reinterpret_cast<PyObject *>(type)); // steals reference + // - locate the module in the moduleTofuncs mapping + auto tableIter = moduleToFuncs.find(module); + assert(tableIter != moduleToFuncs.end()); + // - Assign the name/generating function tcStruct. + auto &nameToFunc = tableIter->second; + auto nit = nameToFunc.find(containerName); + + // - insert namePath into the subtype vector of the main type. + nit->second.subtypeNames.emplace_back(namePath); + // - insert it also as its own entry. + nit = nameToFunc.find(namePath); + TypeCreationStruct tcStruct{func, {}}; + if (nit == nameToFunc.end()) + nameToFunc.insert(std::make_pair(namePath, tcStruct)); + else + nit->second = tcStruct; + + checkIfShouldLoadImmediately(module, namePath, nameToFunc); } PyObject *import(const char *moduleName) @@ -441,11 +483,11 @@ PyObject *create(const char * /* modName */, void *moduleData) // Install the getattr patch. origModuleGetattro = PyModule_Type.tp_getattro; PyModule_Type.tp_getattro = PyModule_lazyGetAttro; - // Add the lazy import redirection. + // Add the lazy import redirection, keeping a reference. origImportFunc = PyDict_GetItemString(builtins, "__import__"); - auto *func = PyCFunction_NewEx(lazy_methods, nullptr, nullptr); + Py_INCREF(origImportFunc); + AutoDecRef func(PyCFunction_NewEx(lazy_methods, nullptr, nullptr)); PyDict_SetItemString(builtins, "__import__", func); - // Everything is set. lazy_init = true; } // PYSIDE-2404: Nuitka inserts some additional code in standalone mode @@ -455,6 +497,8 @@ PyObject *create(const char * /* modName */, void *moduleData) // into `sys.modules`. This can cause a race condition. // Insert the module early into the module dict to prevend recursion. PyDict_SetItemString(sysModules, PyModule_GetName(module), module); + // Clear the non-existing name cache because we have a new module. + Shiboken::Conversions::clearNegativeLazyCache(); return module; } diff --git a/sources/shiboken6/libshiboken/sbkmodule.h b/sources/shiboken6/libshiboken/sbkmodule.h index 1b3de33b7..2c407e09d 100644 --- a/sources/shiboken6/libshiboken/sbkmodule.h +++ b/sources/shiboken6/libshiboken/sbkmodule.h @@ -56,18 +56,6 @@ LIBSHIBOKEN_API void AddTypeCreationFunction(PyObject *module, TypeCreationFunction func, const char *containerName); -LIBSHIBOKEN_API void AddTypeCreationFunction(PyObject *module, - const char *name, - TypeCreationFunction func, - const char *outerContainerName, - const char *innerContainerName); - -LIBSHIBOKEN_API void AddTypeCreationFunction(PyObject *module, - const char *name, - TypeCreationFunction func, - const char *containerName3, - const char *containerName2, - const char *containerName); /** * Registers the list of types created by \p module. * \param module Module where the types were created. diff --git a/sources/shiboken6/libshiboken/sbkstring.cpp b/sources/shiboken6/libshiboken/sbkstring.cpp index 1471cd7fe..b5e87ca5a 100644 --- a/sources/shiboken6/libshiboken/sbkstring.cpp +++ b/sources/shiboken6/libshiboken/sbkstring.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "sbkstring.h" +#include "sbkenum.h" #include "sbkstaticstrings_p.h" #include "autodecref.h" @@ -14,6 +15,11 @@ bool checkIterable(PyObject *obj) return PyObject_HasAttr(obj, Shiboken::PyMagicName::iter()); } +bool checkIterableArgument(PyObject *obj) +{ + return checkIterable(obj) && !Shiboken::Enum::check(obj); +} + static PyObject *initPathLike() { PyObject *PathLike{}; diff --git a/sources/shiboken6/libshiboken/sbkstring.h b/sources/shiboken6/libshiboken/sbkstring.h index f91847c11..3ff2805e2 100644 --- a/sources/shiboken6/libshiboken/sbkstring.h +++ b/sources/shiboken6/libshiboken/sbkstring.h @@ -7,12 +7,12 @@ #include "sbkpython.h" #include "shibokenmacros.h" -namespace Shiboken -{ -namespace String +namespace Shiboken::String { LIBSHIBOKEN_API bool check(PyObject *obj); LIBSHIBOKEN_API bool checkIterable(PyObject *obj); + /// Check for iterable function arguments (excluding enumerations) + LIBSHIBOKEN_API bool checkIterableArgument(PyObject *obj); LIBSHIBOKEN_API bool checkPath(PyObject *path); LIBSHIBOKEN_API bool checkType(PyTypeObject *obj); LIBSHIBOKEN_API bool checkChar(PyObject *obj); @@ -31,10 +31,6 @@ namespace String LIBSHIBOKEN_API PyObject *getSnakeCaseName(PyObject *name, bool lower); LIBSHIBOKEN_API PyObject *repr(PyObject *o); -} // namespace String -} // namespace Shiboken - +} // namespace Shiboken::String #endif - - diff --git a/sources/shiboken6/libshiboken/shiboken.h b/sources/shiboken6/libshiboken/shiboken.h index fcf777ae0..27ba05fa7 100644 --- a/sources/shiboken6/libshiboken/shiboken.h +++ b/sources/shiboken6/libshiboken/shiboken.h @@ -19,6 +19,7 @@ #include "sbkmodule.h" #include "sbkstring.h" #include "sbkstaticstrings.h" +#include "sbktypefactory.h" #include "shibokenmacros.h" #include "shibokenbuffer.h" #include "signature.h" diff --git a/sources/shiboken6/libshiboken/shibokenbuffer.h b/sources/shiboken6/libshiboken/shibokenbuffer.h index 6b17eb6eb..068a5e9fd 100644 --- a/sources/shiboken6/libshiboken/shibokenbuffer.h +++ b/sources/shiboken6/libshiboken/shibokenbuffer.h @@ -7,10 +7,7 @@ #include "sbkpython.h" #include "shibokenmacros.h" -namespace Shiboken -{ - -namespace Buffer +namespace Shiboken::Buffer { enum Type { ReadOnly, @@ -51,7 +48,6 @@ namespace Buffer */ LIBSHIBOKEN_API void *copyData(PyObject *pyObj, Py_ssize_t *size = nullptr); -} // namespace Buffer -} // namespace Shiboken +} // namespace Shiboken::Buffer #endif diff --git a/sources/shiboken6/libshiboken/signature/signature.cpp b/sources/shiboken6/libshiboken/signature/signature.cpp index 3255cb56d..45269844e 100644 --- a/sources/shiboken6/libshiboken/signature/signature.cpp +++ b/sources/shiboken6/libshiboken/signature/signature.cpp @@ -424,7 +424,9 @@ static int PySide_FinishSignatures(PyObject *module, const char *signatures[]) * to the PyCFunction attributes. Therefore I simplified things * and always use our own mapping. */ - PyObject *key, *func, *obdict = PyModule_GetDict(module); + PyObject *key{}; + PyObject *func{}; + PyObject *obdict = PyModule_GetDict(module); Py_ssize_t pos = 0; while (PyDict_Next(obdict, &pos, &key, &func)) @@ -538,7 +540,7 @@ static PyObject *adjustFuncName(const char *func_name) assert(PyType_Check(obtype)); // This was not true for __init__! // Find the feature flags - auto type = reinterpret_cast<PyTypeObject *>(obtype.object()); + auto *type = reinterpret_cast<PyTypeObject *>(obtype.object()); AutoDecRef dict(PepType_GetDict(type)); int id = currentSelectId(type); id = id < 0 ? 0 : id; // if undefined, set to zero @@ -585,7 +587,9 @@ void SetError_Argument(PyObject *args, const char *func_name, PyObject *info) // PYSIDE-1305: Handle errors set by fillQtProperties. if (PyErr_Occurred()) { - PyObject *e, *v, *t; + PyObject *e{}; + PyObject *v{}; + PyObject *t{}; // Note: These references are all borrowed. PyErr_Fetch(&e, &v, &t); Py_DECREF(e); @@ -606,7 +610,8 @@ void SetError_Argument(PyObject *args, const char *func_name, PyObject *info) PyErr_Print(); Py_FatalError("seterror_argument did not receive a result"); } - PyObject *err, *msg; + PyObject *err{}; + PyObject *msg{}; if (!PyArg_UnpackTuple(res, func_name, 2, 2, &err, &msg)) { PyErr_Print(); Py_FatalError("unexpected failure in seterror_argument"); diff --git a/sources/shiboken6/libshiboken/signature/signature_extend.cpp b/sources/shiboken6/libshiboken/signature/signature_extend.cpp index 7292f8216..3ce9e21e3 100644 --- a/sources/shiboken6/libshiboken/signature/signature_extend.cpp +++ b/sources/shiboken6/libshiboken/signature/signature_extend.cpp @@ -120,12 +120,10 @@ static int handle_doc_in_progress = 0; static PyObject *handle_doc(PyObject *ob, PyObject *old_descr) { AutoDecRef ob_type_mod(GetClassOrModOf(ob)); - const char *name; bool isModule = PyModule_Check(ob_type_mod.object()); - if (isModule) - name = PyModule_GetName(ob_type_mod.object()); - else - name = reinterpret_cast<PyTypeObject *>(ob_type_mod.object())->tp_name; + const char *name = isModule + ? PyModule_GetName(ob_type_mod.object()) + : reinterpret_cast<PyTypeObject *>(ob_type_mod.object())->tp_name; PyObject *res{}; if (handle_doc_in_progress || name == nullptr @@ -205,14 +203,14 @@ int PySide_PatchTypes(void) AutoDecRef wrap_descr(PyObject_GetAttrString( reinterpret_cast<PyObject *>(Py_TYPE(Py_True)), "__add__")); // abbreviations for readability - auto md_gs = new_PyMethodDescr_getsets; - auto md_doc = &old_md_doc_descr; - auto cf_gs = new_PyCFunction_getsets; - auto cf_doc = &old_cf_doc_descr; - auto sm_gs = new_PyStaticMethod_getsets; - auto sm_doc = &old_sm_doc_descr; - auto wd_gs = new_PyWrapperDescr_getsets; - auto wd_doc = &old_wd_doc_descr; + auto *md_gs = new_PyMethodDescr_getsets; + auto *md_doc = &old_md_doc_descr; + auto *cf_gs = new_PyCFunction_getsets; + auto *cf_doc = &old_cf_doc_descr; + auto *sm_gs = new_PyStaticMethod_getsets; + auto *sm_doc = &old_sm_doc_descr; + auto *wd_gs = new_PyWrapperDescr_getsets; + auto *wd_doc = &old_wd_doc_descr; if (meth_descr.isNull() || wrap_descr.isNull() || PyType_Ready(Py_TYPE(meth_descr)) < 0 diff --git a/sources/shiboken6/libshiboken/signature/signature_globals.cpp b/sources/shiboken6/libshiboken/signature/signature_globals.cpp index 3a79a12d5..0a08309cc 100644 --- a/sources/shiboken6/libshiboken/signature/signature_globals.cpp +++ b/sources/shiboken6/libshiboken/signature/signature_globals.cpp @@ -120,7 +120,7 @@ static safe_globals_struc *init_phase_1() return p; - } while (0); + } while (false); PyErr_Print(); Py_FatalError("could not initialize part 1"); @@ -130,10 +130,8 @@ static safe_globals_struc *init_phase_1() static int init_phase_2(safe_globals_struc *p, PyMethodDef *methods) { do { - PyMethodDef *ml; - // The single function to be called, but maybe more to come. - for (ml = methods; ml->ml_name != nullptr; ml++) { + for (PyMethodDef *ml = methods; ml->ml_name != nullptr; ++ml) { PyObject *v = PyCFunction_NewEx(ml, nullptr, nullptr); if (v == nullptr || PyObject_SetAttrString(p->helper_module, ml->ml_name, v) != 0) @@ -220,10 +218,8 @@ static int init_phase_2(safe_globals_struc *p, PyMethodDef *methods) static void handler(int sig) { #if defined(__GLIBC__) void *array[30]; - size_t size; - // get void *'s for all entries on the stack - size = backtrace(array, 30); + const int size = backtrace(array, 30); // print out all the frames to stderr #endif diff --git a/sources/shiboken6/libshiboken/signature/signature_helper.cpp b/sources/shiboken6/libshiboken/signature/signature_helper.cpp index cf84cfa13..9aab7a6a9 100644 --- a/sources/shiboken6/libshiboken/signature/signature_helper.cpp +++ b/sources/shiboken6/libshiboken/signature/signature_helper.cpp @@ -17,6 +17,8 @@ #include "signature_p.h" +#include <cstring> + using namespace Shiboken; extern "C" { @@ -115,11 +117,11 @@ static PyObject *_func_with_new_name(PyTypeObject *type, * but does not create a descriptor. * XXX Maybe we can get rid of this, completely? */ - auto obtype = reinterpret_cast<PyObject *>(type); - int len = strlen(new_name); - auto name = new char[len + 1]; - strcpy(name, new_name); - auto new_meth = new PyMethodDef; + auto *obtype = reinterpret_cast<PyObject *>(type); + const size_t len = std::strlen(new_name); + auto *name = new char[len + 1]; + std::strcpy(name, new_name); + auto *new_meth = new PyMethodDef; new_meth->ml_name = name; new_meth->ml_meth = meth->ml_meth; new_meth->ml_flags = meth->ml_flags; @@ -196,8 +198,8 @@ static PyObject *_build_new_entry(PyObject *new_name, PyObject *value) if (list.isNull()) return nullptr; for (int idx = 0; idx < len; ++idx) { - auto multi_entry = PyList_GetItem(multi, idx); - auto dup = PyDict_Copy(multi_entry); + auto *multi_entry = PyList_GetItem(multi, idx); + auto *dup = PyDict_Copy(multi_entry); if (PyDict_SetItem(dup, PyName::name(), new_name) < 0) return nullptr; if (PyList_SetItem(list, idx, dup) < 0) @@ -215,7 +217,8 @@ static PyObject *_build_new_entry(PyObject *new_name, PyObject *value) int insert_snake_case_variants(PyObject *dict) { AutoDecRef snake_dict(PyDict_New()); - PyObject *key, *value; + PyObject *key{}; + PyObject *value{}; Py_ssize_t pos = 0; while (PyDict_Next(dict, &pos, &key, &value)) { AutoDecRef name(String::getSnakeCaseName(key, true)); @@ -363,8 +366,8 @@ int _build_func_to_type(PyObject *obtype) if (descr == nullptr) return -1; char mangled_name[200]; - strcpy(mangled_name, meth->ml_name); - strcat(mangled_name, ".overload"); + std::strcpy(mangled_name, meth->ml_name); + std::strcat(mangled_name, ".overload"); if (PyDict_SetItemString(dict, mangled_name, descr) < 0) return -1; if (meth->ml_flags & METH_STATIC) { diff --git a/sources/shiboken6/libshiboken/voidptr.cpp b/sources/shiboken6/libshiboken/voidptr.cpp index 8bb3f6ac8..ce85d4946 100644 --- a/sources/shiboken6/libshiboken/voidptr.cpp +++ b/sources/shiboken6/libshiboken/voidptr.cpp @@ -6,6 +6,7 @@ #include "sbkconverter.h" #include "basewrapper.h" #include "basewrapper_p.h" +#include "sbktypefactory.h" extern "C" { @@ -41,7 +42,7 @@ PyObject *SbkVoidPtrObject_new(PyTypeObject *type, PyObject * /* args */, PyObje int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds) { - PyObject *addressObject; + PyObject *addressObject{}; Py_ssize_t size = -1; int isWritable = 0; auto *sbkSelf = reinterpret_cast<SbkVoidPtrObject *>(self); diff --git a/sources/shiboken6/shiboken_tool.py b/sources/shiboken6/shiboken_tool.py index 30d334f44..2b69a1c6a 100755 --- a/sources/shiboken6/shiboken_tool.py +++ b/sources/shiboken6/shiboken_tool.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys import os import subprocess diff --git a/sources/shiboken6/shiboken_version.py b/sources/shiboken6/shiboken_version.py index 07b247316..033a2e439 100644 --- a/sources/shiboken6/shiboken_version.py +++ b/sources/shiboken6/shiboken_version.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations major_version = "@shiboken_MAJOR_VERSION@" minor_version = "@shiboken_MINOR_VERSION@" diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/__init__.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/__init__.py index e54bec75a..db4f381f5 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/__init__.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/__init__.py @@ -1,4 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations # this file intentionally left blank diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/feature.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/feature.py index 7a0871ee7..4a8ccdbc6 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/feature.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/feature.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations # flake8: noqa F:821 # flake8: noqa F:401 diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/fix-complaints.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/fix-complaints.py index f7190b12f..524c1c483 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/fix-complaints.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/fix-complaints.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ fix-complaints.py diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/__init__.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/__init__.py index bebf56c7e..2704ffab7 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/__init__.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/__init__.py @@ -1,4 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations __all__ = "get_signature layout mapping lib".split() diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py index c2a19efef..5ec41aa9f 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations # flake8: noqa E:721 diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/importhandler.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/importhandler.py index bae264294..394e8cda3 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/importhandler.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/importhandler.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ importhandler.py diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/layout.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/layout.py index 0e781cbcb..6fc8ff1b3 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/layout.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/layout.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ layout.py diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/__init__.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/__init__.py index e54bec75a..db4f381f5 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/__init__.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/__init__.py @@ -1,4 +1,5 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations # this file intentionally left blank diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py index 5650e2bc1..9d98d7b1b 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ enum_sig.py diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py index ce12dd6c8..641b6693a 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py @@ -1,6 +1,7 @@ LICENSE_TEXT = """ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ # flake8: noqa E:402 diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py index 979dcf4ce..48546d7cb 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/tool.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ tool.py diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/loader.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/loader.py index fb4c9eeca..ba9f78761 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/loader.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/loader.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations # flake8: noqa E:402 # flake8: noqa F:401 diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py index 944a928e6..3bdd4c1d2 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations # flake8: noqa E:203 diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py index 9b48ab442..6071dd92c 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/parser.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import ast import enum diff --git a/sources/shiboken6/shibokenmodule/shibokenmodule.cpp b/sources/shiboken6/shibokenmodule/shibokenmodule.cpp index b3adfe78b..5c6219885 100644 --- a/sources/shiboken6/shibokenmodule/shibokenmodule.cpp +++ b/sources/shiboken6/shibokenmodule/shibokenmodule.cpp @@ -100,6 +100,10 @@ const bool ok = Shiboken::BindingManager::instance().dumpTypeGraph(%1); Shiboken::BindingManager::instance().dumpWrapperMap(); // @snippet dumpwrappermap +// @snippet dumpconverters +Shiboken::Conversions::dumpConverters(); +// @snippet dumpconverters + // @snippet init // Add __version__ and __version_info__ attributes to the module PyObject* version = PyTuple_New(5); diff --git a/sources/shiboken6/shibokenmodule/typesystem_shiboken.xml b/sources/shiboken6/shibokenmodule/typesystem_shiboken.xml index aa08a8bbf..acb522ecc 100644 --- a/sources/shiboken6/shibokenmodule/typesystem_shiboken.xml +++ b/sources/shiboken6/shibokenmodule/typesystem_shiboken.xml @@ -57,9 +57,14 @@ <inject-code file="shibokenmodule.cpp" snippet="dumpwrappermap"/> </add-function> + <add-function signature="dumpConverters()"> + <inject-code file="shibokenmodule.cpp" snippet="dumpconverters"/> + </add-function> + <extra-includes> <include file-name="sbkversion.h" location="local"/> <include file-name="voidptr.h" location="local"/> + <include file-name="sbkconverter_p.h" location="local"/> </extra-includes> <inject-code position="end" file="shibokenmodule.cpp" snippet="init"/> </typesystem> diff --git a/sources/shiboken6/tests/libother/othermultiplederived.h b/sources/shiboken6/tests/libother/othermultiplederived.h index cd9910687..9f90c43a7 100644 --- a/sources/shiboken6/tests/libother/othermultiplederived.h +++ b/sources/shiboken6/tests/libother/othermultiplederived.h @@ -6,6 +6,7 @@ #include "libothermacros.h" #include "multiple_derived.h" +#include "objecttype.h" #include "virtualmethods.h" class ObjectType; diff --git a/sources/shiboken6/tests/libsample/derived.h b/sources/shiboken6/tests/libsample/derived.h index b7736c37a..cf95cb601 100644 --- a/sources/shiboken6/tests/libsample/derived.h +++ b/sources/shiboken6/tests/libsample/derived.h @@ -26,7 +26,7 @@ public: public: void uselessMethod() {} SomeInnerClass operator+(const SomeInnerClass &other) { return other; } - bool operator==(const SomeInnerClass &) { return true; } + bool operator==(const SomeInnerClass &) const { return true; } }; explicit Derived(int id = -1) noexcept; diff --git a/sources/shiboken6/tests/libsample/point.cpp b/sources/shiboken6/tests/libsample/point.cpp index b8630eb1e..0a28e877f 100644 --- a/sources/shiboken6/tests/libsample/point.cpp +++ b/sources/shiboken6/tests/libsample/point.cpp @@ -34,7 +34,7 @@ void Point::show() const std::cout << "(x: " << m_x << ", y: " << m_y << ")"; } -bool Point::operator==(const Point &other) +bool Point::operator==(const Point &other) const { return m_x == other.m_x && m_y == other.m_y; } diff --git a/sources/shiboken6/tests/libsample/point.h b/sources/shiboken6/tests/libsample/point.h index 59e0236d5..7e5d128ab 100644 --- a/sources/shiboken6/tests/libsample/point.h +++ b/sources/shiboken6/tests/libsample/point.h @@ -38,7 +38,7 @@ public: // The != operator is not implemented for the purpose of testing // for the absense of the __ne__ method in the Python binding. - bool operator==(const Point &other); + bool operator==(const Point &other) const; Point operator+(const Point &other); Point operator-(const Point &other); diff --git a/sources/shiboken6/tests/libsample/pointf.cpp b/sources/shiboken6/tests/libsample/pointf.cpp index 6b39f73a9..736a5c6b5 100644 --- a/sources/shiboken6/tests/libsample/pointf.cpp +++ b/sources/shiboken6/tests/libsample/pointf.cpp @@ -26,7 +26,7 @@ void PointF::show() const std::cout << "(x: " << m_x << ", y: " << m_y << ")"; } -bool PointF::operator==(const PointF &other) +bool PointF::operator==(const PointF &other) const { return m_x == other.m_x && m_y == other.m_y; } diff --git a/sources/shiboken6/tests/libsample/pointf.h b/sources/shiboken6/tests/libsample/pointf.h index bb50b5c6d..49e009467 100644 --- a/sources/shiboken6/tests/libsample/pointf.h +++ b/sources/shiboken6/tests/libsample/pointf.h @@ -31,7 +31,7 @@ public: // The != operator is not implemented for the purpose of testing // for the absence of the __ne__ method in the Python binding. - bool operator==(const PointF &other); + bool operator==(const PointF &other) const; PointF operator+(const PointF &other); PointF operator-(const PointF &other); diff --git a/sources/shiboken6/tests/libsmart/stdsharedptrtestbench.cpp b/sources/shiboken6/tests/libsmart/stdsharedptrtestbench.cpp index a7b73cc81..472f807f2 100644 --- a/sources/shiboken6/tests/libsmart/stdsharedptrtestbench.cpp +++ b/sources/shiboken6/tests/libsmart/stdsharedptrtestbench.cpp @@ -51,6 +51,46 @@ void StdSharedPtrTestBench::printInt(const std::shared_ptr<int> &p) std::cerr << '\n'; } +std::shared_ptr<double> StdSharedPtrTestBench::createDouble(double v) +{ + return std::make_shared<double>(v); +} + +std::shared_ptr<double> StdSharedPtrTestBench::createNullDouble() +{ + return {}; +} + +void StdSharedPtrTestBench::printDouble(const std::shared_ptr<double> &p) +{ + std::cerr << __FUNCTION__ << ' '; + if (p.get()) + std::cerr << *p; + else + std::cerr << "nullptr"; + std::cerr << '\n'; +} + +std::shared_ptr<std::string> StdSharedPtrTestBench::createString(const char *text) +{ + return std::make_shared<std::string>(text); +} + +std::shared_ptr<std::string> StdSharedPtrTestBench::createNullString() +{ + return {}; +} + +void StdSharedPtrTestBench::printString(const std::shared_ptr<std::string> &p) +{ + std::cerr << __FUNCTION__ << ' '; + if (p.get()) + std::cerr << '"' << *p << '"'; + else + std::cerr << "nullptr"; + std::cerr << '\n'; +} + StdSharedPtrVirtualMethodTester::StdSharedPtrVirtualMethodTester() = default; StdSharedPtrVirtualMethodTester::~StdSharedPtrVirtualMethodTester() = default; diff --git a/sources/shiboken6/tests/libsmart/stdsharedptrtestbench.h b/sources/shiboken6/tests/libsmart/stdsharedptrtestbench.h index 8991cded6..9d4c207b5 100644 --- a/sources/shiboken6/tests/libsmart/stdsharedptrtestbench.h +++ b/sources/shiboken6/tests/libsmart/stdsharedptrtestbench.h @@ -7,6 +7,7 @@ #include "libsmartmacros.h" #include <memory> +#include <string> class Integer; @@ -23,6 +24,14 @@ public: static std::shared_ptr<int> createInt(int v = 42); static std::shared_ptr<int> createNullInt(); static void printInt(const std::shared_ptr<int> &); + + static std::shared_ptr<double> createDouble(double v = 42); + static std::shared_ptr<double> createNullDouble(); + static void printDouble(const std::shared_ptr<double> &); + + static std::shared_ptr<std::string> createString(const char *text); + static std::shared_ptr<std::string> createNullString(); + static void printString(const std::shared_ptr<std::string> &); }; class LIB_SMART_API StdSharedPtrVirtualMethodTester diff --git a/sources/shiboken6/tests/minimalbinding/brace_pattern_test.py b/sources/shiboken6/tests/minimalbinding/brace_pattern_test.py index 946a869db..a45c6edb2 100644 --- a/sources/shiboken6/tests/minimalbinding/brace_pattern_test.py +++ b/sources/shiboken6/tests/minimalbinding/brace_pattern_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import re diff --git a/sources/shiboken6/tests/minimalbinding/containeruser_test.py b/sources/shiboken6/tests/minimalbinding/containeruser_test.py index 25d683957..cda4f32b2 100644 --- a/sources/shiboken6/tests/minimalbinding/containeruser_test.py +++ b/sources/shiboken6/tests/minimalbinding/containeruser_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/minimalbinding/listuser_test.py b/sources/shiboken6/tests/minimalbinding/listuser_test.py index b30bb653a..bf09eeffb 100644 --- a/sources/shiboken6/tests/minimalbinding/listuser_test.py +++ b/sources/shiboken6/tests/minimalbinding/listuser_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations from functools import reduce import os diff --git a/sources/shiboken6/tests/minimalbinding/minbool_test.py b/sources/shiboken6/tests/minimalbinding/minbool_test.py index d9ce0eac0..0f033e4d1 100644 --- a/sources/shiboken6/tests/minimalbinding/minbool_test.py +++ b/sources/shiboken6/tests/minimalbinding/minbool_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/minimalbinding/obj_test.py b/sources/shiboken6/tests/minimalbinding/obj_test.py index e873845de..82dc89d38 100644 --- a/sources/shiboken6/tests/minimalbinding/obj_test.py +++ b/sources/shiboken6/tests/minimalbinding/obj_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/minimalbinding/spanuser_test.py b/sources/shiboken6/tests/minimalbinding/spanuser_test.py index 6db6aa616..4239fe9a2 100644 --- a/sources/shiboken6/tests/minimalbinding/spanuser_test.py +++ b/sources/shiboken6/tests/minimalbinding/spanuser_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/minimalbinding/typedef_test.py b/sources/shiboken6/tests/minimalbinding/typedef_test.py index c2fc8fc12..c69a1c3c5 100644 --- a/sources/shiboken6/tests/minimalbinding/typedef_test.py +++ b/sources/shiboken6/tests/minimalbinding/typedef_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/minimalbinding/val_test.py b/sources/shiboken6/tests/minimalbinding/val_test.py index b8225a247..25642dc3f 100644 --- a/sources/shiboken6/tests/minimalbinding/val_test.py +++ b/sources/shiboken6/tests/minimalbinding/val_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/otherbinding/collector_external_operator_test.py b/sources/shiboken6/tests/otherbinding/collector_external_operator_test.py index 2ba21653d..7819d1e0d 100644 --- a/sources/shiboken6/tests/otherbinding/collector_external_operator_test.py +++ b/sources/shiboken6/tests/otherbinding/collector_external_operator_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Collector shift operators defined in other modules.''' diff --git a/sources/shiboken6/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py b/sources/shiboken6/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py index bd00b5892..e837300a3 100644 --- a/sources/shiboken6/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py +++ b/sources/shiboken6/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests calling NoImplicitConversion using a ExtendsNoImplicitConversion parameter, being that the latter defines a new conversion operator for the former, and this one diff --git a/sources/shiboken6/tests/otherbinding/extended_multiply_operator_test.py b/sources/shiboken6/tests/otherbinding/extended_multiply_operator_test.py index abbef6231..bb2511dae 100644 --- a/sources/shiboken6/tests/otherbinding/extended_multiply_operator_test.py +++ b/sources/shiboken6/tests/otherbinding/extended_multiply_operator_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for libsample's Point multiply operator defined in libother module.''' diff --git a/sources/shiboken6/tests/otherbinding/module_reload_test.py b/sources/shiboken6/tests/otherbinding/module_reload_test.py index bde2f5236..2fd66a51f 100644 --- a/sources/shiboken6/tests/otherbinding/module_reload_test.py +++ b/sources/shiboken6/tests/otherbinding/module_reload_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations from importlib import reload import os diff --git a/sources/shiboken6/tests/otherbinding/new_ctor_operator_test.py b/sources/shiboken6/tests/otherbinding/new_ctor_operator_test.py index d6c356436..3c63929f1 100644 --- a/sources/shiboken6/tests/otherbinding/new_ctor_operator_test.py +++ b/sources/shiboken6/tests/otherbinding/new_ctor_operator_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests calling Str constructor using a Number parameter, being that number defines a cast operator to Str.''' diff --git a/sources/shiboken6/tests/otherbinding/objtypehashes_test.py b/sources/shiboken6/tests/otherbinding/objtypehashes_test.py index d2cd7de5b..6764cc0f7 100644 --- a/sources/shiboken6/tests/otherbinding/objtypehashes_test.py +++ b/sources/shiboken6/tests/otherbinding/objtypehashes_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/otherbinding/otherderived_test.py b/sources/shiboken6/tests/otherbinding/otherderived_test.py index 459f474f1..13c59f91f 100644 --- a/sources/shiboken6/tests/otherbinding/otherderived_test.py +++ b/sources/shiboken6/tests/otherbinding/otherderived_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for OtherDerived class''' diff --git a/sources/shiboken6/tests/otherbinding/othertypesystypedef_test.py b/sources/shiboken6/tests/otherbinding/othertypesystypedef_test.py index 198c71693..236dda6b0 100644 --- a/sources/shiboken6/tests/otherbinding/othertypesystypedef_test.py +++ b/sources/shiboken6/tests/otherbinding/othertypesystypedef_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for a class that holds a void pointer.''' diff --git a/sources/shiboken6/tests/otherbinding/signature_test.py b/sources/shiboken6/tests/otherbinding/signature_test.py index 8db3e566b..a22f65316 100644 --- a/sources/shiboken6/tests/otherbinding/signature_test.py +++ b/sources/shiboken6/tests/otherbinding/signature_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for functions signature''' diff --git a/sources/shiboken6/tests/otherbinding/smartptr_test.py b/sources/shiboken6/tests/otherbinding/smartptr_test.py index fd5c7fa09..1c9466e24 100644 --- a/sources/shiboken6/tests/otherbinding/smartptr_test.py +++ b/sources/shiboken6/tests/otherbinding/smartptr_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for the SmartPtrTester class''' diff --git a/sources/shiboken6/tests/otherbinding/star_import_test.py b/sources/shiboken6/tests/otherbinding/star_import_test.py index 4b5f1d270..9c4b42fa8 100644 --- a/sources/shiboken6/tests/otherbinding/star_import_test.py +++ b/sources/shiboken6/tests/otherbinding/star_import_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """PYSIDE-2404: Test whether star imports work as they require special handling by the lazy initialization.""" diff --git a/sources/shiboken6/tests/otherbinding/test_module_template.py b/sources/shiboken6/tests/otherbinding/test_module_template.py index 36ab43ae3..b4e5515fa 100644 --- a/sources/shiboken6/tests/otherbinding/test_module_template.py +++ b/sources/shiboken6/tests/otherbinding/test_module_template.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/otherbinding/typediscovery_test.py b/sources/shiboken6/tests/otherbinding/typediscovery_test.py index 39dc5cf0f..67f45e7ba 100644 --- a/sources/shiboken6/tests/otherbinding/typediscovery_test.py +++ b/sources/shiboken6/tests/otherbinding/typediscovery_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for type discovery''' diff --git a/sources/shiboken6/tests/otherbinding/usersprimitivefromothermodule_test.py b/sources/shiboken6/tests/otherbinding/usersprimitivefromothermodule_test.py index 15a988326..e99256f35 100644 --- a/sources/shiboken6/tests/otherbinding/usersprimitivefromothermodule_test.py +++ b/sources/shiboken6/tests/otherbinding/usersprimitivefromothermodule_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests user defined primitive type from a required module.''' diff --git a/sources/shiboken6/tests/otherbinding/wrongctor_test.py b/sources/shiboken6/tests/otherbinding/wrongctor_test.py index b9251b428..a5fe04ecd 100644 --- a/sources/shiboken6/tests/otherbinding/wrongctor_test.py +++ b/sources/shiboken6/tests/otherbinding/wrongctor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/qtxmltosphinx/main.cpp b/sources/shiboken6/tests/qtxmltosphinx/main.cpp index 27aaee7d1..5b0624376 100644 --- a/sources/shiboken6/tests/qtxmltosphinx/main.cpp +++ b/sources/shiboken6/tests/qtxmltosphinx/main.cpp @@ -40,6 +40,7 @@ public: const QString &) const override; const QLoggingCategory &loggingCategory() const override; QtXmlToSphinxLink resolveLink(const QtXmlToSphinxLink &link) const override; + Image resolveImage(const QString &href, const QString &) const; }; // QtXmlToSphinxDocGeneratorInterface @@ -63,11 +64,18 @@ const QLoggingCategory &QtXmlToSphinxDocGenerator::loggingCategory() const return lcQtXmlToSphinx(); } -QtXmlToSphinxLink QtXmlToSphinxDocGenerator::resolveLink(const QtXmlToSphinxLink &link) const +QtXmlToSphinxLink + QtXmlToSphinxDocGenerator::resolveLink(const QtXmlToSphinxLink &link) const { return link; } +QtXmlToSphinxDocGeneratorInterface::Image + QtXmlToSphinxDocGenerator::resolveImage(const QString &href, const QString &) const +{ + return {href, href}; +} + static bool run(const QString &fileName) { QtXmlToSphinxDocGenerator generator; diff --git a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp index 45cecd1a1..3ba77196f 100644 --- a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp +++ b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp @@ -39,6 +39,12 @@ QtXmlToSphinxLink QtXmlToSphinxTest::resolveLink(const QtXmlToSphinxLink &link) return link; } +QtXmlToSphinxDocGeneratorInterface::Image + QtXmlToSphinxTest::resolveImage(const QString &href, const QString &) const +{ + return {href, href}; +} + QString QtXmlToSphinxTest::transformXml(const QString &xml) const { return QtXmlToSphinx(this, m_parameters, xml).result(); diff --git a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.h b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.h index 0a210b7a0..5108ef452 100644 --- a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.h +++ b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.h @@ -19,6 +19,7 @@ public: const QString &) const override; const QLoggingCategory &loggingCategory() const override; QtXmlToSphinxLink resolveLink(const QtXmlToSphinxLink &link) const override; + Image resolveImage(const QString &href, const QString &context) const override; private slots: void testTable_data(); diff --git a/sources/shiboken6/tests/samplebinding/__del___test.py b/sources/shiboken6/tests/samplebinding/__del___test.py index 456886614..688e35445 100644 --- a/sources/shiboken6/tests/samplebinding/__del___test.py +++ b/sources/shiboken6/tests/samplebinding/__del___test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/shiboken6/tests/samplebinding/abstract_test.py b/sources/shiboken6/tests/samplebinding/abstract_test.py index 89e87be1d..bf7f36dfb 100644 --- a/sources/shiboken6/tests/samplebinding/abstract_test.py +++ b/sources/shiboken6/tests/samplebinding/abstract_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Abstract class''' diff --git a/sources/shiboken6/tests/samplebinding/addedfunction_test.py b/sources/shiboken6/tests/samplebinding/addedfunction_test.py index 0b5680143..cd7132ad9 100644 --- a/sources/shiboken6/tests/samplebinding/addedfunction_test.py +++ b/sources/shiboken6/tests/samplebinding/addedfunction_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for added functions.''' diff --git a/sources/shiboken6/tests/samplebinding/addedfunction_with_container_args_test.py b/sources/shiboken6/tests/samplebinding/addedfunction_with_container_args_test.py index 2a739033b..01b77531e 100644 --- a/sources/shiboken6/tests/samplebinding/addedfunction_with_container_args_test.py +++ b/sources/shiboken6/tests/samplebinding/addedfunction_with_container_args_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for added functions with nested and multi-argument container types.''' diff --git a/sources/shiboken6/tests/samplebinding/argumentmodifications_test.py b/sources/shiboken6/tests/samplebinding/argumentmodifications_test.py index b0ca56a6d..576554404 100644 --- a/sources/shiboken6/tests/samplebinding/argumentmodifications_test.py +++ b/sources/shiboken6/tests/samplebinding/argumentmodifications_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for method arguments modifications performed as described on typesystem.''' diff --git a/sources/shiboken6/tests/samplebinding/array_numpy_test.py b/sources/shiboken6/tests/samplebinding/array_numpy_test.py index 0d73bca1c..a8baeb098 100644 --- a/sources/shiboken6/tests/samplebinding/array_numpy_test.py +++ b/sources/shiboken6/tests/samplebinding/array_numpy_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for NumPy Array types.''' diff --git a/sources/shiboken6/tests/samplebinding/array_sequence_test.py b/sources/shiboken6/tests/samplebinding/array_sequence_test.py index ad65d58db..379d0b69e 100644 --- a/sources/shiboken6/tests/samplebinding/array_sequence_test.py +++ b/sources/shiboken6/tests/samplebinding/array_sequence_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for Array types (PySequence).''' diff --git a/sources/shiboken6/tests/samplebinding/bug_554_test.py b/sources/shiboken6/tests/samplebinding/bug_554_test.py index a7e7a7210..0292a3cdb 100644 --- a/sources/shiboken6/tests/samplebinding/bug_554_test.py +++ b/sources/shiboken6/tests/samplebinding/bug_554_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Unit test for bug#554''' diff --git a/sources/shiboken6/tests/samplebinding/bug_704_test.py b/sources/shiboken6/tests/samplebinding/bug_704_test.py index c470fe723..d0cfe4038 100644 --- a/sources/shiboken6/tests/samplebinding/bug_704_test.py +++ b/sources/shiboken6/tests/samplebinding/bug_704_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/bytearray_test.py b/sources/shiboken6/tests/samplebinding/bytearray_test.py index e51a899fa..a3771ef94 100644 --- a/sources/shiboken6/tests/samplebinding/bytearray_test.py +++ b/sources/shiboken6/tests/samplebinding/bytearray_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/child_return_test.py b/sources/shiboken6/tests/samplebinding/child_return_test.py index f0ac70626..dc39aaaab 100644 --- a/sources/shiboken6/tests/samplebinding/child_return_test.py +++ b/sources/shiboken6/tests/samplebinding/child_return_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''The BlackBox class has cases of ownership transference between C++ and Python.''' diff --git a/sources/shiboken6/tests/samplebinding/class_fields_test.py b/sources/shiboken6/tests/samplebinding/class_fields_test.py index 1eeb3d446..63b8b8fa3 100644 --- a/sources/shiboken6/tests/samplebinding/class_fields_test.py +++ b/sources/shiboken6/tests/samplebinding/class_fields_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Simple test case for accessing the exposed C++ class fields.''' diff --git a/sources/shiboken6/tests/samplebinding/collector_test.py b/sources/shiboken6/tests/samplebinding/collector_test.py index 4caebc62a..dfde29ae7 100644 --- a/sources/shiboken6/tests/samplebinding/collector_test.py +++ b/sources/shiboken6/tests/samplebinding/collector_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Collector class' shift operators.''' diff --git a/sources/shiboken6/tests/samplebinding/complex_test.py b/sources/shiboken6/tests/samplebinding/complex_test.py index 454aff100..83e5c26d0 100644 --- a/sources/shiboken6/tests/samplebinding/complex_test.py +++ b/sources/shiboken6/tests/samplebinding/complex_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Complex class''' diff --git a/sources/shiboken6/tests/samplebinding/conversion_operator_test.py b/sources/shiboken6/tests/samplebinding/conversion_operator_test.py index 7e76245b1..aa30637e7 100644 --- a/sources/shiboken6/tests/samplebinding/conversion_operator_test.py +++ b/sources/shiboken6/tests/samplebinding/conversion_operator_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for implicit conversion generated by conversion operator.''' diff --git a/sources/shiboken6/tests/samplebinding/copy_test.py b/sources/shiboken6/tests/samplebinding/copy_test.py index db539d1b9..95437676d 100644 --- a/sources/shiboken6/tests/samplebinding/copy_test.py +++ b/sources/shiboken6/tests/samplebinding/copy_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for deep copy of objects''' diff --git a/sources/shiboken6/tests/samplebinding/ctorconvrule_test.py b/sources/shiboken6/tests/samplebinding/ctorconvrule_test.py index 5e2695d72..9381164cb 100644 --- a/sources/shiboken6/tests/samplebinding/ctorconvrule_test.py +++ b/sources/shiboken6/tests/samplebinding/ctorconvrule_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for proper generation of constructor altered by conversion-rule tag.''' diff --git a/sources/shiboken6/tests/samplebinding/cyclic_test.py b/sources/shiboken6/tests/samplebinding/cyclic_test.py index 4e4ae2603..95cc33375 100644 --- a/sources/shiboken6/tests/samplebinding/cyclic_test.py +++ b/sources/shiboken6/tests/samplebinding/cyclic_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/shiboken6/tests/samplebinding/date_test.py b/sources/shiboken6/tests/samplebinding/date_test.py index 2b6efcf18..48a9414c5 100644 --- a/sources/shiboken6/tests/samplebinding/date_test.py +++ b/sources/shiboken6/tests/samplebinding/date_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for python conversions types ''' diff --git a/sources/shiboken6/tests/samplebinding/decisor_test.py b/sources/shiboken6/tests/samplebinding/decisor_test.py index 0d39c5f96..9db6342a1 100644 --- a/sources/shiboken6/tests/samplebinding/decisor_test.py +++ b/sources/shiboken6/tests/samplebinding/decisor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for the method overload decisor.''' diff --git a/sources/shiboken6/tests/samplebinding/delete_test.py b/sources/shiboken6/tests/samplebinding/delete_test.py index 57a792ae2..09ad6f947 100644 --- a/sources/shiboken6/tests/samplebinding/delete_test.py +++ b/sources/shiboken6/tests/samplebinding/delete_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/deprecated_test.py b/sources/shiboken6/tests/samplebinding/deprecated_test.py index c371df94f..eafbd7c54 100644 --- a/sources/shiboken6/tests/samplebinding/deprecated_test.py +++ b/sources/shiboken6/tests/samplebinding/deprecated_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/derived_test.py b/sources/shiboken6/tests/samplebinding/derived_test.py index 346f29136..834d3416a 100644 --- a/sources/shiboken6/tests/samplebinding/derived_test.py +++ b/sources/shiboken6/tests/samplebinding/derived_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Derived class''' diff --git a/sources/shiboken6/tests/samplebinding/duck_punching_test.py b/sources/shiboken6/tests/samplebinding/duck_punching_test.py index aa21a0f7e..04fb0a7e0 100644 --- a/sources/shiboken6/tests/samplebinding/duck_punching_test.py +++ b/sources/shiboken6/tests/samplebinding/duck_punching_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for virtual methods.''' diff --git a/sources/shiboken6/tests/samplebinding/echo_test.py b/sources/shiboken6/tests/samplebinding/echo_test.py index f1859260e..b42abcf3f 100644 --- a/sources/shiboken6/tests/samplebinding/echo_test.py +++ b/sources/shiboken6/tests/samplebinding/echo_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for <add-function> with const char* as argument''' diff --git a/sources/shiboken6/tests/samplebinding/enum_test.py b/sources/shiboken6/tests/samplebinding/enum_test.py index 276b8d894..50bf4a61d 100644 --- a/sources/shiboken6/tests/samplebinding/enum_test.py +++ b/sources/shiboken6/tests/samplebinding/enum_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Python representation of C++ enums.''' diff --git a/sources/shiboken6/tests/samplebinding/enumfromremovednamespace_test.py b/sources/shiboken6/tests/samplebinding/enumfromremovednamespace_test.py index 42ae23961..f88d6c3d8 100644 --- a/sources/shiboken6/tests/samplebinding/enumfromremovednamespace_test.py +++ b/sources/shiboken6/tests/samplebinding/enumfromremovednamespace_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/event_loop_call_virtual_test.py b/sources/shiboken6/tests/samplebinding/event_loop_call_virtual_test.py index 8e13d5d46..c2b6200d0 100644 --- a/sources/shiboken6/tests/samplebinding/event_loop_call_virtual_test.py +++ b/sources/shiboken6/tests/samplebinding/event_loop_call_virtual_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Simple event loop dispatcher test.''' diff --git a/sources/shiboken6/tests/samplebinding/event_loop_thread_test.py b/sources/shiboken6/tests/samplebinding/event_loop_thread_test.py index 8b854fca6..5a8d32bce 100644 --- a/sources/shiboken6/tests/samplebinding/event_loop_thread_test.py +++ b/sources/shiboken6/tests/samplebinding/event_loop_thread_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os from random import random diff --git a/sources/shiboken6/tests/samplebinding/exception_test.py b/sources/shiboken6/tests/samplebinding/exception_test.py index d9e6b377f..95555b330 100644 --- a/sources/shiboken6/tests/samplebinding/exception_test.py +++ b/sources/shiboken6/tests/samplebinding/exception_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/filter_test.py b/sources/shiboken6/tests/samplebinding/filter_test.py index df805093f..a0c631a37 100644 --- a/sources/shiboken6/tests/samplebinding/filter_test.py +++ b/sources/shiboken6/tests/samplebinding/filter_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/handleholder_test.py b/sources/shiboken6/tests/samplebinding/handleholder_test.py index af22328c5..cddea4035 100644 --- a/sources/shiboken6/tests/samplebinding/handleholder_test.py +++ b/sources/shiboken6/tests/samplebinding/handleholder_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations ''' Test case for a class that holds a unknown handle object. Test case for BUG #1105. diff --git a/sources/shiboken6/tests/samplebinding/hashabletype_test.py b/sources/shiboken6/tests/samplebinding/hashabletype_test.py index c41f5cc06..4643f6103 100644 --- a/sources/shiboken6/tests/samplebinding/hashabletype_test.py +++ b/sources/shiboken6/tests/samplebinding/hashabletype_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for __hash__''' diff --git a/sources/shiboken6/tests/samplebinding/ignorederefop_test.py b/sources/shiboken6/tests/samplebinding/ignorederefop_test.py index feb78d045..1ee44ac59 100644 --- a/sources/shiboken6/tests/samplebinding/ignorederefop_test.py +++ b/sources/shiboken6/tests/samplebinding/ignorederefop_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/implicitconv_numerical_test.py b/sources/shiboken6/tests/samplebinding/implicitconv_numerical_test.py index 081666281..b114ad0c1 100644 --- a/sources/shiboken6/tests/samplebinding/implicitconv_numerical_test.py +++ b/sources/shiboken6/tests/samplebinding/implicitconv_numerical_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for inplicit converting C++ numeric types.''' diff --git a/sources/shiboken6/tests/samplebinding/implicitconv_test.py b/sources/shiboken6/tests/samplebinding/implicitconv_test.py index ebafe0c52..4dde6c786 100644 --- a/sources/shiboken6/tests/samplebinding/implicitconv_test.py +++ b/sources/shiboken6/tests/samplebinding/implicitconv_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for implicit conversions''' diff --git a/sources/shiboken6/tests/samplebinding/inheritanceandscope_test.py b/sources/shiboken6/tests/samplebinding/inheritanceandscope_test.py index 28d62486a..8305cd40b 100644 --- a/sources/shiboken6/tests/samplebinding/inheritanceandscope_test.py +++ b/sources/shiboken6/tests/samplebinding/inheritanceandscope_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for finding scope in cases involving inheritance.''' diff --git a/sources/shiboken6/tests/samplebinding/injectcode_test.py b/sources/shiboken6/tests/samplebinding/injectcode_test.py index f673a7807..933995100 100644 --- a/sources/shiboken6/tests/samplebinding/injectcode_test.py +++ b/sources/shiboken6/tests/samplebinding/injectcode_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for std::list container conversions''' diff --git a/sources/shiboken6/tests/samplebinding/innerclass_test.py b/sources/shiboken6/tests/samplebinding/innerclass_test.py index 721f33483..39e827a64 100644 --- a/sources/shiboken6/tests/samplebinding/innerclass_test.py +++ b/sources/shiboken6/tests/samplebinding/innerclass_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/intlist_test.py b/sources/shiboken6/tests/samplebinding/intlist_test.py index defa9ca71..813ff4126 100644 --- a/sources/shiboken6/tests/samplebinding/intlist_test.py +++ b/sources/shiboken6/tests/samplebinding/intlist_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/intwrapper_test.py b/sources/shiboken6/tests/samplebinding/intwrapper_test.py index d883adf47..04b2ff351 100644 --- a/sources/shiboken6/tests/samplebinding/intwrapper_test.py +++ b/sources/shiboken6/tests/samplebinding/intwrapper_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/invalid_virtual_return_test.py b/sources/shiboken6/tests/samplebinding/invalid_virtual_return_test.py index bb35b2bb1..d0bcd415d 100644 --- a/sources/shiboken6/tests/samplebinding/invalid_virtual_return_test.py +++ b/sources/shiboken6/tests/samplebinding/invalid_virtual_return_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for returning invalid types in a virtual function''' diff --git a/sources/shiboken6/tests/samplebinding/keep_reference_test.py b/sources/shiboken6/tests/samplebinding/keep_reference_test.py index 10591fec6..1c431763e 100644 --- a/sources/shiboken6/tests/samplebinding/keep_reference_test.py +++ b/sources/shiboken6/tests/samplebinding/keep_reference_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/list_test.py b/sources/shiboken6/tests/samplebinding/list_test.py index b668bfd90..4d113722f 100644 --- a/sources/shiboken6/tests/samplebinding/list_test.py +++ b/sources/shiboken6/tests/samplebinding/list_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for std::list container conversions''' diff --git a/sources/shiboken6/tests/samplebinding/lock_test.py b/sources/shiboken6/tests/samplebinding/lock_test.py index acd47634a..5ea6bf8d8 100644 --- a/sources/shiboken6/tests/samplebinding/lock_test.py +++ b/sources/shiboken6/tests/samplebinding/lock_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Simple test with a blocking C++ method that should allow python threads to run.''' diff --git a/sources/shiboken6/tests/samplebinding/map_test.py b/sources/shiboken6/tests/samplebinding/map_test.py index fa99ad2e7..fd319617a 100644 --- a/sources/shiboken6/tests/samplebinding/map_test.py +++ b/sources/shiboken6/tests/samplebinding/map_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for std::map container conversions''' diff --git a/sources/shiboken6/tests/samplebinding/metaclass_test.py b/sources/shiboken6/tests/samplebinding/metaclass_test.py index 4d7eeda96..c233e7e12 100644 --- a/sources/shiboken6/tests/samplebinding/metaclass_test.py +++ b/sources/shiboken6/tests/samplebinding/metaclass_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/mi_virtual_methods_test.py b/sources/shiboken6/tests/samplebinding/mi_virtual_methods_test.py index 8d324db59..c5043c8b3 100644 --- a/sources/shiboken6/tests/samplebinding/mi_virtual_methods_test.py +++ b/sources/shiboken6/tests/samplebinding/mi_virtual_methods_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for virtual methods in multiple inheritance scenarios''' diff --git a/sources/shiboken6/tests/samplebinding/mixed_mi_test.py b/sources/shiboken6/tests/samplebinding/mixed_mi_test.py index fa8481600..b3ee886d4 100644 --- a/sources/shiboken6/tests/samplebinding/mixed_mi_test.py +++ b/sources/shiboken6/tests/samplebinding/mixed_mi_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for multiple inheritance in mixed Python/C++ scenarios''' diff --git a/sources/shiboken6/tests/samplebinding/modelindex_test.py b/sources/shiboken6/tests/samplebinding/modelindex_test.py index e23503eff..786e4a727 100644 --- a/sources/shiboken6/tests/samplebinding/modelindex_test.py +++ b/sources/shiboken6/tests/samplebinding/modelindex_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/modelview_test.py b/sources/shiboken6/tests/samplebinding/modelview_test.py index b5663a04e..090c4f98b 100644 --- a/sources/shiboken6/tests/samplebinding/modelview_test.py +++ b/sources/shiboken6/tests/samplebinding/modelview_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for objects that keep references to other object without owning them (e.g. model/view relationships).''' diff --git a/sources/shiboken6/tests/samplebinding/modifications_test.py b/sources/shiboken6/tests/samplebinding/modifications_test.py index dced14396..ccd6747d7 100644 --- a/sources/shiboken6/tests/samplebinding/modifications_test.py +++ b/sources/shiboken6/tests/samplebinding/modifications_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for method modifications performed as described on type system. ''' diff --git a/sources/shiboken6/tests/samplebinding/modified_constructor_test.py b/sources/shiboken6/tests/samplebinding/modified_constructor_test.py index 9791a3491..8b99a557c 100644 --- a/sources/shiboken6/tests/samplebinding/modified_constructor_test.py +++ b/sources/shiboken6/tests/samplebinding/modified_constructor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests cases for ConstructorWithModifiedArgument class.''' diff --git a/sources/shiboken6/tests/samplebinding/modifiedvirtualmethods_test.py b/sources/shiboken6/tests/samplebinding/modifiedvirtualmethods_test.py index dcb487f1a..244820b6f 100644 --- a/sources/shiboken6/tests/samplebinding/modifiedvirtualmethods_test.py +++ b/sources/shiboken6/tests/samplebinding/modifiedvirtualmethods_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for modified virtual methods.''' diff --git a/sources/shiboken6/tests/samplebinding/multi_cpp_inheritance_test.py b/sources/shiboken6/tests/samplebinding/multi_cpp_inheritance_test.py index fc6b26c3f..53cda8a80 100644 --- a/sources/shiboken6/tests/samplebinding/multi_cpp_inheritance_test.py +++ b/sources/shiboken6/tests/samplebinding/multi_cpp_inheritance_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for multiple inheritance''' diff --git a/sources/shiboken6/tests/samplebinding/multiple_derived_test.py b/sources/shiboken6/tests/samplebinding/multiple_derived_test.py index 7497714a8..4b33cc63e 100644 --- a/sources/shiboken6/tests/samplebinding/multiple_derived_test.py +++ b/sources/shiboken6/tests/samplebinding/multiple_derived_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for multiple inheritance''' diff --git a/sources/shiboken6/tests/samplebinding/namespace_test.py b/sources/shiboken6/tests/samplebinding/namespace_test.py index 64a6792ac..0d0dc7f33 100644 --- a/sources/shiboken6/tests/samplebinding/namespace_test.py +++ b/sources/shiboken6/tests/samplebinding/namespace_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for std::map container conversions''' diff --git a/sources/shiboken6/tests/samplebinding/newdivision_test.py b/sources/shiboken6/tests/samplebinding/newdivision_test.py index 0e7dfbee1..3a5510e3a 100644 --- a/sources/shiboken6/tests/samplebinding/newdivision_test.py +++ b/sources/shiboken6/tests/samplebinding/newdivision_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/nondefaultctor_test.py b/sources/shiboken6/tests/samplebinding/nondefaultctor_test.py index bc8d29e50..3a2340bc7 100644 --- a/sources/shiboken6/tests/samplebinding/nondefaultctor_test.py +++ b/sources/shiboken6/tests/samplebinding/nondefaultctor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for ...''' diff --git a/sources/shiboken6/tests/samplebinding/nontypetemplate_test.py b/sources/shiboken6/tests/samplebinding/nontypetemplate_test.py index a10547728..257bd5ef7 100644 --- a/sources/shiboken6/tests/samplebinding/nontypetemplate_test.py +++ b/sources/shiboken6/tests/samplebinding/nontypetemplate_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations hasNumPy = False diff --git a/sources/shiboken6/tests/samplebinding/nonzero_test.py b/sources/shiboken6/tests/samplebinding/nonzero_test.py index 7be239fc4..8dded99df 100644 --- a/sources/shiboken6/tests/samplebinding/nonzero_test.py +++ b/sources/shiboken6/tests/samplebinding/nonzero_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/numericaltypedef_test.py b/sources/shiboken6/tests/samplebinding/numericaltypedef_test.py index f714a4fc8..50569b88c 100644 --- a/sources/shiboken6/tests/samplebinding/numericaltypedef_test.py +++ b/sources/shiboken6/tests/samplebinding/numericaltypedef_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/numpy_test.py b/sources/shiboken6/tests/samplebinding/numpy_test.py index 42094a463..2f02859a9 100644 --- a/sources/shiboken6/tests/samplebinding/numpy_test.py +++ b/sources/shiboken6/tests/samplebinding/numpy_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import sys diff --git a/sources/shiboken6/tests/samplebinding/objecttype_test.py b/sources/shiboken6/tests/samplebinding/objecttype_test.py index ead68ba13..73866e3a2 100644 --- a/sources/shiboken6/tests/samplebinding/objecttype_test.py +++ b/sources/shiboken6/tests/samplebinding/objecttype_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests ObjectType class of object-type with privates copy constructor and = operator.''' diff --git a/sources/shiboken6/tests/samplebinding/objecttype_with_named_args_test.py b/sources/shiboken6/tests/samplebinding/objecttype_with_named_args_test.py index 285e2313b..add9f947f 100644 --- a/sources/shiboken6/tests/samplebinding/objecttype_with_named_args_test.py +++ b/sources/shiboken6/tests/samplebinding/objecttype_with_named_args_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/objecttypebyvalue_test.py b/sources/shiboken6/tests/samplebinding/objecttypebyvalue_test.py index 8f74af3ab..ab8f18ba6 100644 --- a/sources/shiboken6/tests/samplebinding/objecttypebyvalue_test.py +++ b/sources/shiboken6/tests/samplebinding/objecttypebyvalue_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/objecttypelayout_test.py b/sources/shiboken6/tests/samplebinding/objecttypelayout_test.py index 677b89281..9f6012164 100644 --- a/sources/shiboken6/tests/samplebinding/objecttypelayout_test.py +++ b/sources/shiboken6/tests/samplebinding/objecttypelayout_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests cases for ObjectTypeLayout class.''' diff --git a/sources/shiboken6/tests/samplebinding/objecttypeoperators_test.py b/sources/shiboken6/tests/samplebinding/objecttypeoperators_test.py index ceeee6c8d..3123c7b61 100644 --- a/sources/shiboken6/tests/samplebinding/objecttypeoperators_test.py +++ b/sources/shiboken6/tests/samplebinding/objecttypeoperators_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py b/sources/shiboken6/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py index 5fa6f824e..370c5c8f7 100644 --- a/sources/shiboken6/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py +++ b/sources/shiboken6/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/oddbool_test.py b/sources/shiboken6/tests/samplebinding/oddbool_test.py index 87a8cdb1f..31db7bc6f 100644 --- a/sources/shiboken6/tests/samplebinding/oddbool_test.py +++ b/sources/shiboken6/tests/samplebinding/oddbool_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for OddBool user's primitive type conversion.''' diff --git a/sources/shiboken6/tests/samplebinding/onlycopyclass_test.py b/sources/shiboken6/tests/samplebinding/onlycopyclass_test.py index bcb154c52..5a26b5096 100644 --- a/sources/shiboken6/tests/samplebinding/onlycopyclass_test.py +++ b/sources/shiboken6/tests/samplebinding/onlycopyclass_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/overflow_test.py b/sources/shiboken6/tests/samplebinding/overflow_test.py index 84442306a..6dbce0f94 100644 --- a/sources/shiboken6/tests/samplebinding/overflow_test.py +++ b/sources/shiboken6/tests/samplebinding/overflow_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for overflowing C++ numeric types.''' diff --git a/sources/shiboken6/tests/samplebinding/overload_sorting_test.py b/sources/shiboken6/tests/samplebinding/overload_sorting_test.py index 060d91510..462a44eff 100644 --- a/sources/shiboken6/tests/samplebinding/overload_sorting_test.py +++ b/sources/shiboken6/tests/samplebinding/overload_sorting_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for overload sorting''' diff --git a/sources/shiboken6/tests/samplebinding/overload_test.py b/sources/shiboken6/tests/samplebinding/overload_test.py index 62fa8d8d2..f87e4ef57 100644 --- a/sources/shiboken6/tests/samplebinding/overload_test.py +++ b/sources/shiboken6/tests/samplebinding/overload_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Overload class''' diff --git a/sources/shiboken6/tests/samplebinding/overloadwithdefault_test.py b/sources/shiboken6/tests/samplebinding/overloadwithdefault_test.py index 269b97299..c55443529 100644 --- a/sources/shiboken6/tests/samplebinding/overloadwithdefault_test.py +++ b/sources/shiboken6/tests/samplebinding/overloadwithdefault_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/ownership_argument_invalidation_test.py b/sources/shiboken6/tests/samplebinding/ownership_argument_invalidation_test.py index 8a55d3ab8..5233571ed 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_argument_invalidation_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_argument_invalidation_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Wrapper validity tests for arguments.''' diff --git a/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_cpp_test.py b/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_cpp_test.py index 25c6fea26..5943c4437 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_cpp_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_cpp_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for destroy a child object in C++''' diff --git a/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_python_test.py b/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_python_test.py index 3ae186815..93df51773 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_python_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_delete_child_in_python_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for deleting a child object in python''' diff --git a/sources/shiboken6/tests/samplebinding/ownership_delete_parent_test.py b/sources/shiboken6/tests/samplebinding/ownership_delete_parent_test.py index 8f654639c..758ba8351 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_delete_parent_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_delete_parent_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for destroying the parent''' diff --git a/sources/shiboken6/tests/samplebinding/ownership_invalidate_after_use_test.py b/sources/shiboken6/tests/samplebinding/ownership_invalidate_after_use_test.py index 37b7591e4..b62cf5e31 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_invalidate_after_use_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_invalidate_after_use_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Ownership tests for cases of invalidation of Python wrapper after use.''' diff --git a/sources/shiboken6/tests/samplebinding/ownership_invalidate_child_test.py b/sources/shiboken6/tests/samplebinding/ownership_invalidate_child_test.py index 77b7c576c..40011a0cb 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_invalidate_child_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_invalidate_child_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for invalidating a C++ created child that was already on the care of a parent.''' diff --git a/sources/shiboken6/tests/samplebinding/ownership_invalidate_nonpolymorphic_test.py b/sources/shiboken6/tests/samplebinding/ownership_invalidate_nonpolymorphic_test.py index 8cbefc30c..d69fc3f1c 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_invalidate_nonpolymorphic_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_invalidate_nonpolymorphic_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''The BlackBox class has cases of ownership transference between Python and C++.''' diff --git a/sources/shiboken6/tests/samplebinding/ownership_invalidate_parent_test.py b/sources/shiboken6/tests/samplebinding/ownership_invalidate_parent_test.py index c721a212c..8238876af 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_invalidate_parent_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_invalidate_parent_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for invalidating a parent of other objects.''' diff --git a/sources/shiboken6/tests/samplebinding/ownership_reparenting_test.py b/sources/shiboken6/tests/samplebinding/ownership_reparenting_test.py index 304223063..ecb291123 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_reparenting_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_reparenting_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests for object reparenting.''' diff --git a/sources/shiboken6/tests/samplebinding/ownership_transference_test.py b/sources/shiboken6/tests/samplebinding/ownership_transference_test.py index 0e9f08b72..c22d29a1c 100644 --- a/sources/shiboken6/tests/samplebinding/ownership_transference_test.py +++ b/sources/shiboken6/tests/samplebinding/ownership_transference_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''The BlackBox class has cases of ownership transference between C++ and Python.''' diff --git a/sources/shiboken6/tests/samplebinding/pair_test.py b/sources/shiboken6/tests/samplebinding/pair_test.py index 4bd5c697c..2770dd3a4 100644 --- a/sources/shiboken6/tests/samplebinding/pair_test.py +++ b/sources/shiboken6/tests/samplebinding/pair_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for std::pair container conversions''' diff --git a/sources/shiboken6/tests/samplebinding/pen_test.py b/sources/shiboken6/tests/samplebinding/pen_test.py index 106f3bd61..922676f84 100644 --- a/sources/shiboken6/tests/samplebinding/pen_test.py +++ b/sources/shiboken6/tests/samplebinding/pen_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for <add-function> with const char* as argument''' diff --git a/sources/shiboken6/tests/samplebinding/point_test.py b/sources/shiboken6/tests/samplebinding/point_test.py index f86c0f423..301fe1ab8 100644 --- a/sources/shiboken6/tests/samplebinding/point_test.py +++ b/sources/shiboken6/tests/samplebinding/point_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for Point class''' diff --git a/sources/shiboken6/tests/samplebinding/pointerholder_test.py b/sources/shiboken6/tests/samplebinding/pointerholder_test.py index 633525a9c..0c1316095 100644 --- a/sources/shiboken6/tests/samplebinding/pointerholder_test.py +++ b/sources/shiboken6/tests/samplebinding/pointerholder_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for a class that holds an arbitraty pointer and is modified to hold an PyObject.''' diff --git a/sources/shiboken6/tests/samplebinding/pointerprimitivetype_test.py b/sources/shiboken6/tests/samplebinding/pointerprimitivetype_test.py index 4da1a89c6..4bfe125cd 100644 --- a/sources/shiboken6/tests/samplebinding/pointerprimitivetype_test.py +++ b/sources/shiboken6/tests/samplebinding/pointerprimitivetype_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ pointerprimitivetype_test.py diff --git a/sources/shiboken6/tests/samplebinding/pointf_test.py b/sources/shiboken6/tests/samplebinding/pointf_test.py index 91c58eb1d..6190dca1f 100644 --- a/sources/shiboken6/tests/samplebinding/pointf_test.py +++ b/sources/shiboken6/tests/samplebinding/pointf_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for PointF class''' diff --git a/sources/shiboken6/tests/samplebinding/primitivereferenceargument_test.py b/sources/shiboken6/tests/samplebinding/primitivereferenceargument_test.py index 0b9fe2249..19042f614 100644 --- a/sources/shiboken6/tests/samplebinding/primitivereferenceargument_test.py +++ b/sources/shiboken6/tests/samplebinding/primitivereferenceargument_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/privatector_test.py b/sources/shiboken6/tests/samplebinding/privatector_test.py index 63040388d..df7ee402b 100644 --- a/sources/shiboken6/tests/samplebinding/privatector_test.py +++ b/sources/shiboken6/tests/samplebinding/privatector_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for a class with only a private constructor.''' diff --git a/sources/shiboken6/tests/samplebinding/privatedtor_test.py b/sources/shiboken6/tests/samplebinding/privatedtor_test.py index 651f63b15..df1bd90f4 100644 --- a/sources/shiboken6/tests/samplebinding/privatedtor_test.py +++ b/sources/shiboken6/tests/samplebinding/privatedtor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for a class with a private destructor.''' diff --git a/sources/shiboken6/tests/samplebinding/protected_test.py b/sources/shiboken6/tests/samplebinding/protected_test.py index e4ccf721d..05f72b673 100644 --- a/sources/shiboken6/tests/samplebinding/protected_test.py +++ b/sources/shiboken6/tests/samplebinding/protected_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for protected methods.''' diff --git a/sources/shiboken6/tests/samplebinding/pstrlist_test.py b/sources/shiboken6/tests/samplebinding/pstrlist_test.py index d60f9cf35..d4e4c8316 100644 --- a/sources/shiboken6/tests/samplebinding/pstrlist_test.py +++ b/sources/shiboken6/tests/samplebinding/pstrlist_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/pystr_test.py b/sources/shiboken6/tests/samplebinding/pystr_test.py index ec64c1e31..f7b4656bb 100644 --- a/sources/shiboken6/tests/samplebinding/pystr_test.py +++ b/sources/shiboken6/tests/samplebinding/pystr_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for definition of __str__ method.''' diff --git a/sources/shiboken6/tests/samplebinding/python_thread_test.py b/sources/shiboken6/tests/samplebinding/python_thread_test.py index 65398b5c6..2cee34947 100644 --- a/sources/shiboken6/tests/samplebinding/python_thread_test.py +++ b/sources/shiboken6/tests/samplebinding/python_thread_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations #!/usr/bin/env python diff --git a/sources/shiboken6/tests/samplebinding/receive_null_cstring_test.py b/sources/shiboken6/tests/samplebinding/receive_null_cstring_test.py index 1d19de941..686a2435a 100644 --- a/sources/shiboken6/tests/samplebinding/receive_null_cstring_test.py +++ b/sources/shiboken6/tests/samplebinding/receive_null_cstring_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for a function that could receive a NULL pointer in a '[const] char*' parameter.''' diff --git a/sources/shiboken6/tests/samplebinding/reference_test.py b/sources/shiboken6/tests/samplebinding/reference_test.py index 1b6dd3a7a..ab5387ccb 100644 --- a/sources/shiboken6/tests/samplebinding/reference_test.py +++ b/sources/shiboken6/tests/samplebinding/reference_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for methods that receive references to objects.''' diff --git a/sources/shiboken6/tests/samplebinding/referencetopointer_test.py b/sources/shiboken6/tests/samplebinding/referencetopointer_test.py index 942c7ea29..3c614ba18 100644 --- a/sources/shiboken6/tests/samplebinding/referencetopointer_test.py +++ b/sources/shiboken6/tests/samplebinding/referencetopointer_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for a reference to pointer argument type.''' diff --git a/sources/shiboken6/tests/samplebinding/renaming_test.py b/sources/shiboken6/tests/samplebinding/renaming_test.py index b08438ef3..597763643 100644 --- a/sources/shiboken6/tests/samplebinding/renaming_test.py +++ b/sources/shiboken6/tests/samplebinding/renaming_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for renaming using target-lang-name attribute.''' diff --git a/sources/shiboken6/tests/samplebinding/return_null_test.py b/sources/shiboken6/tests/samplebinding/return_null_test.py index 2c4f07c65..92341e015 100644 --- a/sources/shiboken6/tests/samplebinding/return_null_test.py +++ b/sources/shiboken6/tests/samplebinding/return_null_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for functions that could return a NULL pointer.''' diff --git a/sources/shiboken6/tests/samplebinding/richcompare_test.py b/sources/shiboken6/tests/samplebinding/richcompare_test.py index 3146d0faf..decd8f3b9 100644 --- a/sources/shiboken6/tests/samplebinding/richcompare_test.py +++ b/sources/shiboken6/tests/samplebinding/richcompare_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/sample_test.py b/sources/shiboken6/tests/samplebinding/sample_test.py index 19b2f708d..2e11bebe4 100644 --- a/sources/shiboken6/tests/samplebinding/sample_test.py +++ b/sources/shiboken6/tests/samplebinding/sample_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for libsample bindings module''' diff --git a/sources/shiboken6/tests/samplebinding/simplefile_test.py b/sources/shiboken6/tests/samplebinding/simplefile_test.py index 55c894a35..6b6dccac7 100644 --- a/sources/shiboken6/tests/samplebinding/simplefile_test.py +++ b/sources/shiboken6/tests/samplebinding/simplefile_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for SimpleFile class''' diff --git a/sources/shiboken6/tests/samplebinding/size_test.py b/sources/shiboken6/tests/samplebinding/size_test.py index 069ce59b3..d6561faf0 100644 --- a/sources/shiboken6/tests/samplebinding/size_test.py +++ b/sources/shiboken6/tests/samplebinding/size_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for operator overloads on Size class''' diff --git a/sources/shiboken6/tests/samplebinding/snakecase_test.py b/sources/shiboken6/tests/samplebinding/snakecase_test.py index a1538796a..2c2812498 100644 --- a/sources/shiboken6/tests/samplebinding/snakecase_test.py +++ b/sources/shiboken6/tests/samplebinding/snakecase_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for snake case generation''' diff --git a/sources/shiboken6/tests/samplebinding/static_nonstatic_methods_test.py b/sources/shiboken6/tests/samplebinding/static_nonstatic_methods_test.py index cf0889299..ac05375fd 100644 --- a/sources/shiboken6/tests/samplebinding/static_nonstatic_methods_test.py +++ b/sources/shiboken6/tests/samplebinding/static_nonstatic_methods_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for overloads involving static and non-static versions of a method.''' diff --git a/sources/shiboken6/tests/samplebinding/stdcomplex_test.py b/sources/shiboken6/tests/samplebinding/stdcomplex_test.py index 0caa9764d..2de954ff2 100644 --- a/sources/shiboken6/tests/samplebinding/stdcomplex_test.py +++ b/sources/shiboken6/tests/samplebinding/stdcomplex_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for StdComplex class''' diff --git a/sources/shiboken6/tests/samplebinding/str_test.py b/sources/shiboken6/tests/samplebinding/str_test.py index c06fd6428..a30a79e96 100644 --- a/sources/shiboken6/tests/samplebinding/str_test.py +++ b/sources/shiboken6/tests/samplebinding/str_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for a method that receives a reference to class that is implicitly convertible from a Python native type.''' diff --git a/sources/shiboken6/tests/samplebinding/strlist_test.py b/sources/shiboken6/tests/samplebinding/strlist_test.py index 2bfb80b67..d141714d3 100644 --- a/sources/shiboken6/tests/samplebinding/strlist_test.py +++ b/sources/shiboken6/tests/samplebinding/strlist_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for StrList class that inherits from std::list<Str>.''' diff --git a/sources/shiboken6/tests/samplebinding/templateinheritingclass_test.py b/sources/shiboken6/tests/samplebinding/templateinheritingclass_test.py index 11279c7ec..f16d947aa 100644 --- a/sources/shiboken6/tests/samplebinding/templateinheritingclass_test.py +++ b/sources/shiboken6/tests/samplebinding/templateinheritingclass_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/time_test.py b/sources/shiboken6/tests/samplebinding/time_test.py index 6283a6744..2eb2ca498 100644 --- a/sources/shiboken6/tests/samplebinding/time_test.py +++ b/sources/shiboken6/tests/samplebinding/time_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for constructor and method signature decisor on Time class.''' diff --git a/sources/shiboken6/tests/samplebinding/transform_test.py b/sources/shiboken6/tests/samplebinding/transform_test.py index 7dfd18a4a..e9897c8f8 100644 --- a/sources/shiboken6/tests/samplebinding/transform_test.py +++ b/sources/shiboken6/tests/samplebinding/transform_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for argument modification with more than nine arguments.''' diff --git a/sources/shiboken6/tests/samplebinding/typeconverters_test.py b/sources/shiboken6/tests/samplebinding/typeconverters_test.py index 987ba6dfd..049b17f65 100644 --- a/sources/shiboken6/tests/samplebinding/typeconverters_test.py +++ b/sources/shiboken6/tests/samplebinding/typeconverters_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Tests various usages of the type converters.''' diff --git a/sources/shiboken6/tests/samplebinding/typedealloc_test.py b/sources/shiboken6/tests/samplebinding/typedealloc_test.py index ce881e802..468095af7 100644 --- a/sources/shiboken6/tests/samplebinding/typedealloc_test.py +++ b/sources/shiboken6/tests/samplebinding/typedealloc_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test deallocation of type extended in Python.''' diff --git a/sources/shiboken6/tests/samplebinding/typedtordoublefree_test.py b/sources/shiboken6/tests/samplebinding/typedtordoublefree_test.py index ab8e535b5..36ff7ddf4 100644 --- a/sources/shiboken6/tests/samplebinding/typedtordoublefree_test.py +++ b/sources/shiboken6/tests/samplebinding/typedtordoublefree_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/typesystypedef_test.py b/sources/shiboken6/tests/samplebinding/typesystypedef_test.py index f7f5342ee..76047e0dd 100644 --- a/sources/shiboken6/tests/samplebinding/typesystypedef_test.py +++ b/sources/shiboken6/tests/samplebinding/typesystypedef_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for a class that holds a void pointer.''' diff --git a/sources/shiboken6/tests/samplebinding/unsafe_parent_test.py b/sources/shiboken6/tests/samplebinding/unsafe_parent_test.py index 2a7e5cac7..822ee0d3b 100644 --- a/sources/shiboken6/tests/samplebinding/unsafe_parent_test.py +++ b/sources/shiboken6/tests/samplebinding/unsafe_parent_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for ...''' diff --git a/sources/shiboken6/tests/samplebinding/useraddedctor_test.py b/sources/shiboken6/tests/samplebinding/useraddedctor_test.py index 45d4095b6..4632e5e04 100644 --- a/sources/shiboken6/tests/samplebinding/useraddedctor_test.py +++ b/sources/shiboken6/tests/samplebinding/useraddedctor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for user added constructors''' diff --git a/sources/shiboken6/tests/samplebinding/virtualdtor_test.py b/sources/shiboken6/tests/samplebinding/virtualdtor_test.py index 6be870269..14a970297 100644 --- a/sources/shiboken6/tests/samplebinding/virtualdtor_test.py +++ b/sources/shiboken6/tests/samplebinding/virtualdtor_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for virtual destructor.''' diff --git a/sources/shiboken6/tests/samplebinding/virtualmethods_test.py b/sources/shiboken6/tests/samplebinding/virtualmethods_test.py index 52dc66c90..b5896f3a5 100644 --- a/sources/shiboken6/tests/samplebinding/virtualmethods_test.py +++ b/sources/shiboken6/tests/samplebinding/virtualmethods_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test cases for virtual methods.''' diff --git a/sources/shiboken6/tests/samplebinding/visibilitychange_test.py b/sources/shiboken6/tests/samplebinding/visibilitychange_test.py index becdf7423..12c2f3abb 100644 --- a/sources/shiboken6/tests/samplebinding/visibilitychange_test.py +++ b/sources/shiboken6/tests/samplebinding/visibilitychange_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/samplebinding/voidholder_test.py b/sources/shiboken6/tests/samplebinding/voidholder_test.py index 186cb473e..f1f2a1182 100644 --- a/sources/shiboken6/tests/samplebinding/voidholder_test.py +++ b/sources/shiboken6/tests/samplebinding/voidholder_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test case for a class that holds a void pointer.''' diff --git a/sources/shiboken6/tests/samplebinding/weakref_test.py b/sources/shiboken6/tests/samplebinding/weakref_test.py index 01c6d58d5..645174a8f 100644 --- a/sources/shiboken6/tests/samplebinding/weakref_test.py +++ b/sources/shiboken6/tests/samplebinding/weakref_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations '''Test weakref support''' diff --git a/sources/shiboken6/tests/samplebinding/writableclassdict_test.py b/sources/shiboken6/tests/samplebinding/writableclassdict_test.py index dfc962db9..2d8b69bc4 100644 --- a/sources/shiboken6/tests/samplebinding/writableclassdict_test.py +++ b/sources/shiboken6/tests/samplebinding/writableclassdict_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/shiboken_paths.py b/sources/shiboken6/tests/shiboken_paths.py index 3ec940f2e..54b284ef6 100644 --- a/sources/shiboken6/tests/shiboken_paths.py +++ b/sources/shiboken6/tests/shiboken_paths.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os diff --git a/sources/shiboken6/tests/shiboken_test_helper.py b/sources/shiboken6/tests/shiboken_test_helper.py index 14fe6a2d1..2c7ad4d09 100644 --- a/sources/shiboken6/tests/shiboken_test_helper.py +++ b/sources/shiboken6/tests/shiboken_test_helper.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations def objectFullname(t): diff --git a/sources/shiboken6/tests/shibokenmodule/module_test.py b/sources/shiboken6/tests/shibokenmodule/module_test.py index 9f9f8f5a4..fe12a5e65 100644 --- a/sources/shiboken6/tests/shibokenmodule/module_test.py +++ b/sources/shiboken6/tests/shibokenmodule/module_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/smartbinding/CMakeLists.txt b/sources/shiboken6/tests/smartbinding/CMakeLists.txt index 2e729321e..594744840 100644 --- a/sources/shiboken6/tests/smartbinding/CMakeLists.txt +++ b/sources/shiboken6/tests/smartbinding/CMakeLists.txt @@ -18,8 +18,10 @@ ${CMAKE_CURRENT_BINARY_DIR}/smart/smart_integer2_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/smart/sharedptr_integer2_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/smart/stdsharedptrtestbench_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/smart/stdsharedptrvirtualmethodtester_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/smart/std_shared_ptr_double_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/smart/std_shared_ptr_integer_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/smart/std_shared_ptr_int_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/smart/std_shared_ptr_std_string_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/smart/std_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/smart/std_optional_int_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/smart/std_optional_integer_wrapper.cpp diff --git a/sources/shiboken6/tests/smartbinding/smart_pointer_test.py b/sources/shiboken6/tests/smartbinding/smart_pointer_test.py index 8d4272558..1c35a3e01 100644 --- a/sources/shiboken6/tests/smartbinding/smart_pointer_test.py +++ b/sources/shiboken6/tests/smartbinding/smart_pointer_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import gc import os diff --git a/sources/shiboken6/tests/smartbinding/std_optional_test.py b/sources/shiboken6/tests/smartbinding/std_optional_test.py index bee573548..cd97facfa 100644 --- a/sources/shiboken6/tests/smartbinding/std_optional_test.py +++ b/sources/shiboken6/tests/smartbinding/std_optional_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/smartbinding/std_shared_ptr_test.py b/sources/shiboken6/tests/smartbinding/std_shared_ptr_test.py index 2e6aea3d9..a46dd2b24 100644 --- a/sources/shiboken6/tests/smartbinding/std_shared_ptr_test.py +++ b/sources/shiboken6/tests/smartbinding/std_shared_ptr_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys @@ -10,7 +11,7 @@ from pathlib import Path sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from shiboken_paths import init_paths init_paths() -from smart import Integer, StdSharedPtrTestBench, StdSharedPtrVirtualMethodTester, std +from smart import Integer, StdDoublePtr, StdSharedPtrTestBench, StdSharedPtrVirtualMethodTester, std def call_func_on_ptr(ptr): @@ -49,6 +50,24 @@ class StdSharedPtrTests(unittest.TestCase): self.assertFalse(np) p = StdSharedPtrTestBench.createInt() StdSharedPtrTestBench.printInt(p) + ip = std.StdIntPtr(42) + StdSharedPtrTestBench.printInt(ip) + + def testDouble(self): + np = StdSharedPtrTestBench.createNullDouble() + StdSharedPtrTestBench.printDouble(np) + self.assertFalse(np) + p = StdSharedPtrTestBench.createDouble(67) + StdSharedPtrTestBench.printDouble(p) + dp = StdDoublePtr(42) + StdSharedPtrTestBench.printDouble(dp) + + def testString(self): + np = StdSharedPtrTestBench.createNullString() + StdSharedPtrTestBench.printString(np) + self.assertFalse(np) + p = StdSharedPtrTestBench.createString("bla") + StdSharedPtrTestBench.printString(p) def testVirtuals(self): """Test whether code generating virtual function overrides is generated diff --git a/sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py b/sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py index 9c7ef2f01..8e1ae80d9 100644 --- a/sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py +++ b/sources/shiboken6/tests/smartbinding/std_unique_ptr_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import os import sys diff --git a/sources/shiboken6/tests/smartbinding/typesystem_smart.xml b/sources/shiboken6/tests/smartbinding/typesystem_smart.xml index 261d5f15d..e479e4ddf 100644 --- a/sources/shiboken6/tests/smartbinding/typesystem_smart.xml +++ b/sources/shiboken6/tests/smartbinding/typesystem_smart.xml @@ -50,7 +50,7 @@ value-check-method="operator bool" ref-count-method="use_count" reset-method="reset" - instantiations="Integer,int"> + instantiations="Integer,int=StdIntPtr,double=::StdDoublePtr,std::string"> <include file-name="memory" location="global"/> </smart-pointer-type> diff --git a/testing/__init__.py b/testing/__init__.py index 62614c438..8608eabdf 100644 --- a/testing/__init__.py +++ b/testing/__init__.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ testing/__init__.py diff --git a/testing/blacklist.py b/testing/blacklist.py index eacb51cbb..513b511c5 100644 --- a/testing/blacklist.py +++ b/testing/blacklist.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ testing/blacklist.py diff --git a/testing/buildlog.py b/testing/buildlog.py index f82191f91..7bff6a201 100644 --- a/testing/buildlog.py +++ b/testing/buildlog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ testing/buildlog.py diff --git a/testing/command.py b/testing/command.py index 31a48f87c..d073e6fb1 100644 --- a/testing/command.py +++ b/testing/command.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ testrunner diff --git a/testing/helper.py b/testing/helper.py index d89f0d849..a6a2a0c31 100644 --- a/testing/helper.py +++ b/testing/helper.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ testing/helper.py diff --git a/testing/parser.py b/testing/parser.py index a01c4d029..cc889021c 100644 --- a/testing/parser.py +++ b/testing/parser.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import re diff --git a/testing/runner.py b/testing/runner.py index b52ac4937..198f760ce 100644 --- a/testing/runner.py +++ b/testing/runner.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import inspect import os diff --git a/testing/wheel_tester.py b/testing/wheel_tester.py index b36ee55a4..81f6c4a7b 100644 --- a/testing/wheel_tester.py +++ b/testing/wheel_tester.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ This script is used by Coin (coin_test_instructions.py specifically) to diff --git a/testrunner.py b/testrunner.py index 3c2ec428a..3e3355e05 100644 --- a/testrunner.py +++ b/testrunner.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ testrunner.py diff --git a/tools/checklibs.py b/tools/checklibs.py index 9a53beade..61499bc04 100644 --- a/tools/checklibs.py +++ b/tools/checklibs.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations #!/usr/bin/env python # diff --git a/tools/create_changelog.py b/tools/create_changelog.py index 6c24f417f..6e3e3b1f7 100644 --- a/tools/create_changelog.py +++ b/tools/create_changelog.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import re import os @@ -8,7 +9,6 @@ import textwrap from argparse import ArgumentParser, Namespace, RawTextHelpFormatter from pathlib import Path from subprocess import PIPE, Popen, check_output -from typing import Dict, List, Tuple content_header = """Qt for Python @VERSION is a @TYPE release. @@ -183,7 +183,7 @@ def get_commit_content(sha: str) -> str: return out.decode("utf-8") -def git_get_sha1s(versions: List[str], pattern: str): +def git_get_sha1s(versions: list[str], pattern: str): """Return a list of SHA1s matching a pattern""" command = "git rev-list --reverse --grep '^{}'".format(pattern) command += " {}..{}".format(versions[0], versions[1]) @@ -213,7 +213,7 @@ def git_get_sha1s(versions: List[str], pattern: str): return [s.decode("utf-8") for s in out_sha1.splitlines() if s not in pick_to_sha1] -def git_command(versions: List[str], pattern: str): +def git_command(versions: list[str], pattern: str): task_number_re = re.compile(r'^.*-(\d+)\s*$') for sha in git_get_sha1s(versions, pattern): content = get_commit_content(sha).splitlines() @@ -241,15 +241,15 @@ def git_command(versions: List[str], pattern: str): pyside6_commits[sha] = entry -def create_fixes_log(versions: List[str]) -> None: +def create_fixes_log(versions: list[str]) -> None: git_command(versions, "Fixes: ") -def create_task_log(versions: List[str]) -> None: +def create_task_log(versions: list[str]) -> None: git_command(versions, "Task-number: ") -def extract_change_log(commit_message: List[str]) -> Tuple[str, int, str]: +def extract_change_log(commit_message: list[str]) -> tuple[str, int, str]: """Extract a tuple of (component, task-number, change log paragraph) from a commit message of the form [ChangeLog][shiboken6] description...""" result = '' @@ -284,7 +284,7 @@ def extract_change_log(commit_message: List[str]) -> Tuple[str, int, str]: return (component, task_nr_int, format_text(result)) -def create_change_log(versions: List[str]) -> None: +def create_change_log(versions: list[str]) -> None: for sha in git_get_sha1s(versions, r"\[ChangeLog\]"): change_log = extract_change_log(get_commit_content(sha).splitlines()) component, task_nr, text = change_log @@ -294,7 +294,7 @@ def create_change_log(versions: List[str]) -> None: pyside6_changelogs.append((task_nr, text)) -def format_commit_msg(entry: Dict[str, str]) -> str: +def format_commit_msg(entry: dict[str, str]) -> str: task = entry["task"].replace("Fixes: ", "").replace("Task-number: ", "") title = entry["title"] if title.startswith("shiboken6: "): @@ -304,27 +304,27 @@ def format_commit_msg(entry: Dict[str, str]) -> str: return format_text(f"[{task}] {title}") -def gen_list(d: Dict[str, Dict[str, str]]) -> str: +def gen_list(d: dict[str, dict[str, str]]) -> str: return "\n".join(format_commit_msg(v) for _, v in d.items()) -def sort_dict(d: Dict[str, Dict[str, str]]) -> Dict[str, Dict[str, str]]: +def sort_dict(d: dict[str, dict[str, str]]) -> dict[str, dict[str, str]]: return dict(sorted(d.items(), key=lambda kv: kv[1]['task-number'])) -def sort_changelog(c: List[Tuple[int, str]]) -> List[Tuple[int, str]]: +def sort_changelog(c: list[tuple[int, str]]) -> list[tuple[int, str]]: return sorted(c, key=lambda task_text_tuple: task_text_tuple[0]) if __name__ == "__main__": args = parse_options() - pyside6_commits: Dict[str, Dict[str, str]] = {} - shiboken6_commits: Dict[str, Dict[str, str]] = {} + pyside6_commits: dict[str, dict[str, str]] = {} + shiboken6_commits: dict[str, dict[str, str]] = {} # Changelogs are tuples of task number/formatted text - pyside6_changelogs: List[Tuple[int, str]] = [] - shiboken6_changelogs: List[Tuple[int, str]] = [] + pyside6_changelogs: list[tuple[int, str]] = [] + shiboken6_changelogs: list[tuple[int, str]] = [] exclude_pick_to = args.exclude diff --git a/tools/cross_compile_android/android_utilities.py b/tools/cross_compile_android/android_utilities.py index 039fa9431..7f2047a7e 100644 --- a/tools/cross_compile_android/android_utilities.py +++ b/tools/cross_compile_android/android_utilities.py @@ -1,8 +1,10 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import logging import shutil +import re import os import stat import sys @@ -10,16 +12,16 @@ import subprocess from urllib import request from pathlib import Path -from typing import List from packaging import version from tqdm import tqdm # the tag number does not matter much since we update the sdk later DEFAULT_SDK_TAG = 6514223 ANDROID_NDK_VERSION = "26b" +ANDROID_NDK_VERSION_NUMBER_SUFFIX = "10909125" -def run_command(command: List[str], cwd: str = None, ignore_fail: bool = False, +def run_command(command: list[str], cwd: str | None = None, ignore_fail: bool = False, dry_run: bool = False, accept_prompts: bool = False, show_stdout: bool = False, capture_stdout: bool = False): @@ -83,9 +85,9 @@ class SdkManager: accept_prompts=accept_license, show_stdout=show_stdout) -def _unpack(zip_file: Path, destination: Path): +def extract_zip(file: Path, destination: Path): """ - Unpacks the zip_file into destination preserving all permissions + Unpacks the zip file into destination preserving all permissions TODO: Try to use zipfile module. Currently we cannot use zipfile module here because extractAll() does not preserve permissions. @@ -97,10 +99,26 @@ def _unpack(zip_file: Path, destination: Path): raise RuntimeError("Unable to find program unzip. Use `sudo apt-get install unzip`" "to install it") - command = [unzip, zip_file, "-d", destination] + command = [unzip, file, "-d", destination] run_command(command=command, show_stdout=True) +def extract_dmg(file: Path, destination: Path): + output = run_command(['hdiutil', 'attach', '-nobrowse', '-readonly', file], + show_stdout=True, capture_stdout=True) + + # find the mounted volume + mounted_vol_name = re.search(r'/Volumes/(.*)', output).group(1) + if not mounted_vol_name: + raise RuntimeError(f"Unable to find mounted volume for file {file}") + + # copy files + shutil.copytree(f'/Volumes/{mounted_vol_name}/', destination, dirs_exist_ok=True) + + # Detach mounted volume + run_command(['hdiutil', 'detach', f'/Volumes/{mounted_vol_name}']) + + def _download(url: str, destination: Path): """ Download url to destination @@ -110,7 +128,6 @@ def _download(url: str, destination: Path): with DownloadProgressBar(unit='B', unit_scale=True, miniters=1, desc=url.split('/')[-1]) as t: download_path, headers = request.urlretrieve(url=url, filename=destination, reporthook=t.update_to) - assert headers["Content-Type"] == "application/zip" assert Path(download_path).resolve() == destination @@ -119,22 +136,40 @@ def download_android_ndk(ndk_path: Path): Downloads the given ndk_version into ndk_path """ ndk_path = ndk_path / "android-ndk" - ndk_zip_path = ndk_path / f"android-ndk-r{ANDROID_NDK_VERSION}-linux.zip" - ndk_version_path = ndk_path / f"android-ndk-r{ANDROID_NDK_VERSION}" + ndk_extension = "dmg" if sys.platform == "darwin" else "zip" + ndk_zip_path = ndk_path / f"android-ndk-r{ANDROID_NDK_VERSION}-{sys.platform}.{ndk_extension}" + ndk_version_path = "" + if sys.platform == "linux": + ndk_version_path = ndk_path / f"android-ndk-r{ANDROID_NDK_VERSION}" + elif sys.platform == "darwin": + ndk_version_path = (ndk_path + / f"AndroidNDK{ANDROID_NDK_VERSION_NUMBER_SUFFIX}.app/Contents/NDK") + else: + raise RuntimeError(f"Unsupported platform {sys.platform}") if ndk_version_path.exists(): print(f"NDK path found in {str(ndk_version_path)}") else: ndk_path.mkdir(parents=True, exist_ok=True) url = (f"https://dl.google.com/android/repository" - f"/android-ndk-r{ANDROID_NDK_VERSION}-linux.zip") + f"/android-ndk-r{ANDROID_NDK_VERSION}-{sys.platform}.{ndk_extension}") print(f"Downloading Android Ndk version r{ANDROID_NDK_VERSION}") _download(url=url, destination=ndk_zip_path) print("Unpacking Android Ndk") - _unpack(zip_file=(ndk_path / f"android-ndk-r{ANDROID_NDK_VERSION}-linux.zip"), - destination=ndk_path) + if sys.platform == "darwin": + extract_dmg(file=(ndk_path + / f"android-ndk-r{ANDROID_NDK_VERSION}-{sys.platform}.{ndk_extension}" + ), + destination=ndk_path) + ndk_version_path = (ndk_version_path + / f"AndroidNDK{ANDROID_NDK_VERSION_NUMBER_SUFFIX}.app/Contents/NDK") + else: + extract_zip(file=(ndk_path + / f"android-ndk-r{ANDROID_NDK_VERSION}-{sys.platform}.{ndk_extension}" + ), + destination=ndk_path) return ndk_version_path @@ -143,10 +178,12 @@ def download_android_commandlinetools(android_sdk_dir: Path): """ Downloads Android commandline tools into cltools_path. """ + sdk_platform = sys.platform if sys.platform != "darwin" else "mac" android_sdk_dir = android_sdk_dir / "android-sdk" url = ("https://dl.google.com/android/repository/" - f"commandlinetools-linux-{DEFAULT_SDK_TAG}_latest.zip") - cltools_zip_path = android_sdk_dir / f"commandlinetools-linux-{DEFAULT_SDK_TAG}_latest.zip" + f"commandlinetools-{sdk_platform}-{DEFAULT_SDK_TAG}_latest.zip") + cltools_zip_path = (android_sdk_dir + / f"commandlinetools-{sdk_platform}-{DEFAULT_SDK_TAG}_latest.zip") cltools_path = android_sdk_dir / "tools" if cltools_path.exists(): @@ -155,11 +192,11 @@ def download_android_commandlinetools(android_sdk_dir: Path): android_sdk_dir.mkdir(parents=True, exist_ok=True) print("Download Android Command Line Tools: " - f"commandlinetools-linux-{DEFAULT_SDK_TAG}_latest.zip") + f"commandlinetools-{sys.platform}-{DEFAULT_SDK_TAG}_latest.zip") _download(url=url, destination=cltools_zip_path) print("Unpacking Android Command Line Tools") - _unpack(zip_file=cltools_zip_path, destination=android_sdk_dir) + extract_zip(file=cltools_zip_path, destination=android_sdk_dir) return android_sdk_dir @@ -204,6 +241,10 @@ def find_latest_buildtools_version(sdk_manager: SdkManager): if not available_build_tools_v: raise RuntimeError('Unable to find any build tools available for download') + # find the latest build tools version that is not a release candidate + # release candidates end has rc in the version number + available_build_tools_v = [v for v in available_build_tools_v if "rc" not in str(v)] + return max(available_build_tools_v) diff --git a/tools/cross_compile_android/main.py b/tools/cross_compile_android/main.py index bda438cca..3a4ef8f67 100644 --- a/tools/cross_compile_android/main.py +++ b/tools/cross_compile_android/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys import logging @@ -18,6 +19,7 @@ from android_utilities import (run_command, download_android_commandlinetools, download_android_ndk, install_android_packages) # Note: Does not work with PyEnv. Your Host Python should contain openssl. +# also update the version in ShibokenHelpers.cmake if Python version changes. PYTHON_VERSION = "3.11" SKIP_UPDATE_HELP = ("skip the updation of SDK packages build-tools, platform-tools to" @@ -86,7 +88,8 @@ if __name__ == "__main__": parser.add_argument("-v", "--verbose", help="run in verbose mode", action="store_const", dest="loglevel", const=logging.INFO) - parser.add_argument("--api-level", type=str, default="33", help="Android API level to use") + parser.add_argument("--api-level", type=str, default="26", + help="Minimum Android API level to use") parser.add_argument("--ndk-path", type=str, help="Path to Android NDK (Preferred r25c)") # sdk path is needed to compile all the Qt Java Acitivity files into Qt6AndroidBindings.jar parser.add_argument("--sdk-path", type=str, help="Path to Android SDK") @@ -184,8 +187,8 @@ if __name__ == "__main__": platform_data = PlatformData("x86_64", api_level, "x86_64", "x86_64", "x86-64", "64") # python path is valid, if Python for android installation exists in python_path - python_path = (pyside6_deploy_cache / f"Python-{platform_data.plat_name}-linux-android" - / "_install") + python_path = (pyside6_deploy_cache + / f"Python-{platform_data.plat_name}-linux-android" / "_install") valid_python_path = python_path.exists() if Path(python_path).exists(): expected_dirs = ["lib", "include"] @@ -214,6 +217,10 @@ if __name__ == "__main__": ) if not python_ccompile_script.exists(): + host_system_config_name = run_command("./config.guess", cwd=cpython_dir, + dry_run=dry_run, show_stdout=True, + capture_stdout=True).strip() + # use jinja2 to create cross_compile.sh script template = environment.get_template("cross_compile.tmpl.sh") content = template.render( @@ -221,7 +228,10 @@ if __name__ == "__main__": ndk_path=ndk_path, api_level=platform_data.api_level, android_py_install_path_prefix=pyside6_deploy_cache, - host_python_path=sys.executable + host_python_path=sys.executable, + python_version=PYTHON_VERSION, + host_system_name=host_system_config_name, + host_platform_name=sys.platform ) logging.info(f"Writing Python cross compile script into {python_ccompile_script}") @@ -240,13 +250,6 @@ if __name__ == "__main__": run_command([f"./{python_ccompile_script.name}"], cwd=cpython_dir, dry_run=dry_run, show_stdout=True) - # run patchelf to change the SONAME of libpython from libpython3.x.so.1.0 to - # libpython3.x.so, to match with python_for_android's Python library. Otherwise, - # the Qfp binaries won't be able to link to Python - run_command(["patchelf", "--set-soname", f"libpython{PYTHON_VERSION}.so", - f"libpython{PYTHON_VERSION}.so.1.0"], cwd=Path(python_path) / "lib", - dry_run=dry_run) - logging.info( f"Cross compile Python for Android platform {platform_data.plat_name}. " f"Final installation in {python_path}" @@ -286,15 +289,22 @@ if __name__ == "__main__": # give run permission to cross compile script qfp_toolchain.chmod(qfp_toolchain.stat().st_mode | stat.S_IEXEC) + if sys.platform == "linux": + host_qt_install_suffix = "gcc_64" + elif sys.platform == "darwin": + host_qt_install_suffix = "macos" + else: + raise RuntimeError("Qt for Python cross compilation not supported on this platform") + # run the cross compile script logging.info(f"Running Qt for Python cross-compile for platform {platform_data.plat_name}") qfp_ccompile_cmd = [sys.executable, "setup.py", "bdist_wheel", "--parallel=9", "--standalone", f"--cmake-toolchain-file={str(qfp_toolchain.resolve())}", - f"--qt-host-path={qt_install_path}/gcc_64", + f"--qt-host-path={qt_install_path}/{host_qt_install_suffix}", f"--plat-name=android_{platform_data.plat_name}", f"--python-target-path={python_path}", (f"--qt-target-path={qt_install_path}/" - f"android_{platform_data.qt_plat_name}"), + f"android_{platform_data.qt_plat_name}"), "--no-qt-tools"] run_command(qfp_ccompile_cmd, cwd=pyside_setup_dir, dry_run=dry_run, show_stdout=True) diff --git a/tools/cross_compile_android/templates/cross_compile.tmpl.sh b/tools/cross_compile_android/templates/cross_compile.tmpl.sh index a68907591..784e822ca 100644 --- a/tools/cross_compile_android/templates/cross_compile.tmpl.sh +++ b/tools/cross_compile_android/templates/cross_compile.tmpl.sh @@ -3,7 +3,7 @@ # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only set -x -e export HOST_ARCH={{ plat_name }}-linux-android -export TOOLCHAIN={{ ndk_path }}/toolchains/llvm/prebuilt/linux-x86_64/bin +export TOOLCHAIN={{ ndk_path }}/toolchains/llvm/prebuilt/{{ host_platform_name }}-x86_64/bin export TOOL_PREFIX=$TOOLCHAIN/$HOST_ARCH export PLATFORM_API={{ api_level }} {% if plat_name == "armv7a" -%} @@ -20,10 +20,10 @@ export RANLIB=$TOOLCHAIN/llvm-ranlib export LD=$TOOLCHAIN/ld export READELF=$TOOLCHAIN/llvm-readelf export CFLAGS='-fPIC -DANDROID' -./configure --host=$HOST_ARCH --target=$HOST_ARCH --build=x86_64-pc-linux-gnu \ +./configure --host=$HOST_ARCH --target=$HOST_ARCH --build={{ host_system_name }} \ --with-build-python={{ host_python_path }} --enable-shared \ --enable-ipv6 ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no --without-ensurepip \ ac_cv_little_endian_double=yes -make BLDSHARED="$CC -shared" CROSS-COMPILE=$TOOL_PREFIX- CROSS_COMPILE_TARGET=yes -make install BLDSHARED="$CC -shared" CROSS-COMPILE=$TOOL_PREFIX- \ -CROSS_COMPILE_TARGET=yes prefix={{ android_py_install_path_prefix }}/Python-$HOST_ARCH/_install +make BLDSHARED="$CC -shared" CROSS-COMPILE=$TOOL_PREFIX- CROSS_COMPILE_TARGET=yes \ +INSTSONAME=libpython{{ python_version }}.so +make install prefix={{ android_py_install_path_prefix }}/Python-$HOST_ARCH/_install diff --git a/tools/debug_renamer.py b/tools/debug_renamer.py index ec777388b..cf9994b8f 100644 --- a/tools/debug_renamer.py +++ b/tools/debug_renamer.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations import re import sys diff --git a/tools/debug_windows.py b/tools/debug_windows.py index 832282895..70a3d402c 100644 --- a/tools/debug_windows.py +++ b/tools/debug_windows.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import argparse import ctypes diff --git a/tools/doc_modules.py b/tools/doc_modules.py index d46f4db02..3977bd69e 100644 --- a/tools/doc_modules.py +++ b/tools/doc_modules.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import subprocess diff --git a/tools/dump_metaobject.py b/tools/dump_metaobject.py index 6898e9317..baf659a6b 100644 --- a/tools/dump_metaobject.py +++ b/tools/dump_metaobject.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """Helper functions for formatting information on QMetaObject""" diff --git a/tools/example_gallery/main.py b/tools/example_gallery/main.py index b5aa632c0..16317d8cf 100644 --- a/tools/example_gallery/main.py +++ b/tools/example_gallery/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ diff --git a/tools/leak_finder.py b/tools/leak_finder.py index 8a21c2337..e5140c102 100644 --- a/tools/leak_finder.py +++ b/tools/leak_finder.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +from __future__ import annotations """ leak_finder.py diff --git a/tools/license_check.py b/tools/license_check.py index 4b12a05fd..0f9a19384 100644 --- a/tools/license_check.py +++ b/tools/license_check.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import subprocess diff --git a/tools/metaobject_dump.py b/tools/metaobject_dump.py index b6cde13ef..3bfcfe9c6 100644 --- a/tools/metaobject_dump.py +++ b/tools/metaobject_dump.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import sys diff --git a/tools/missing_bindings/config.py b/tools/missing_bindings/config.py index ddaf20685..66d843821 100644 --- a/tools/missing_bindings/config.py +++ b/tools/missing_bindings/config.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations modules_to_test = { # 6.0 diff --git a/tools/missing_bindings/main.py b/tools/missing_bindings/main.py index 4c223050d..fe637809e 100644 --- a/tools/missing_bindings/main.py +++ b/tools/missing_bindings/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations # This script is used to generate a summary of missing types / classes # which are present in C++ Qt6, but are missing in PySide6. diff --git a/tools/qtcpp2py.py b/tools/qtcpp2py.py index e4e381675..86c513859 100644 --- a/tools/qtcpp2py.py +++ b/tools/qtcpp2py.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import logging import os diff --git a/tools/regenerate_example_resources.py b/tools/regenerate_example_resources.py index 098c58b1f..90bc50eb3 100644 --- a/tools/regenerate_example_resources.py +++ b/tools/regenerate_example_resources.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ regenerate_example_resources.py diff --git a/tools/regenerate_example_ui.py b/tools/regenerate_example_ui.py index 2e0881c07..47f98a6a1 100644 --- a/tools/regenerate_example_ui.py +++ b/tools/regenerate_example_ui.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations """ regenerate_example_ui.py diff --git a/tools/scanqtclasses.py b/tools/scanqtclasses.py index 0f87d80bd..a74fe9594 100644 --- a/tools/scanqtclasses.py +++ b/tools/scanqtclasses.py @@ -1,5 +1,6 @@ # Copyright (C) 2024 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from pathlib import Path import os diff --git a/tools/snippets_translate/converter.py b/tools/snippets_translate/converter.py index d45bf277f..7179a94a0 100644 --- a/tools/snippets_translate/converter.py +++ b/tools/snippets_translate/converter.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import re diff --git a/tools/snippets_translate/handlers.py b/tools/snippets_translate/handlers.py index 34e969a62..7941dc9ed 100644 --- a/tools/snippets_translate/handlers.py +++ b/tools/snippets_translate/handlers.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import re import sys diff --git a/tools/snippets_translate/main.py b/tools/snippets_translate/main.py index 01ea06c5e..faa07a0b0 100644 --- a/tools/snippets_translate/main.py +++ b/tools/snippets_translate/main.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import logging import os @@ -9,7 +10,6 @@ from argparse import ArgumentParser, Namespace, RawDescriptionHelpFormatter from enum import Enum from pathlib import Path from textwrap import dedent -from typing import Dict, List from override import python_example_snippet_mapping from converter import snippet_translate @@ -184,7 +184,7 @@ def is_valid_file(x): return True -def get_snippet_ids(line: str, pattern: re.Pattern) -> List[str]: +def get_snippet_ids(line: str, pattern: re.Pattern) -> list[str]: # Extract the snippet ids for a line '//! [1] //! [2]' result = [] for m in pattern.finditer(line): @@ -192,7 +192,7 @@ def get_snippet_ids(line: str, pattern: re.Pattern) -> List[str]: return result -def overriden_snippet_lines(lines: List[str], start_id: str) -> List[str]: +def overriden_snippet_lines(lines: list[str], start_id: str) -> list[str]: """Wrap an overridden snippet with marker and id lines.""" id_string = f"//! [{start_id}]" result = [OVERRIDDEN_SNIPPET, id_string] @@ -201,7 +201,7 @@ def overriden_snippet_lines(lines: List[str], start_id: str) -> List[str]: return result -def get_snippet_override(start_id: str, rel_path: str) -> List[str]: +def get_snippet_override(start_id: str, rel_path: str) -> list[str]: """Check if the snippet is overridden by a local file under sources/pyside6/doc/snippets.""" file_start_id = start_id.replace(' ', '_') @@ -213,14 +213,14 @@ def get_snippet_override(start_id: str, rel_path: str) -> List[str]: return overriden_snippet_lines(lines, start_id) -def _get_snippets(lines: List[str], +def _get_snippets(lines: list[str], comment: str, - pattern: re.Pattern) -> Dict[str, List[str]]: + pattern: re.Pattern) -> dict[str, list[str]]: """Helper to extract (potentially overlapping) snippets from a C++ file indicated by pattern ("//! [1]") and return them as a dict by <id>.""" - snippets: Dict[str, List[str]] = {} - snippet: List[str] - done_snippets : List[str] = [] + snippets: dict[str, list[str]] = {} + snippet: list[str] + done_snippets: list[str] = [] i = 0 while i < len(lines): @@ -259,7 +259,7 @@ def _get_snippets(lines: List[str], return snippets -def get_python_example_snippet_override(start_id: str, rel_path: str) -> List[str]: +def get_python_example_snippet_override(start_id: str, rel_path: str) -> list[str]: """Check if the snippet is overridden by a python example snippet.""" key = (os.fspath(rel_path), start_id) value = python_example_snippet_mapping().get(key) @@ -275,7 +275,7 @@ def get_python_example_snippet_override(start_id: str, rel_path: str) -> List[st return overriden_snippet_lines(lines, start_id) -def get_snippets(lines: List[str], rel_path: str) -> List[List[str]]: +def get_snippets(lines: list[str], rel_path: str) -> list[list[str]]: """Extract (potentially overlapping) snippets from a C++ file indicated by '//! [1]'.""" result = _get_snippets(lines, '//', CPP_SNIPPET_PATTERN) diff --git a/tools/snippets_translate/module_classes.py b/tools/snippets_translate/module_classes.py index 4992e170b..c5f491e47 100644 --- a/tools/snippets_translate/module_classes.py +++ b/tools/snippets_translate/module_classes.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations module_classes = { @@ -532,6 +533,7 @@ module_classes = { "QAccessibleEvent", "QAccessibleInterface", "QAccessibleObject", + "QAccessibleSelectionInterface", "QAccessibleStateChangeEvent", "QAccessibleTableCellInterface", "QAccessibleTableModelChangeEvent", diff --git a/tools/snippets_translate/override.py b/tools/snippets_translate/override.py index e7623d8a5..c8f3d85d8 100644 --- a/tools/snippets_translate/override.py +++ b/tools/snippets_translate/override.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from pathlib import Path diff --git a/tools/snippets_translate/parse_utils.py b/tools/snippets_translate/parse_utils.py index 234d1b669..688938628 100644 --- a/tools/snippets_translate/parse_utils.py +++ b/tools/snippets_translate/parse_utils.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import re diff --git a/tools/snippets_translate/tests/test_converter.py b/tools/snippets_translate/tests/test_converter.py index 084cc8a6d..efbedc7e9 100644 --- a/tools/snippets_translate/tests/test_converter.py +++ b/tools/snippets_translate/tests/test_converter.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from converter import snippet_translate as st diff --git a/tools/snippets_translate/tests/test_snippets.py b/tools/snippets_translate/tests/test_snippets.py index 84897d815..e914077e7 100644 --- a/tools/snippets_translate/tests/test_snippets.py +++ b/tools/snippets_translate/tests/test_snippets.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations from main import _get_snippets, get_snippet_ids, CPP_SNIPPET_PATTERN diff --git a/tools/uic_test.py b/tools/uic_test.py index 208536963..c0f293ef3 100644 --- a/tools/uic_test.py +++ b/tools/uic_test.py @@ -1,5 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +from __future__ import annotations import os import re @@ -9,7 +10,6 @@ import tempfile from argparse import ArgumentParser, RawTextHelpFormatter from pathlib import Path from textwrap import dedent -from typing import Optional, Tuple VERSION = 6 @@ -20,7 +20,7 @@ DESC = """Runs uic on a set of UI files and displays the resulting widgets.""" TEMP_DIR = Path(tempfile.gettempdir()) -def get_class_name(file: Path) -> Tuple[Optional[str], Optional[str]]: +def get_class_name(file: Path) -> tuple[str | None, str | None]: """Return class name and widget name of UI file.""" pattern = re.compile(r'^\s*<widget class="(\w+)" name="(\w+)"\s*>.*$') for line in Path(file).read_text().splitlines(): |