From 181cb034ad7c0352190776e067584430fbb63843 Mon Sep 17 00:00:00 2001 From: henrylicious Date: Sun, 24 Mar 2024 11:59:46 +0100 Subject: [PATCH] autopep aggressive E301,E302,E302 --- lib/python/Components/ActionMap.py | 1 + lib/python/Components/Sources/List.py | 1 + lib/python/Components/Sources/StreamService.py | 1 + lib/python/Components/SystemInfo.py | 2 ++ lib/python/Components/Timeshift.py | 1 - lib/python/Plugins/Extensions/2IB/plugin.py | 1 - lib/python/Plugins/Extensions/MediaScanner/plugin.py | 2 +- lib/python/Plugins/Extensions/StreamlinkWrapper/plugin.py | 1 + lib/python/Plugins/Extensions/YTDLPWrapper/plugin.py | 1 + lib/python/Plugins/Extensions/YTDLWrapper/plugin.py | 1 + lib/python/Plugins/SystemPlugins/SwapManager/plugin.py | 3 +++ lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py | 1 + lib/python/RecordTimer.py | 1 + lib/python/Screens/ChannelSelection.py | 1 + lib/python/Screens/Ci.py | 2 ++ lib/python/Screens/Console.py | 1 + lib/python/Screens/FlashImage.py | 1 + lib/python/Screens/InfoBarGenerics.py | 2 +- lib/python/Screens/LocationBox.py | 1 + lib/python/Screens/Standby.py | 2 ++ lib/python/ServiceReference.py | 4 ++++ lib/python/Tools/Multiboot.py | 6 +++++- lib/python/Tools/Notifications.py | 3 +-- lib/python/skin.py | 1 + 24 files changed, 34 insertions(+), 7 deletions(-) diff --git a/lib/python/Components/ActionMap.py b/lib/python/Components/ActionMap.py index 4420c3d343..85056c39d6 100644 --- a/lib/python/Components/ActionMap.py +++ b/lib/python/Components/ActionMap.py @@ -80,6 +80,7 @@ def action(self, contexts, action): else: return ActionMap.action(self, contexts, action) + class HelpableActionMap(ActionMap): # An Actionmap which automatically puts the actions into the helpList. # diff --git a/lib/python/Components/Sources/List.py b/lib/python/Components/Sources/List.py index d096d7aa35..132b07156a 100644 --- a/lib/python/Components/Sources/List.py +++ b/lib/python/Components/Sources/List.py @@ -1,6 +1,7 @@ from Components.Sources.Source import Source from Components.Element import cached + class List(Source): """The datasource of a listbox. Currently, the format depends on the used converter. So if you put a simple string list in here, you need to use a StringList converter, if you are diff --git a/lib/python/Components/Sources/StreamService.py b/lib/python/Components/Sources/StreamService.py index e6184bd664..5f719aec44 100644 --- a/lib/python/Components/Sources/StreamService.py +++ b/lib/python/Components/Sources/StreamService.py @@ -6,6 +6,7 @@ StreamServiceList = [] + class StreamService(Source): def __init__(self, navcore): Source.__init__(self) diff --git a/lib/python/Components/SystemInfo.py b/lib/python/Components/SystemInfo.py index bfe2b9ead0..908e26299b 100644 --- a/lib/python/Components/SystemInfo.py +++ b/lib/python/Components/SystemInfo.py @@ -119,6 +119,7 @@ def deleteItem(self, item, *args, **kws): cmdline = fd.read() cmdline = {k: v.strip('"') for k, v in re.findall(r'(\S+)=(".*?"|\S+)', cmdline)} + def getNumVideoDecoders(): idx = 0 while fileExists("/dev/dvb/adapter0/video%d" % idx, 'f'): @@ -147,6 +148,7 @@ def countFrontpanelLEDs(): SystemInfo = BoxInfo.boxInfo from Tools.Multiboot import getMultibootStartupDevice, getMultibootslots # This import needs to be here to avoid a SystemInfo load loop! + def setBoxInfoItems(): model = getBoxType() #BoxInfo.setItem("canMode12", "_4.boxmode" % model in cmdline and cmdline["_4.boxmode" % model] in ("1", "12") and "192M") diff --git a/lib/python/Components/Timeshift.py b/lib/python/Components/Timeshift.py index 24d3b346a4..10a75744d4 100644 --- a/lib/python/Components/Timeshift.py +++ b/lib/python/Components/Timeshift.py @@ -28,7 +28,6 @@ # activated (currently time-shifting). - from os import link, listdir, makedirs from os import path as os_path from os import rename, stat as os_stat, statvfs, system diff --git a/lib/python/Plugins/Extensions/2IB/plugin.py b/lib/python/Plugins/Extensions/2IB/plugin.py index 88128db1a3..f0d468d50d 100644 --- a/lib/python/Plugins/Extensions/2IB/plugin.py +++ b/lib/python/Plugins/Extensions/2IB/plugin.py @@ -18,7 +18,6 @@ ####################################################################### - from Components.ActionMap import ActionMap from Components.config import (ConfigInteger, ConfigSelection, ConfigSubsection, ConfigYesNo, config, diff --git a/lib/python/Plugins/Extensions/MediaScanner/plugin.py b/lib/python/Plugins/Extensions/MediaScanner/plugin.py index c7ee071043..55d63130d6 100644 --- a/lib/python/Plugins/Extensions/MediaScanner/plugin.py +++ b/lib/python/Plugins/Extensions/MediaScanner/plugin.py @@ -5,6 +5,7 @@ parentScreen = None + def execute(option): #print "execute", option if option is None: @@ -24,7 +25,6 @@ def mountpoint_choosen(option): parentScreen.close() return - #print "scanning", option (description, mountpoint, session) = option res = scanDevice(mountpoint) diff --git a/lib/python/Plugins/Extensions/StreamlinkWrapper/plugin.py b/lib/python/Plugins/Extensions/StreamlinkWrapper/plugin.py index 05c583d581..f2f8ca20f9 100644 --- a/lib/python/Plugins/Extensions/StreamlinkWrapper/plugin.py +++ b/lib/python/Plugins/Extensions/StreamlinkWrapper/plugin.py @@ -6,6 +6,7 @@ except ImportError: Streamlink = False + def zap(session, service, **kwargs): errormsg = None if service and "http" in service.toString(): diff --git a/lib/python/Plugins/Extensions/YTDLPWrapper/plugin.py b/lib/python/Plugins/Extensions/YTDLPWrapper/plugin.py index 367fb90da1..da50154c87 100644 --- a/lib/python/Plugins/Extensions/YTDLPWrapper/plugin.py +++ b/lib/python/Plugins/Extensions/YTDLPWrapper/plugin.py @@ -5,6 +5,7 @@ except ImportError: YoutubeDL = None + def zap(session, service, **kwargs): errormsg = None if service and "http" in service.toString(): diff --git a/lib/python/Plugins/Extensions/YTDLWrapper/plugin.py b/lib/python/Plugins/Extensions/YTDLWrapper/plugin.py index 2a3f616d1b..d3736925a6 100644 --- a/lib/python/Plugins/Extensions/YTDLWrapper/plugin.py +++ b/lib/python/Plugins/Extensions/YTDLWrapper/plugin.py @@ -5,6 +5,7 @@ except ImportError: YoutubeDL = None + def zap(session, service, **kwargs): errormsg = None if service and "http" in service.toString(): diff --git a/lib/python/Plugins/SystemPlugins/SwapManager/plugin.py b/lib/python/Plugins/SystemPlugins/SwapManager/plugin.py index c287b3a222..98473a0cf7 100644 --- a/lib/python/Plugins/SystemPlugins/SwapManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SwapManager/plugin.py @@ -28,6 +28,7 @@ startswap = None + def SwapAutostart(reason, session=None, **kwargs): global startswap if reason == 0: @@ -36,6 +37,7 @@ def SwapAutostart(reason, session=None, **kwargs): startswap = StartSwap() startswap.start() + class StartSwap: def __init__(self): self.Console = Console() @@ -77,6 +79,7 @@ def startSwap2(self, result=None, retval=None, extra_args=None): ####################################################################### + class SwapManager(Screen): skin = """ diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py b/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py index a6eff80b96..3aa8b5492a 100644 --- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py +++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/plugin.py @@ -13,6 +13,7 @@ from Screens.Screen import Screen from . import VideoEnhancement + class VideoEnhancementSetup(Screen, ConfigListScreen): def __init__(self, session): Screen.__init__(self, session) diff --git a/lib/python/RecordTimer.py b/lib/python/RecordTimer.py index d0375a7374..77c310f876 100644 --- a/lib/python/RecordTimer.py +++ b/lib/python/RecordTimer.py @@ -50,6 +50,7 @@ service_types_tv = service_types_tv_ref.toString() service_types_radio = service_types_radio_ref.toString() + def powermessagetimeout(self): messagetimeout = config.usage.window_timeout.value diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 2b6afe4e67..416d2f0f50 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -2179,6 +2179,7 @@ def gotoCurrentServiceOrProvider(self, ref): class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelectionEPG, SelectionEventInfo): instance = None ALLOW_SUSPEND = True + def __init__(self, session): ChannelSelectionBase.__init__(self, session) if config.usage.servicelist_mode.value == 'simple': diff --git a/lib/python/Screens/Ci.py b/lib/python/Screens/Ci.py index cb92a934db..ba65e364b2 100644 --- a/lib/python/Screens/Ci.py +++ b/lib/python/Screens/Ci.py @@ -34,9 +34,11 @@ def setCIBitrate(configElement): else: eDVBCI_UI.getInstance().setClockRate(configElement.slotid, eDVBCI_UI.rateHigh) + def setCIEnabled(configElement): eDVBCI_UI.getInstance().setEnabled(configElement.slotid, configElement.value) + def setdvbCiDelay(configElement): f = open("/proc/stb/tsmux/rmx_delay", "w") f.write(configElement.value) diff --git a/lib/python/Screens/Console.py b/lib/python/Screens/Console.py index c566de37ff..9fcf835083 100644 --- a/lib/python/Screens/Console.py +++ b/lib/python/Screens/Console.py @@ -8,6 +8,7 @@ from Components.Label import Label from six import ensure_str + class Console(Screen): def __init__(self, session, title="Console", cmdlist=None, finishedCallback=None, closeOnSuccess=False): Screen.__init__(self, session) diff --git a/lib/python/Screens/FlashImage.py b/lib/python/Screens/FlashImage.py index 0e3af79562..590ac7f9e9 100644 --- a/lib/python/Screens/FlashImage.py +++ b/lib/python/Screens/FlashImage.py @@ -34,6 +34,7 @@ doBackup = False multibootslot = "" + def checkimagefiles(files): return len([x for x in files if 'kernel' in x and '.bin' in x or x in ('uImage', 'rootfs.bin', 'root_cfe_auto.bin', 'root_cfe_auto.jffs2', 'oe_rootfs.bin', 'e2jffs2.img', 'rootfs.tar.bz2', 'rootfs.ubi')]) == 2 diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 1fcd8c596a..a16172f115 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -192,6 +192,7 @@ def updateresumePointCache(): subservice_groupslist = None + class InfoBarStreamRelay: FILENAME = "/etc/enigma2/whitelist_streamrelay" @@ -1140,7 +1141,6 @@ def openEventView(self, simple=False): self.eventView = self.session.openWithCallback(self.closed, EventViewSimple, epglist[0], ServiceReference(ref)) self.dlg_stack = None - def getNowNext(self): epglist = [] service = self.session.nav.getCurrentService() diff --git a/lib/python/Screens/LocationBox.py b/lib/python/Screens/LocationBox.py index db27be48d9..f030446c2e 100644 --- a/lib/python/Screens/LocationBox.py +++ b/lib/python/Screens/LocationBox.py @@ -31,6 +31,7 @@ DEFAULT_INHIBIT_DEVICES.append(device) DEFAULT_INHIBIT_DEVICES = tuple(DEFAULT_INHIBIT_DEVICES) + class LocationBox(Screen, NumericalTextInput, HelpableScreen): """Simple Class similar to MessageBox / ChoiceBox but used to choose a folder/pathname combination""" diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py index ad488db255..e6092b90e8 100644 --- a/lib/python/Screens/Standby.py +++ b/lib/python/Screens/Standby.py @@ -34,10 +34,12 @@ def isInfoBarInstance(): infoBarInstance = InfoBar.instance return infoBarInstance + def checkTimeshiftRunning(): infobar_instance = isInfoBarInstance() return config.usage.check_timeshift.value and infobar_instance and infobar_instance.timeshiftEnabled() and infobar_instance.timeshift_was_activated + class TVstate: #load in Navigation def __init__(self): global TVinStandby diff --git a/lib/python/ServiceReference.py b/lib/python/ServiceReference.py index b852839f0f..cfbd73b76f 100644 --- a/lib/python/ServiceReference.py +++ b/lib/python/ServiceReference.py @@ -39,6 +39,7 @@ def isRecordable(self): ref = self.ref return ref.flags & eServiceReference.isGroup or (ref.type in (eServiceReference.idDVB, eServiceReference.idDVB + eServiceReference.idServiceIsScrambled, eServiceReference.idServiceHDMIIn, eServiceReference.idServiceMP3)) + def getStreamRelayRef(sref): try: if "http" in sref: @@ -51,6 +52,7 @@ def getStreamRelayRef(sref): pass return sref, False + def getPlayingref(ref): playingref = None if NavigationInstance.instance: @@ -63,6 +65,7 @@ def getPlayingref(ref): playingref = eServiceReference() return playingref + def isPlayableForCur(ref): info = eServiceCenter.getInstance().info(ref) return info and info.isPlayable(ref, getPlayingref(ref)) @@ -77,6 +80,7 @@ def resolveAlternate(ref): eServiceReference(), True) return nref + def makeServiceQueryStr(serviceTypes): return ' || '.join(['(type == %d)' % x for x in serviceTypes]) diff --git a/lib/python/Tools/Multiboot.py b/lib/python/Tools/Multiboot.py index 700f28aa79..d34cccf4c4 100644 --- a/lib/python/Tools/Multiboot.py +++ b/lib/python/Tools/Multiboot.py @@ -6,6 +6,7 @@ import tempfile import subprocess + class tmp: dir = None @@ -33,6 +34,7 @@ def getMultibootStartupDevice(): def getparam(line, param): return line.replace("userdataroot", "rootuserdata").rsplit('%s=' % param, 1)[1].split(' ', 1)[0] + def getMultibootslots(): bootslots = {} mode12found = False @@ -124,6 +126,7 @@ def restoreImages(): if not os.path.ismount(tmp.dir): os.rmdir(tmp.dir) + def getUUIDtoSD(UUID): # returns None on failure check = "/sbin/blkid" if fileExists(check): @@ -168,6 +171,7 @@ def GetBoxName(): box = "sfx6008" return box + def GetImagelist(): imagelist = {} if BoxInfo.getItem("canMultiBoot"): @@ -206,6 +210,7 @@ def GetImagelist(): os.rmdir(tmp.dir) return imagelist + class EmptySlot(): MOUNT = 0 UNMOUNT = 1 @@ -233,7 +238,6 @@ def run(self): else: self.container.ePopen("mount %s %s" % (BoxInfo.getItem("canMultiBoot")[self.slot]["device"], Imagemount), self.appClosed) - def appClosed(self, data="", retval=0, extra_args=None): if retval == 0 and self.phase == self.MOUNT: if BoxInfo.getItem("HasRootSubdir") and BoxInfo.getItem("canMultiBoot")[self.slot]["rootsubdir"] != None: diff --git a/lib/python/Tools/Notifications.py b/lib/python/Tools/Notifications.py index d5d31434f8..f8eed342b4 100644 --- a/lib/python/Tools/Notifications.py +++ b/lib/python/Tools/Notifications.py @@ -36,6 +36,7 @@ def AddNotificationWithID(id, screen, *args, **kwargs): def AddNotificationWithIDCallback(fnc, id, screen, *args, **kwargs): __AddNotification(fnc, screen, id, *args, **kwargs) + def AddNotificationWithUniqueIDCallback(fnc, id, screen, *args, **kwargs): for x in notifications: if x[4] and x[4] == id: # Already there... @@ -59,8 +60,6 @@ def RemovePopup(id): x[1].close() - - def AddPopup(text, type, timeout, id=None): if id is not None: RemovePopup(id) diff --git a/lib/python/skin.py b/lib/python/skin.py index 5e2039dfb6..a09efe2ae7 100644 --- a/lib/python/skin.py +++ b/lib/python/skin.py @@ -171,6 +171,7 @@ def restoreSkin(): except: print("[SkinRestore]: restore failed") + def loadSkinData(desktop): restoreSkin() InitSkins()