From 826cedf1f051ff5433cf33b2776bf1bdb9d5bdd2 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sat, 4 Apr 2020 18:04:27 +0200 Subject: [PATCH] moved wttr.py to lib/view/ --- lib/globals.py | 4 ++++ lib/{ => view}/wttr.py | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) rename lib/{ => view}/wttr.py (97%) diff --git a/lib/globals.py b/lib/globals.py index 444e97a..b24d791 100644 --- a/lib/globals.py +++ b/lib/globals.py @@ -122,3 +122,7 @@ def get_help_file(lang): if os.path.exists(help_file): return help_file return HELP_FILE + +def remove_ansi(sometext): + ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]') + return ansi_escape.sub('', sometext) diff --git a/lib/wttr.py b/lib/view/wttr.py similarity index 97% rename from lib/wttr.py rename to lib/view/wttr.py index 85cee4b..e8eeb70 100644 --- a/lib/wttr.py +++ b/lib/view/wttr.py @@ -13,19 +13,16 @@ import os import re import time +sys.path.insert(0, "..") from translations import get_message, FULL_TRANSLATION, PARTIAL_TRANSLATION, SUPPORTED_LANGS from globals import WEGO, CACHEDIR, \ NOT_FOUND_LOCATION, DEFAULT_LOCATION, TEST_FILE, \ - log, error + log, error, remove_ansi def _is_invalid_location(location): if '.png' in location: return True -def remove_ansi(sometext): - ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]') - return ansi_escape.sub('', sometext) - def get_wetter(location, ip, html=False, lang=None, query=None, location_name=None, full_address=None, url=None): local_url = url