aboutsummaryrefslogtreecommitdiffstats
path: root/packaging-tools/threadedwork.py
diff options
context:
space:
mode:
authorPatrik Teivonen <patrik.teivonen@qt.io>2022-06-02 14:53:43 +0300
committerPatrik Teivonen <patrik.teivonen@qt.io>2022-08-16 07:05:22 +0000
commit753428afc1ec207c4c17c760ce38a9a83d15f4d7 (patch)
tree5f944373e1c81846fe889b569ec608c386ebb04f /packaging-tools/threadedwork.py
parent506b1fe037a1b4fd6f3aec7862ca3fa2ea35006b (diff)
Add hook for mypy static type checker
-Update mypy version in Pipfile -Enable mypy pre-commit hook with default mypy options. -Fix various type errors discovered by mypy. -Install or ignore missing type stubs for untyped module imports. -Missing type annotations will be added later in a separate patch. Change-Id: I96a265a7c0392021a78ca84ec0304910199fde40 Reviewed-by: Antti Kokko <antti.kokko@qt.io>
Diffstat (limited to 'packaging-tools/threadedwork.py')
-rw-r--r--packaging-tools/threadedwork.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/packaging-tools/threadedwork.py b/packaging-tools/threadedwork.py
index ae5c991c4..2a7a62894 100644
--- a/packaging-tools/threadedwork.py
+++ b/packaging-tools/threadedwork.py
@@ -28,7 +28,7 @@
# $QT_END_LICENSE$
#
#############################################################################
-import builtins as __builtin__
+import builtins
import itertools
import os
import sys
@@ -88,13 +88,13 @@ class StdErrHook:
# builtin print() isn't threadsafe, lets make it threadsafe
def threadedPrint(*a, **b):
with outputLock:
- __builtin__.org_print(*a, **b)
+ org_print(*a, **b)
# this is really a HACK or better only useful in this complicate situation
-__builtin__.org_print = __builtin__.print
-__builtin__.org_stdout = sys.stdout
-__builtin__.org_sterr = sys.stderr
+org_print = builtins.print
+org_stdout = sys.stdout
+org_sterr = sys.stderr
def enableThreadedPrint(enable=True, threadCount=cpu_count()):
@@ -107,11 +107,11 @@ def enableThreadedPrint(enable=True, threadCount=cpu_count()):
outputFormatString = outputFormatString + "{" + str(x) + ":10}"
sys.stdout = StdOutHook()
sys.stderr = StdErrHook()
- __builtin__.print = threadedPrint
+ builtins.print = threadedPrint
else:
- sys.stdout = __builtin__.org_stdout
- sys.stderr = __builtin__.org_sterr
- __builtin__.print = __builtin__.org_print
+ sys.stdout = org_stdout
+ sys.stderr = org_sterr
+ builtins.print = org_print
threadData = threading.local()