From 095ba8cebb56becb608bed837d642d63458c3175 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Wed, 27 Sep 2017 00:39:19 +0200 Subject: [PATCH] Moved ANSI_UP_DEL to tcllib. --- tclcheck_all.py | 5 ++--- tclcheck_allfull.py | 5 ++--- tclcheck_allota.py | 5 ++--- tcllib.py | 1 + 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tclcheck_all.py b/tclcheck_all.py index bfba6c5..0e84744 100644 --- a/tclcheck_all.py +++ b/tclcheck_all.py @@ -7,7 +7,6 @@ import tcllib from requests.exceptions import RequestException, Timeout tcllib.make_escapes_work() -ANSI_UP_DEL = u"\u001b[F\u001b[K" fc = tcllib.FotaCheck() fc.serid = "3531510" @@ -38,7 +37,7 @@ while len(prds) > 0: prds.pop(0) except Timeout as e: print("{} failed. (Connection timed out.)".format(prd)) - print(ANSI_UP_DEL, end="") + print(tcllib.ANSI_UP_DEL, end="") continue except (SystemExit, RequestException) as e: print("{} failed. ({})".format(prd, str(e))) @@ -46,5 +45,5 @@ while len(prds) > 0: # No update available or invalid request - remove from queue prds.pop(0) else: - print(ANSI_UP_DEL, end="") + print(tcllib.ANSI_UP_DEL, end="") continue diff --git a/tclcheck_allfull.py b/tclcheck_allfull.py index 5b9fc01..8d95dd4 100644 --- a/tclcheck_allfull.py +++ b/tclcheck_allfull.py @@ -7,7 +7,6 @@ import tcllib from requests.exceptions import RequestException, Timeout tcllib.make_escapes_work() -ANSI_UP_DEL = u"\u001b[F\u001b[K" fc = tcllib.FotaCheck() fc.serid = "3531510" @@ -38,7 +37,7 @@ while len(prds) > 0: prds.pop(0) except Timeout as e: print("{} failed. (Connection timed out.)".format(prd)) - print(ANSI_UP_DEL, end="") + print(tcllib.ANSI_UP_DEL, end="") continue except (SystemExit, RequestException) as e: print("{} failed. ({})".format(prd, str(e))) @@ -46,5 +45,5 @@ while len(prds) > 0: # No update available or invalid request - remove from queue prds.pop(0) else: - print(ANSI_UP_DEL, end="") + print(tcllib.ANSI_UP_DEL, end="") continue diff --git a/tclcheck_allota.py b/tclcheck_allota.py index 70bd754..b1da8bf 100644 --- a/tclcheck_allota.py +++ b/tclcheck_allota.py @@ -7,7 +7,6 @@ import tcllib from requests.exceptions import RequestException, Timeout tcllib.make_escapes_work() -ANSI_UP_DEL = u"\u001b[F\u001b[K" fc = tcllib.FotaCheck() fc.serid = "3531510" @@ -36,7 +35,7 @@ while len(prds) > 0: prds.pop(0) except Timeout as e: print("{} failed. (Connection timed out.)".format(prd)) - print(ANSI_UP_DEL, end="") + print(tcllib.ANSI_UP_DEL, end="") continue except (SystemExit, RequestException) as e: print("{} ({}) failed. ({})".format(prd, lastver, str(e))) @@ -44,5 +43,5 @@ while len(prds) > 0: # No update available or invalid request - remove from queue prds.pop(0) else: - print(ANSI_UP_DEL, end="") + print(tcllib.ANSI_UP_DEL, end="") continue diff --git a/tcllib.py b/tcllib.py index 52a4798..d90fc4e 100644 --- a/tcllib.py +++ b/tcllib.py @@ -18,6 +18,7 @@ except (ImportError, AttributeError): from xml.etree import ElementTree import requests +ANSI_UP_DEL = u"\u001b[F\u001b[K" def make_escapes_work(): system = platform.system()