GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 0b346f...8ed2a5 )
by
unknown
43s
created

system_lock()   A

Complexity

Conditions 4

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
dl 0
loc 12
rs 9.2
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A stop_singleton() 0 2 1
1
#!/usr/bin/python
2
# -*- coding: UTF-8 -*-
3
"""
4
Utils module. Some basic functions that maybe I'll need more than once
5
"""
6
import sys
7
import xbmc, xbmcaddon, xbmcgui
8
from threading import Timer
9
10
__addon__ = xbmcaddon.Addon("script.simkl")
11
12
13
def log(s):
14
    xbmc.log("-- Simkl: {0}".format(s), level=xbmc.LOGDEBUG)
15
16
17
def get_str(strid):
18
    """ Given an id, returns the localized string """
19
    return __addon__.getLocalizedString(strid)
20
21
22
def get_setting(settingid):
23
    """ Given an id, return the setting """
24
    ret = __addon__.getSetting(settingid)
25
    log("get setting {0} = {1}".format(settingid, ret))
26
    return ret
27
28
29
def set_setting(settingid, val):
30
    """ Given an id, return the setting """
31
    log("set setting, {0} = {1}".format(settingid, val))
32
    __addon__.setSetting(settingid, val)
33
34
35
def system_lock(name, sec=0):
36
    w = xbmcgui.Window(10000)
37
    if w.getProperty(name) == "True":
38
        log('already started, ' + name)
39
        sys.exit(0)
40
    w.setProperty(name, "True")
41
    if sec != 0:
42
        def stop_singleton():
43
            w.clearProperty(name)
44
45
        t = Timer(sec, stop_singleton)
46
        t.start()
47