コード例 #1
0
ファイル: wave.py プロジェクト: dgoyard/zeijemol
    def __init__(self, instance_name, login, password):
        """ Initialize the WaveImporter class.

        Parameters
        ----------
        instance_name: str (mandatory)
            the name of the cubicweb instance based in the 'snapview' cube.
        login: str (mandatory)
            a login.
        password: str (mandatory)
            the corresponding password.
        """
        # Create a cw session
        config = cwconfig.instance_configuration(instance_name)
        self.repo, self.cnx = in_memory_repo_cnx(
            config, login=login, password=password)
        self.session = self.repo._get_session(self.cnx.sessionid)
コード例 #2
0
def get_cw_cnx(endpoint):
    """ Get a cnx on a CubicWeb database
    """
    from cubicweb import dbapi
    from cubicweb.__pkginfo__ import numversion
    from cubicweb.cwconfig import CubicWebConfiguration
    from cubicweb.entities import AnyEntity
    CubicWebConfiguration.load_cwctl_plugins()
    config = CubicWebConfiguration.config_for(endpoint)
    if numversion < (3, 19):
        sourceinfo = config.sources()['admin']
    else:
        sourceinfo = config.default_admin_config
    login = sourceinfo['login']
    password = sourceinfo['password']
    _, cnx = dbapi.in_memory_repo_cnx(config, login, password=password)
    req = cnx.request()
    return req
コード例 #3
0
ファイル: import_toy_dataset.py プロジェクト: dgoyard/piws
        "login": "******",
        "password": "******",
        "group_names": ["toy_V1", "users"]
    },
    "user3": {
        "login": "******",
        "password": "******",
        "group_names": ["toy", "users"]
    }
}
STUDY_NAME = "toy"
CENTER_NAME = "home"

# Create a cw session
config = cwconfig.instance_configuration(instance_name)
repo, cnx = in_memory_repo_cnx(config, login=login, password=password)
session = repo._get_session(cnx.sessionid)

# Parse the file system
subjects = subject_parser(demo_path, STUDY_NAME)
scans = scan_parser(demo_path, STUDY_NAME)
questionnaires = questionnaire_parser(demo_path, STUDY_NAME)
genetics = genetic_parser(demo_path, STUDY_NAME)
processings = freesurfer_parser(demo_path, STUDY_NAME)

# Define all the importers
db_grp_importer = CWGroups(session, ["toy_V0", "toy_V1", "toy", "uploaders"],
                           use_store=False)
db_user_importer = CWUsers(session, USERS)
db_subject_importer = Subjects(
    session, STUDY_NAME, subjects, use_store=False)
コード例 #4
0
        "login": "******",
        "password": "******",
        "group_names": ["toy_V1", "users"]
    },
    "user3": {
        "login": "******",
        "password": "******",
        "group_names": ["toy", "users"]
    }
}
STUDY_NAME = "toy"
CENTER_NAME = "home"

# Create a cw session
config = cwconfig.instance_configuration(instance_name)
repo, cnx = in_memory_repo_cnx(config, login=login, password=password)
session = repo._get_session(cnx.sessionid)

# Parse the file system
subjects = subject_parser(demo_path, STUDY_NAME)
scans = scan_parser(demo_path, STUDY_NAME)
questionnaires = questionnaire_parser(demo_path, STUDY_NAME)
genetics = genetic_parser(demo_path, STUDY_NAME)
processings = freesurfer_parser(demo_path, STUDY_NAME)

# Define all the importers
db_grp_importer = CWGroups(session, ["toy_V0", "toy_V1", "toy", "uploaders"],
                           use_store=False)
db_user_importer = CWUsers(session, USERS)
db_subject_importer = Subjects(session, STUDY_NAME, subjects, use_store=False)
db_scan_importer = Scans(session,