コード例 #1
0
def open_notebook(arg,
                  _user_info_db=_user_info_db,
                  scene_root=_scene_root,
                  history_db=_history_db,
                  library_db=_library_db,
                  model_db=_model_db,
                  azure_data_studio_location=_azure_data_studio_location,
                  current_scene_db=None,
                  test=False):
    """handles opening a notebook"""
    from src.praxxis.notebook import open_notebook
    from src.praxxis.util import roots
    from src.praxxis.sqlite import sqlite_user

    default_editor = sqlite_user.get_user_info(_user_info_db)[6][1]
    editor = input_editor = arg.viewer

    if input_editor == None:
        editor = default_editor

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    open_notebook.open_notebook(arg, current_scene_db, library_db,
                                azure_data_studio_location, editor, True)
コード例 #2
0
ファイル: entry_parameter.py プロジェクト: stuartpa/praxxis
def set_param(arg,
              scene_root=_scene_root,
              history_db=_history_db,
              current_scene_db=None):
    """handles setting a parameter"""
    from src.praxxis.parameter import set_param
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    set_param.set_param(arg, scene_root, history_db, current_scene_db)
コード例 #3
0
def end_scene(arg,
              scene_root=_scene_root,
              history_db=_history_db,
              current_scene_db=None):
    """handles ending a scene"""
    from src.praxxis.scene import end_scene
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    end_scene.end_scene(arg, scene_root, history_db, current_scene_db)
コード例 #4
0
ファイル: entry_parameter.py プロジェクト: stuartpa/praxxis
def view_notebook_param(arg,
                        scene_root=_scene_root,
                        library_db=_library_db,
                        history_db=_history_db,
                        current_scene_db=None):
    """handles viewing notebook parameters"""
    from src.praxxis.parameter import list_param
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    list_param.list_notebook_param(arg, library_db, current_scene_db)
コード例 #5
0
def remove_notebook(arg,
                    scene_root=_scene_root,
                    history_db=_history_db,
                    library_db=_library_db,
                    current_scene_db=None):
    """handles removing a notebook from the CLI"""
    from src.praxxis.notebook import remove_notebook
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    remove_notebook.remove_notebook(arg, library_db, current_scene_db)
コード例 #6
0
def add_output(arg,
               output_root=_output_root,
               scene_root=_scene_root,
               history_db=_history_db,
               current_scene_db=None,
               user_info_db=_user_info_db):
    """handles adding output to a notebook"""
    from src.praxxis.notebook import add_output
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)
    add_output.add_output(arg, output_root, current_scene_db, user_info_db)
コード例 #7
0
ファイル: entry_parameter.py プロジェクト: stuartpa/praxxis
def pull_notebook_param(arg,
                        library_db=_library_db,
                        scene_root=_scene_root,
                        history_db=_history_db,
                        current_scene_db=None):
    """handles pulling parameters out of a notebook"""
    from src.praxxis.parameter import pull_param
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    pull_param.pull_notebook_parameter(arg, library_db, current_scene_db)
コード例 #8
0
def history(arg,
            scene_root=_scene_root,
            history_db=_history_db,
            library_db=_library_db,
            current_scene_db=None):
    """handles displaying scene history"""
    from src.praxxis.scene import history
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    history.history(history_db, library_db, current_scene_db)
コード例 #9
0
ファイル: entry_parameter.py プロジェクト: stuartpa/praxxis
def list_param(arg,
               scene_root=_scene_root,
               history_db=_history_db,
               query_start=_query_start,
               query_end=_query_end,
               current_scene_db=None):
    """handles listing parameters in current scene"""
    from src.praxxis.parameter import list_param
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    list_param.list_param(current_scene_db, query_start, query_end)
コード例 #10
0
def search_notebook(arg,
                    scene_root=_scene_root,
                    history_db=_history_db,
                    library_db=_library_db,
                    query_start=_query_start,
                    query_end=_query_end,
                    current_scene_db=None):
    """handles searching for a notebook"""
    from src.praxxis.notebook import search_notebook
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    search_notebook.search_notebook(arg, library_db, current_scene_db,
                                    query_start, query_end)
