Skip to content

Commit

Permalink
autopep aggressive E301,E302,E302
Browse files Browse the repository at this point in the history
  • Loading branch information
henrylicious committed Mar 24, 2024
1 parent f0c9fab commit 181cb03
Show file tree
Hide file tree
Showing 24 changed files with 34 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/python/Components/ActionMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
1 change: 1 addition & 0 deletions lib/python/Components/Sources/List.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/python/Components/Sources/StreamService.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

StreamServiceList = []


class StreamService(Source):
def __init__(self, navcore):
Source.__init__(self)
Expand Down
2 changes: 2 additions & 0 deletions lib/python/Components/SystemInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion lib/python/Components/Timeshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/python/Plugins/Extensions/2IB/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#######################################################################



from Components.ActionMap import ActionMap
from Components.config import (ConfigInteger, ConfigSelection,
ConfigSubsection, ConfigYesNo, config,
Expand Down
2 changes: 1 addition & 1 deletion lib/python/Plugins/Extensions/MediaScanner/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

parentScreen = None


def execute(option):
#print "execute", option
if option is None:
Expand All @@ -24,7 +25,6 @@ def mountpoint_choosen(option):
parentScreen.close()
return


#print "scanning", option
(description, mountpoint, session) = option
res = scanDevice(mountpoint)
Expand Down
1 change: 1 addition & 0 deletions lib/python/Plugins/Extensions/StreamlinkWrapper/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
except ImportError:
Streamlink = False


def zap(session, service, **kwargs):
errormsg = None
if service and "http" in service.toString():
Expand Down
1 change: 1 addition & 0 deletions lib/python/Plugins/Extensions/YTDLPWrapper/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
except ImportError:
YoutubeDL = None


def zap(session, service, **kwargs):
errormsg = None
if service and "http" in service.toString():
Expand Down
1 change: 1 addition & 0 deletions lib/python/Plugins/Extensions/YTDLWrapper/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
except ImportError:
YoutubeDL = None


def zap(session, service, **kwargs):
errormsg = None
if service and "http" in service.toString():
Expand Down
3 changes: 3 additions & 0 deletions lib/python/Plugins/SystemPlugins/SwapManager/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

startswap = None


def SwapAutostart(reason, session=None, **kwargs):
global startswap
if reason == 0:
Expand All @@ -36,6 +37,7 @@ def SwapAutostart(reason, session=None, **kwargs):
startswap = StartSwap()
startswap.start()


class StartSwap:
def __init__(self):
self.Console = Console()
Expand Down Expand Up @@ -77,6 +79,7 @@ def startSwap2(self, result=None, retval=None, extra_args=None):

#######################################################################


class SwapManager(Screen):
skin = """
<screen name="SwapManager" position="center,center" size="420,250" title="Swap File Manager" flags="wfBorder" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from Screens.Screen import Screen
from . import VideoEnhancement


class VideoEnhancementSetup(Screen, ConfigListScreen):
def __init__(self, session):
Screen.__init__(self, session)
Expand Down
1 change: 1 addition & 0 deletions lib/python/RecordTimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions lib/python/Screens/ChannelSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
2 changes: 2 additions & 0 deletions lib/python/Screens/Ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/python/Screens/Console.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/python/Screens/FlashImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/python/Screens/InfoBarGenerics.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def updateresumePointCache():

subservice_groupslist = None


class InfoBarStreamRelay:

FILENAME = "/etc/enigma2/whitelist_streamrelay"
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions lib/python/Screens/LocationBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down
2 changes: 2 additions & 0 deletions lib/python/Screens/Standby.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/python/ServiceReference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -51,6 +52,7 @@ def getStreamRelayRef(sref):
pass
return sref, False


def getPlayingref(ref):
playingref = None
if NavigationInstance.instance:
Expand All @@ -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))
Expand All @@ -77,6 +80,7 @@ def resolveAlternate(ref):
eServiceReference(), True)
return nref


def makeServiceQueryStr(serviceTypes):
return ' || '.join(['(type == %d)' % x for x in serviceTypes])

Expand Down
6 changes: 5 additions & 1 deletion lib/python/Tools/Multiboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import tempfile
import subprocess


class tmp:
dir = None

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -168,6 +171,7 @@ def GetBoxName():
box = "sfx6008"
return box


def GetImagelist():
imagelist = {}
if BoxInfo.getItem("canMultiBoot"):
Expand Down Expand Up @@ -206,6 +210,7 @@ def GetImagelist():
os.rmdir(tmp.dir)
return imagelist


class EmptySlot():
MOUNT = 0
UNMOUNT = 1
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions lib/python/Tools/Notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand All @@ -59,8 +60,6 @@ def RemovePopup(id):
x[1].close()




def AddPopup(text, type, timeout, id=None):
if id is not None:
RemovePopup(id)
Expand Down
1 change: 1 addition & 0 deletions lib/python/skin.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def restoreSkin():
except:
print("[SkinRestore]: restore failed")


def loadSkinData(desktop):
restoreSkin()
InitSkins()
Expand Down

0 comments on commit 181cb03

Please sign in to comment.