<commit_before>import uos

# File: services.py
# Description: Background services for SHA2017 badge
# License: MIT
# Authors: <NAME> <<EMAIL>>
#          <NAME>   <?>

def setup():
    global services
    try:
        apps = uos.listdir('lib')
    except OSError:
        print("[SERVICES] Can't setup services: no lib folder!")
        return False
    found = False
    for app in apps:
        try:
            files = uos.listdir('lib/'+app)
        except OSError:
            print("[SERVICES] Listing app files for app '"+app+"' failed!")

        for f in files:
            if (f=="service.py"):
                found = True
                print("[SERVICES] Found service "+app+"...")
                try:
                    srv = __import__('lib/'+app+'/service')
                    services.append(srv) #Add to global list
                    srv.setup()
                except BaseException as msg:
                    print("Exception in service setup "+app+": ", msg)
                break
    return found

def loop(lcnt):
    noSleep = False
    global services
    for srv in services:
        try:
            if (srv.loop(lcnt)):
                noSleep = True
        except BaseException as msg:
            print("[SERVICES] Service loop exception: ", msg)
    return noSleep

def draw():
    global services
    x = 0
    y = 114
    for srv in services:
        try:
            space_used = srv.draw(x,y)
            if (space_used>0):
                y = y - abs(space_used)
        except BaseException as msg:
            print("[SERVICES] Service draw exception: ", msg)

services = []
<commit_msg>Change service draw direction (breaks existing services a little bit, can be fixed in eggs by checking firmware version)<commit_after>import uos

# File: services.py
# Description: Background services for SHA2017 badge
# License: MIT
# Authors: <NAME> <<EMAIL>>
#          <NAME>   <?>

def setup():
    global services
    try:
        apps = uos.listdir('lib')
    except OSError:
        print("[SERVICES] Can't setup services: no lib folder!")
        return False
    found = False
    for app in apps:
        try:
            files = uos.listdir('lib/'+app)
        except OSError:
            print("[SERVICES] Listing app files for app '"+app+"' failed!")

        for f in files:
            if (f=="service.py"):
                found = True
                print("[SERVICES] Found service "+app+"...")
                try:
                    srv = __import__('lib/'+app+'/service')
                    services.append(srv) #Add to global list
                    srv.setup()
                except BaseException as msg:
                    print("Exception in service setup "+app+": ", msg)
                break
    return found

def loop(lcnt):
    noSleep = False
    global services
    for srv in services:
        try:
            if (srv.loop(lcnt)):
                noSleep = True
        except BaseException as msg:
            print("[SERVICES] Service loop exception: ", msg)
    return noSleep

def draw():
    global services
    x = 0
    y = 64
    for srv in services:
        try:
            space_used = srv.draw(x,y)
            if (space_used>0):
                y = y + abs(space_used)
        except BaseException as msg:
            print("[SERVICES] Service draw exception: ", msg)

services = []

{'fraction_non_alphanumeric': 0.10546642899584076, 'fraction_numerical': 0.005050505050505051, 'mean_word_length': 1.667987321711569, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '890659', 'n_tokens_mistral': 977, 'n_tokens_neox': 925, 'n_words': 304}