コード例 #11
0
ファイル: entry_parameter.py プロジェクト: stuartpa/praxxis
def view_library_param(arg,
                       scene_root=_scene_root,
                       history_db=_history_db,
                       library_db=_library_db,
                       query_start=_query_start,
                       query_end=_query_end,
                       current_scene_db=None):
    """handles viewing library parameters"""
    from src.praxxis.parameter import list_param
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    list_param.list_library_param(arg, library_db, current_scene_db,
                                  query_start, query_end)
コード例 #12
0
ファイル: entry_notebook.py プロジェクト: stuartpa/praxxis
def list_notebook(arg,
                  scene_root=_scene_root,
                  history_db=_history_db,
                  library_root=_library_root,
                  library_db=_library_db,
                  query_start=_query_start,
                  query_end=_query_end,
                  current_scene_db=None):
    """calls the function to list notebooks"""
    from src.praxxis.notebook import list_notebook
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    list_notebook.list_notebook(library_db, current_scene_db, query_start, query_end)
コード例 #13
0
ファイル: entry_parameter.py プロジェクト: stuartpa/praxxis
def pull_library_param(arg,
                       library_db=_library_db,
                       scene_root=_scene_root,
                       history_db=_history_db,
                       current_scene_db=None,
                       query_start=_query_start,
                       query_end=_query_end):
    """handles pulling parameters out of a library"""
    from src.praxxis.parameter import pull_param
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    pull_param.pull_library_parameter(arg, library_db, current_scene_db,
                                      query_start, query_end)
コード例 #14
0
ファイル: entry_rulesengine.py プロジェクト: stuartpa/praxxis
def add_rule_to_ruleset(arg,
                        rulesengine_db=_rulesengine_db,
                        library_db=_library_db,
                        current_scene_db=None,
                        scene_root=_scene_root,
                        history_db=_history_db,
                        query_start=_query_start,
                        query_end=_query_end):
    """handles adding a rule to a ruleset"""
    from src.praxxis.util import roots
    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    from src.praxxis.rulesengine import add_rule_to_ruleset
    add_rule_to_ruleset.add_rule_to_ruleset(arg, rulesengine_db, library_db,
                                            current_scene_db, query_start,
                                            query_end)
コード例 #15
0
ファイル: entry_notebook.py プロジェクト: stuartpa/praxxis
def next_notebook(arg,
                  user_info_db=_user_info_db,
                  scene_root=_scene_root,
                  history_db=_history_db,
                  current_scene_db=None,
                  library_db=_library_db,
                  rulesengine_db=_rulesengine_db,
                  query_start=_query_start,
                  query_end=_query_end):
    """handles getting the predicted next notebook"""
    from src.praxxis.notebook import what_next
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    what_next.what_next(arg, user_info_db, current_scene_db, library_db, rulesengine_db, query_start, query_end)
コード例 #16
0
ファイル: entry_notebook.py プロジェクト: stuartpa/praxxis
def open_notebook(arg,
                  scene_root=_scene_root,
                  history_db=_history_db,
                  library_db=_library_db,
                  azure_data_studio_location=_azure_data_studio_location,
                  current_scene_db=None,
                  test=False):
    """handles opening a notebook"""
    from src.praxxis.notebook import open_notebook
    from src.praxxis.util import roots

    # TODO: allow for selecting your own editor on first run
    editor = "vim"

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    open_notebook.open_notebook(arg, current_scene_db, library_db, azure_data_studio_location, editor, True)
コード例 #17
0
def run_notebook(arg,
                 user_info_db=_user_info_db,
                 output_root=_output_root,
                 library_root=_library_root,
                 library_db=_library_db,
                 scene_root=_scene_root,
                 history_db=_history_db,
                 current_scene_db=None,
                 query_start=_query_start,
                 query_end=_query_end):
    """handles running a notebook"""
    from src.praxxis.notebook import run_notebook
    from src.praxxis.util import roots

    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    run_notebook.run_notebook(arg, user_info_db, output_root, current_scene_db,
                              library_root, library_db, query_start, query_end)
