Beispiel #1
0
def refresh(current_name):
    temp = read()
    refresh_name = temp.get("refresh_name")
    update(**{"refresh_name": None})
    if refresh_name:
        if if_exisit(refresh_name):
            find_fresh(refresh_name, current_name)  #失效的公众号名字   当前点击的公众号名字
Beispiel #2
0
def stop():
    temp = read()
    limit_name = temp.get("limit_name")
    update(**{"limit_name": None})
    if limit_name:
        pipe = Popen("adb shell am force-stop com.tencent.mm", shell=True)
        pipe.wait()
Beispiel #3
0
def on_clientLimit(data):  #号被限制 停止微信
    limit_name = data.get("limit_name")
    if limit_name:
        temp = {
            "limit_name": limit_name
        }
        update(**temp)
Beispiel #4
0
def update(table, field, value, condition):
    if store.exists(table, condition):
        old = store.value(table, field, condition=condition)
        if old != value:
            store.update(table, [field], [value], condition=condition)
            logger.debug('update %s: %s=%s' % (table, field, value))
        return (old, value)
    return None
Beispiel #5
0
def on_clientRefresh(data): #重新刷新微信号
    refresh_name = data.get("refresh_name")
    print(data)
    if refresh_name:
        temp = {
            "refresh_name": refresh_name
        }
        update(**temp)
Beispiel #6
0
def check_and_update():
    """
    Update people
    :return: None
    """
    print('Updating at', time.ctime(time.time()))
    parsed = get_json()
    for men in parsed['data']:
        store.update(men['name'], men['parallel'], men['session'], LOG_FILE)
Beispiel #7
0
def exitAndSave(root):
    root.destroy()
    global start_date  # 应用启动时的时间
    global kb_count  # 键盘敲击次数
    init_data = store.isExist(start_date)

    if init_data != None:
        store.update(start_date, kb_count, ms_count)

    else:
        store.insert(start_date, kb_count, ms_count)
Beispiel #8
0
    return i + 1


def is_eligible(dentry):
    valid_exts = ["java", "py", "md", "cs", "aspx", "ashx"]
    for ext in valid_exts:
        if dentry.name.endswith(ext):
            return True
    return False


def line_count_in_dir(dname):
    lc = 0
    for entry in os.scandir(dname):
        if entry.is_file() and is_eligible(entry):
            lc += line_count_in_file(entry.path)
        elif entry.is_dir():
            lc += line_count_in_dir(entry)
    return lc


def pull_repo():
    os.system(
        f"if cd {REPO_DIR}; then git pull; else git clone {REPO} {REPO_DIR}; fi"
    )


pull_repo()
lc = line_count_in_dir(REPO_DIR)
store.update(date.today(), lc)
print(lc)