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