Exemple #1
0
def get_fridge():
    # Make sure cwd is in path
    import sys
    import os
    from lasagnecaterer.menu import empty_fridge
    sys.path.insert(1, os.path.abspath('.'))

    # import the correct class and use classmethod load
    return empty_fridge(sys.argv[0])
Exemple #2
0
def dump_folder_to_db(folder, force=False):
    models = list()
    print(folder)
    loaded = set(c[0].strip() for c in db.query('SELECT path FROM opts'))
    for file in os.scandir(folder):
        if file.name.endswith('.lfr') and 'basemodel.lfr' not in file.name:
            if file.stat().st_size > 0:
                path = fullpath2path(file.path)
                if not (force or path not in loaded):
                    continue
                try:
                    model = empty_fridge(file.path)
                    model2db(model, path)
                    loaded.add(path)
                    print(file.name)
                except zipfile.BadZipFile:
                    print('Corrupt zip', file.name)
Exemple #3
0
def dump_folder_to_db(folder, force=False):
    models = list()
    print(folder)
    loaded = set(c[0].strip() for c in db.query('SELECT path FROM opts'))
    for file in os.scandir(folder):
        if file.name.endswith('.lfr') and 'basemodel.lfr' not in file.name:
            if file.stat().st_size > 0:
                path = fullpath2path(file.path)
                if not (force or path not in loaded):
                    continue
                try:
                    model = empty_fridge(file.path)
                    model2db(model, path)
                    loaded.add(path)
                    print(file.name)
                except zipfile.BadZipFile:
                    print('Corrupt zip', file.name)
                stdscr.addstr(row, col, key)
                col += 1
            if key == '\n':
                row += 1
                col = 0

            out = np.array(list(
                self.f_pred(np.array(X), 100, sentinels=self.sentinels)),
                           dtype=bool)

            suggestion = self.fr.oven.charmap(out)
            stdscr.addstr(row + 1, col, suggestion, curses.A_STANDOUT)
            key = stdscr.getkey(row, col)
            stdscr.addstr(row + 1, col, ' ' * len(suggestion))


def main(fr):
    nw = NovelWriter(fr)
    try:
        wrapper(nw.main)
    except Exception:
        print(nw.outredir.getvalue())
        raise


if __name__ == '__main__':
    import sys
    from lasagnecaterer.menu import empty_fridge
    fr = empty_fridge(sys.argv[1])
    main(fr)
                X.append(x)
                stdscr.addstr(row, col, key)
                col += 1
            if key == '\n':
                row += 1
                col = 0

            out = np.array(list(self.f_pred(np.array(X), 100, sentinels=self.sentinels)),
                           dtype=bool)

            suggestion = self.fr.oven.charmap(out)
            stdscr.addstr(row+1, col, suggestion, curses.A_STANDOUT)
            key = stdscr.getkey(row, col)
            stdscr.addstr(row+1, col, ' ' * len(suggestion))


def main(fr):
    nw = NovelWriter(fr)
    try:
        wrapper(nw.main)
    except Exception:
        print(nw.outredir.getvalue())
        raise


if __name__ == '__main__':
    import sys
    from lasagnecaterer.menu import empty_fridge
    fr = empty_fridge(sys.argv[1])
    main(fr)