Skip to content

Commit 0446cc5

Browse files
committed
* fix Sonar warnings
1 parent 5ab4c44 commit 0446cc5

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

lib/python/Scheduler.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -899,25 +899,22 @@ def activate(self):
899899
if doFunc:
900900
if functionTimerEntryFunction and callable(functionTimerEntryFunction) and functionTimerCancelFunction and callable(functionTimerCancelFunction):
901901
self.startFunctionTimer(functionTimerEntryFunction, functionTimerCancelFunction, functionTimerUseOwnThread)
902-
elif self.functionStandbyRetry:
903-
if NavigationInstance.instance.Scheduler:
904-
self.conditionFlag = self.functionStandby # 1 Standby / 2 Online
905-
if DEBUG:
906-
print("[Scheduler] Function timer postponed due to standby state.")
902+
elif self.functionStandbyRetry and NavigationInstance.instance.Scheduler:
903+
self.conditionFlag = self.functionStandby # 1 Standby / 2 Online
904+
if DEBUG:
905+
print("[Scheduler] Function timer postponed due to standby state.")
907906

908907
return True
909908

910909
elif nextState == self.StateEnded:
911910
if DEBUG:
912911
print(f"[Scheduler] DEBUG nextState self.StateEnded / self.cancelled={self.cancelled} / self.failed={self.failed}")
913-
if self.timerType == TIMERTYPE.OTHER and self.function:
914-
if self.cancelled:
915-
if self.cancelFunction and callable(self.cancelFunction):
916-
if DEBUG:
917-
print("[Scheduler] DEBUG Call cancelFunction")
918-
self.cancelFunction()
919-
self.cancelFunction = None
920-
return True
912+
if self.timerType == TIMERTYPE.OTHER and self.function and self.cancelled and self.cancelFunction and callable(self.cancelFunction):
913+
if DEBUG:
914+
print("[Scheduler] DEBUG Call cancelFunction")
915+
self.cancelFunction()
916+
self.cancelFunction = None
917+
return True
921918
if self.afterEvent == AFTEREVENT.WAKEUP:
922919
Screens.Standby.TVinStandby.skipHdmiCecNow("wakeuppowertimer")
923920
if Screens.Standby.inStandby:

lib/python/Screens/Timers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,9 +1314,8 @@ def isFunctionTimer(self):
13141314
return self.timerType.value in functionTimers.getList()
13151315

13161316
def createSetup(self): # NOSONAR silence S2638
1317-
if self.isFunctionTimer():
1318-
if self.timer.isNewTimer:
1319-
self.checkEndDate()
1317+
if self.isFunctionTimer() and self.timer.isNewTimer:
1318+
self.checkEndDate()
13201319
Setup.createSetup(self)
13211320
for callback in onSchedulerSetup:
13221321
callback(self)

0 commit comments

Comments
 (0)