From 74448df9f17bf61a72c840b76a33e6ce6e417dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ga=C5=88o?= Date: Sun, 25 Apr 2021 21:07:49 +0200 Subject: [PATCH] Put typing import into try block --- tools/idf_monitor_base/console_parser.py | 6 +++++- tools/idf_monitor_base/output_helpers.py | 6 +++++- tools/idf_monitor_base/stoppable_thread.py | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/idf_monitor_base/console_parser.py b/tools/idf_monitor_base/console_parser.py index 960f7a93d3..559f5c6261 100644 --- a/tools/idf_monitor_base/console_parser.py +++ b/tools/idf_monitor_base/console_parser.py @@ -13,7 +13,11 @@ # limitations under the License. import textwrap -from typing import Optional + +try: + from typing import Optional +except ImportError: + pass import serial.tools.miniterm as miniterm diff --git a/tools/idf_monitor_base/output_helpers.py b/tools/idf_monitor_base/output_helpers.py index 19c151e71c..07a8c5b343 100644 --- a/tools/idf_monitor_base/output_helpers.py +++ b/tools/idf_monitor_base/output_helpers.py @@ -14,7 +14,11 @@ import sys -from typing import Optional + +try: + from typing import Optional +except ImportError: + pass # ANSI terminal codes (if changed, regular expressions in LineMatcher need to be udpated) ANSI_RED = '\033[1;31m' diff --git a/tools/idf_monitor_base/stoppable_thread.py b/tools/idf_monitor_base/stoppable_thread.py index 38f6b7a01a..886ac362f9 100644 --- a/tools/idf_monitor_base/stoppable_thread.py +++ b/tools/idf_monitor_base/stoppable_thread.py @@ -13,7 +13,11 @@ # limitations under the License. import threading -from typing import Optional + +try: + from typing import Optional +except ImportError: + pass class StoppableThread(object):