aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/support/generate_pyi.py
diff options
context:
space:
mode:
authorSimo Fält <simo.falt@qt.io>2023-06-29 15:19:20 +0300
committerSimo Fält <simo.falt@qt.io>2023-06-29 15:19:20 +0300
commit568797c36a73aecce050fd198353f31aa986bff9 (patch)
treee1781afe922c4b6327045134639a5c5d41b56300 /sources/pyside2/PySide2/support/generate_pyi.py
parent643237181d15086816d38cdb17f18147c7ebcbd8 (diff)
parentc76c68a64bb4dce48017c61b4ca021dc6726f77b (diff)
Merge tag 'v5.15.11-lts' into tqtc/lts-5.15-opensourcev5.15.11-lts-lgpl
Qt For Python Release 5.15.11 Change-Id: Idbf9b792238244e185e39be4058a7a2c69458ce9
Diffstat (limited to 'sources/pyside2/PySide2/support/generate_pyi.py')
-rw-r--r--sources/pyside2/PySide2/support/generate_pyi.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py
index 9eb84de7a..19565338f 100644
--- a/sources/pyside2/PySide2/support/generate_pyi.py
+++ b/sources/pyside2/PySide2/support/generate_pyi.py
@@ -147,10 +147,7 @@ class Formatter(Writer):
self.print("from PySide2.support.signature.mapping import (")
self.print(" Virtual, Missing, Invalid, Default, Instance)")
self.print()
- self.print("class Object(object): pass")
- self.print()
- self.print("import shiboken2 as Shiboken")
- self.print("Shiboken.Object = Object")
+ self.print("from shiboken2 import Shiboken")
self.print()
# This line will be replaced by the missing imports postprocess.
self.print("IMPORTS")
@@ -222,7 +219,6 @@ def generate_pyi(import_name, outpath, options):
outfile = io.StringIO()
fmt = Formatter(outfile)
fmt.print(LICENSE_TEXT.strip())
- need_imports = not USE_PEP563
if USE_PEP563:
fmt.print("from __future__ import annotations")
fmt.print()
@@ -246,11 +242,10 @@ def generate_pyi(import_name, outpath, options):
line = line.rstrip()
# we remove the IMPORTS marker and insert imports if needed
if line == "IMPORTS":
- if need_imports:
- for mod_name in find_imports(outfile.getvalue()):
- imp = "PySide2." + mod_name
- if imp != import_name:
- wr.print("import " + imp)
+ for mod_name in find_imports(outfile.getvalue()):
+ imp = "PySide2." + mod_name
+ if imp != import_name:
+ wr.print("import " + imp)
wr.print("import " + import_name)
wr.print()
wr.print()