From 8c90fec14e3e246f4bb96bac544f0b133e4ba11c Mon Sep 17 00:00:00 2001 From: Tony Whalley Date: Sat, 27 Jan 2024 14:18:36 +0100 Subject: [PATCH] resolve python 3.12 syntax issues --- lib/python/Components/Network.py | 2 +- lib/python/Components/PackageInfo.py | 2 +- lib/python/Components/Renderer/NextEpgInfo.py | 2 +- lib/python/Screens/About.py | 2 +- lib/python/Screens/ChannelSelection.py | 2 +- lib/python/Tools/Hex2strColor.py | 2 +- tools/genmetaindex.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index 70eecc555d..e128c82113 100644 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -183,7 +183,7 @@ def loadNetworkConfig(self, iface, callback=None): callback(True) def loadNameserverConfig(self): - ipRegexp = "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" # noqa: W605 + ipRegexp = r"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" # noqa: W605 nameserverPattern = re.compile("nameserver +" + ipRegexp) ipPattern = re.compile(ipRegexp) diff --git a/lib/python/Components/PackageInfo.py b/lib/python/Components/PackageInfo.py index 9632984a75..4e4a180c66 100644 --- a/lib/python/Components/PackageInfo.py +++ b/lib/python/Components/PackageInfo.py @@ -190,7 +190,7 @@ def fillPackagesList(self, prerequisites=True): self.directory = [self.directory] for directory in self.directory: - packages += crawlDirectory(directory, ".*\.info$") # noqa: W605 + packages += crawlDirectory(directory, r".*\.info$") # noqa: W605 for package in packages: self.readInfo(package[0] + "/", package[0] + "/" + package[1]) diff --git a/lib/python/Components/Renderer/NextEpgInfo.py b/lib/python/Components/Renderer/NextEpgInfo.py index a05bff4ad4..d6bf909333 100644 --- a/lib/python/Components/Renderer/NextEpgInfo.py +++ b/lib/python/Components/Renderer/NextEpgInfo.py @@ -16,7 +16,7 @@ def __init__(self): self.hideLabel = 0 self.timecolor = "" self.labelcolor = "" - self.foregroundColor = "\c00f0f0f0" # noqa: W605 + self.foregroundColor = r"\c00f0f0f0" # noqa: W605 self.numOfSpaces = 1 GUI_WIDGET = eLabel diff --git a/lib/python/Screens/About.py b/lib/python/Screens/About.py index 9ea58ece9b..fc784da1d2 100644 --- a/lib/python/Screens/About.py +++ b/lib/python/Screens/About.py @@ -94,7 +94,7 @@ def populate(self): tempinfo = "" elif path.exists("/proc/hisi/msp/pm_cpu"): try: - tempinfo = search("temperature = (\d+) degree", open("/proc/hisi/msp/pm_cpu").read()).group(1) # noqa: W605 + tempinfo = search(r"temperature = (\d+) degree", open("/proc/hisi/msp/pm_cpu").read()).group(1) # noqa: W605 except: tempinfo = "" if tempinfo and int(tempinfo) > 0: diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index c86f4c4bd4..70d549cc62 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -1337,7 +1337,7 @@ def exitContext(self, close=False): class ChannelSelectionBase(Screen, HelpableScreen): - orbposReStr = "\(satellitePosition *== *(\d+)" # noqa: W605 + orbposReStr = r"\(satellitePosition *== *(\d+)" # noqa: W605 orbposRe = None # Lazy compilation def __init__(self, session): diff --git a/lib/python/Tools/Hex2strColor.py b/lib/python/Tools/Hex2strColor.py index 4bb4e98f79..7d7d7b68de 100644 --- a/lib/python/Tools/Hex2strColor.py +++ b/lib/python/Tools/Hex2strColor.py @@ -3,4 +3,4 @@ def Hex2strColor(rgb): - return "\c%08x" % rgb # noqa: W605 + return r"\c%08x" % rgb # noqa: W605 diff --git a/tools/genmetaindex.py b/tools/genmetaindex.py index 9422db6663..b1cde7cfda 100644 --- a/tools/genmetaindex.py +++ b/tools/genmetaindex.py @@ -21,7 +21,7 @@ for i in p.findall("info"): if not info: info = i - assert info + assert info is not None for i in info[:]: if i.tag not in ["name", "packagename", "packagetype", "shortdescription"]: