diff --git a/bumblebee_status/core/config.py b/bumblebee_status/core/config.py index 47fbbe6..67aba5f 100644 --- a/bumblebee_status/core/config.py +++ b/bumblebee_status/core/config.py @@ -220,7 +220,7 @@ class Config(util.store.Store): if os.path.exists(filename): log.info("loading {}".format(filename)) tmp = RawConfigParser() - tmp.read(filename) + tmp.read(u"{}".format(filename)) if tmp.has_section("module-parameters"): for key, value in tmp.items("module-parameters"): diff --git a/bumblebee_status/modules/contrib/apt.py b/bumblebee_status/modules/contrib/apt.py index 256ed15..417f752 100644 --- a/bumblebee_status/modules/contrib/apt.py +++ b/bumblebee_status/modules/contrib/apt.py @@ -24,7 +24,7 @@ def parse_result(to_parse): # We want to line with the iforamtion about package upgrade line_to_parse = to_parse.split("\n")[-4] result = re.search( - "(.+) packages upgraded, (.+) newly installed, (.+) to remove", line_to_parse + r"(.+) packages upgraded, (.+) newly installed, (.+) to remove", line_to_parse ) return int(result.group(1)), int(result.group(3)) diff --git a/bumblebee_status/modules/contrib/progress.py b/bumblebee_status/modules/contrib/progress.py index 4525d81..a1938d2 100644 --- a/bumblebee_status/modules/contrib/progress.py +++ b/bumblebee_status/modules/contrib/progress.py @@ -66,10 +66,10 @@ class Module(core.module.Module): # 6. speed # 7. time remaining extract_nospeed = re.compile( - "\[ *(\d*)\] ([a-zA-Z]*) (.*)\n\t(\d*\.*\d*)% \((.*)\)\n.*" + r"\[ *(\d*)\] ([a-zA-Z]*) (.*)\n\t(\d*\.*\d*)% \((.*)\)\n.*" ) extract_wtspeed = re.compile( - "\[ *(\d*)\] ([a-zA-Z]*) (.*)\n\t(\d*\.*\d*)% \((.*)\) (\d*\.\d .*) remaining (\d*:\d*:\d*)\n.*" + r"\[ *(\d*)\] ([a-zA-Z]*) (.*)\n\t(\d*\.*\d*)% \((.*)\) (\d*\.\d .*) remaining (\d*:\d*:\d*)\n.*" ) try: diff --git a/bumblebee_status/modules/contrib/rss.py b/bumblebee_status/modules/contrib/rss.py index 628e4d3..7b8c032 100644 --- a/bumblebee_status/modules/contrib/rss.py +++ b/bumblebee_status/modules/contrib/rss.py @@ -122,7 +122,7 @@ class Module(core.module.Module): return image if image else "" def _remove_tags(self, txt): - return re.sub("<[^>]*>", "", txt) + return re.sub(r"<[^>]*>", "", txt) def _create_item(self, entry, url, feed): return { diff --git a/bumblebee_status/modules/contrib/spaceapi.py b/bumblebee_status/modules/contrib/spaceapi.py index bab64c5..d29c081 100644 --- a/bumblebee_status/modules/contrib/spaceapi.py +++ b/bumblebee_status/modules/contrib/spaceapi.py @@ -46,7 +46,7 @@ def formatStringBuilder(s, json): s -> format string json -> the spaceapi response object """ - identifiers = re.findall("%%.*?%%", s) + identifiers = re.findall(r"%%.*?%%", s) for i in identifiers: ic = i[2:-2] # Discard %% j = ic.split("%") diff --git a/bumblebee_status/modules/contrib/traffic.py b/bumblebee_status/modules/contrib/traffic.py index 215033d..c9f7843 100644 --- a/bumblebee_status/modules/contrib/traffic.py +++ b/bumblebee_status/modules/contrib/traffic.py @@ -100,7 +100,7 @@ class Module(core.module.Module): minwidth_str += graph_prefix minwidth_str += "1000" try: - length = int(re.match("{:\.(\d+)f}", self._format).group(1)) + length = int(re.match(r"{:\.(\d+)f}", self._format).group(1)) if length > 0: minwidth_str += "." + "0" * length except AttributeError: diff --git a/bumblebee_status/modules/contrib/watson.py b/bumblebee_status/modules/contrib/watson.py index 7887328..d7b260b 100644 --- a/bumblebee_status/modules/contrib/watson.py +++ b/bumblebee_status/modules/contrib/watson.py @@ -45,7 +45,7 @@ class Module(core.module.Module): def update(self): output = util.cli.execute("watson status") - if re.match("No project started", output): + if re.match(r"No project started", output): self.__tracking = False return diff --git a/bumblebee_status/modules/contrib/weather.py b/bumblebee_status/modules/contrib/weather.py index 0aa9785..72e0c27 100644 --- a/bumblebee_status/modules/contrib/weather.py +++ b/bumblebee_status/modules/contrib/weather.py @@ -74,7 +74,7 @@ class Module(core.module.Module): return util.format.astemperature(self.__tempmax, self.__unit) def city(self): - city = re.sub("[_-]", " ", self.__city) + city = re.sub(r"[_-]", " ", self.__city) return "{} ".format(city) def output(self, widget): diff --git a/bumblebee_status/util/format.py b/bumblebee_status/util/format.py index fb142ac..198e995 100644 --- a/bumblebee_status/util/format.py +++ b/bumblebee_status/util/format.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import re @@ -87,7 +89,7 @@ def byte(val, fmt="{:.2f}"): return "{}GiB".format(fmt).format(val * 1024.0) -__seconds_pattern = re.compile("(([\d\.?]+)h)?(([\d\.]+)m)?([\d\.]+)?s?") +__seconds_pattern = re.compile(r"(([\d\.?]+)h)?(([\d\.]+)m)?([\d\.]+)?s?") def seconds(duration):