コード例 #18
0
ファイル: entry_rulesengine.py プロジェクト: stuartpa/praxxis
def edit_ruleset(arg,
                 rulesengine_db=_rulesengine_db,
                 library_db=_library_db,
                 current_scene_db=None,
                 scene_root=_scene_root,
                 history_db=_history_db,
                 query_start=_query_start,
                 query_end=_query_end):
    """handles editing a ruleset"""
    from src.praxxis.util import roots
    if current_scene_db is None:
        current_scene_db = roots.get_current_scene_db(scene_root, history_db)

    if arg.action == 'a':
        add_rule_to_ruleset(arg, rulesengine_db)
    elif arg.action == 'd':
        delete_rule_from_ruleset(arg, rulesengine_db)
    elif arg.action == 'm':
        modify_rule_in_ruleset(arg, rulesengine_db)
    return
コード例 #19
0
def setup(init_root, library_root, telemetry_db, library_db, output_root,
          scene_root, history_db, default_scene_name, query_start, query_end,
          rulesengine_root, rulesengine_db):
    """
    sets up directories in the temp dir
    """
    from src.praxxis.sqlite import sqlite_init
    from src.praxxis.sqlite import sqlite_scene
    from src.praxxis.sqlite import sqlite_library
    from src.praxxis.sqlite import sqlite_rulesengine
    from src.praxxis.util import roots
    from src.praxxis.scene import new_scene
    from src.praxxis.scene import list_scene
    from src.praxxis.parameter import list_param
    from src.praxxis.library import list_library
    from src.praxxis.notebook import list_notebook
    from src.praxxis.sqlite import sqlite_telemetry

    if not os.path.exists(init_root):
        os.mkdir(init_root)
        assert os.path.exists(init_root)

    if not os.path.exists(library_root):
        os.mkdir(library_root)
        assert os.path.exists(library_root)

    if not os.path.exists(library_db):
        sqlite_init.init_library_db(library_db)
        assert os.path.exists(library_db)

    if not os.path.exists(output_root):
        os.mkdir(output_root)
        assert os.path.exists(output_root)

    if not os.path.exists(scene_root):
        os.mkdir(scene_root)
        assert os.path.exists(scene_root)

    if not os.path.exists(history_db):
        sqlite_init.init_history(history_db, default_scene_name)
        assert os.path.exists(history_db)

    if not os.path.exists(telemetry_db):
        sqlite_init.init_user_info(telemetry_db, 0)

    if not os.path.exists(rulesengine_root):
        os.mkdir(rulesengine_root)
        assert os.path.exists(rulesengine_root)

    if not os.path.exists(rulesengine_db):
        sqlite_init.init_rulesengine_db(rulesengine_db)

    new_scene.new_scene(default_scene_name, scene_root, history_db)
    yield
    current_scene_db = roots.get_current_scene_db(scene_root, history_db)
    assert len(list_scene.list_scene(init_root, history_db)) == 1
    assert len(list_param.list_param(current_scene_db, query_start,
                                     query_end)) == 0
    assert len(list_library.list_library(library_db, query_start,
                                         query_end)) == 0
    assert len(
        list_notebook.list_notebook(library_db, current_scene_db, query_start,
                                    query_end)) == 0
コード例 #20
0
ファイル: set_roots.py プロジェクト: stuartpa/praxxis
def current_scene_db(init_root, scene_root, history_db):
    from src.praxxis.util import roots
    return roots.get_current_scene_db(scene_root, history_db)
コード例 #21
0
ファイル: test_roots.py プロジェクト: stuartpa/praxxis
def test_get_current_scene_db(setup, scene_root, history_db):
    import os
    
    current_scene_db = roots.get_current_scene_db(scene_root, history_db)
    assert os.path.basename(current_scene_db) == "scene.db"