• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ParamManager.ParamManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中askomics.libaskomics.ParamManager.ParamManager的典型用法代码示例。如果您正苦于以下问题:Python ParamManager类的具体用法?Python ParamManager怎么用?Python ParamManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ParamManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_get_database_user_directory

 def test_get_database_user_directory(self):
     m = ParamManager(self.settings, self.request.session)
     d = m.get_database_user_directory()
     assert os.path.isdir(d)
     del self.request.session['username']
     d = m.get_database_user_directory()
     assert os.path.isdir(d)
开发者ID:ofilangi,项目名称:askomics,代码行数:7,代码来源:ParamManager_test.py


示例2: __init__

    def __init__(self, settings, session):
        ParamManager.__init__(self, settings, session)
        self.log = logging.getLogger(__name__)
        self.databasename = "jobs.db"
        self.pathdb = self.get_database_user_directory()+"/"+self.databasename

        self.log.info(" ==> "+ self.pathdb +"<==");

        conn = sqlite3.connect("file:"+self.pathdb,uri=True)
        c = conn.cursor()
        reqSql = '''CREATE TABLE IF NOT EXISTS jobs
             (
             jobID INTEGER PRIMARY KEY AUTOINCREMENT,
             type text,
             state text,
             start int,
             end int ,
             data text,
             file text,
             preview string,
             requestGraph string,
             variates string,
             nr int
             )'''

        c.execute(reqSql)
        conn.commit()
        conn.close()
开发者ID:abretaud,项目名称:askomics,代码行数:28,代码来源:JobManager.py


示例3: test_get_param

 def test_get_param(self):
     m = ParamManager(self.settings, self.request.session)
     m.set_param("test","testValue")
     d = m.get_param("test")
     assert d == "testValue"
     d = m.get_param("test2")
     assert d == ""
开发者ID:ofilangi,项目名称:askomics,代码行数:7,代码来源:ParamManager_test.py


示例4: __init__

    def __init__(self, relation_type, identifier, label, identifier_prefix,rdfs_domain, prefixDomain, rdfs_range, prefixRange):

        type_range =  identifier
        idx = identifier.find("@")
        if idx > 0:
            uridi = identifier[0:idx]
        else:
            uridi = identifier

        if label == "":
            if idx > 0:
                self.label = identifier[0:idx]
            else:
                self.label = identifier
        else:
            self.label = label

        self.uri = ParamManager.encode_to_rdf_uri(uridi,prefix="askomics:")

        self.rdfs_range = rdfs_range

        if relation_type.startswith("entity"):
            self.relation_type = "owl:ObjectProperty"

        elif relation_type == "goterm":
            self.relation_type = "owl:ObjectProperty"
            self.rdfs_range = "owl:Class"
        else:
            self.relation_type = "owl:DatatypeProperty"

        self.rdfs_domain = ParamManager.encode_to_rdf_uri(rdfs_domain,prefixDomain)
        self.log = logging.getLogger(__name__)
开发者ID:abretaud,项目名称:askomics,代码行数:32,代码来源:AbstractedRelation.py


示例5: test_encode_to_rdf_uri

    def test_encode_to_rdf_uri(self):
        r = ParamManager.encode_to_rdf_uri("A",prefix="http://helloworld/test/")
        assert r == "<http://helloworld/test/A>"
        r = ParamManager.encode_to_rdf_uri("A",prefix="<http://helloworld/test/>")
        assert r == "<http://helloworld/test/A>"

        r = ParamManager.encode_to_rdf_uri("A<A>A",prefix="<http://helloworld/test/>")
        assert r == "<http://helloworld/test/A_s3_3CA_s3_3EA>"
开发者ID:askomics,项目名称:askomics,代码行数:8,代码来源:ParamManager_test.py


示例6: test_get_turtle_template

 def test_get_turtle_template(self):
     m = ParamManager(self.settings, self.request.session)
     try:
         m.get_turtle_template(None)
         assert False
     except Exception as e:
         assert True
     m.get_turtle_template(":a :b :c.")
开发者ID:askomics,项目名称:askomics,代码行数:8,代码来源:ParamManager_test.py


示例7: upload_file_into_history

    def upload_file_into_history(self, filename):
        """Upload a file (present in user upload directory) into the testing history

        :param filename: the file to upload
        """

        param_manager = ParamManager(self.settings, self.request.session)
        src_file = param_manager.get_upload_directory()
        self.galaxy_instance.tools.upload_file(src_file + filename, self.history_id, file_name=filename)
开发者ID:abretaud,项目名称:askomics,代码行数:9,代码来源:interface_galaxy.py


示例8: test_get_rdf_user_directory

    def test_get_rdf_user_directory(self):
        m = ParamManager(self.settings, self.request.session)
        d = m.get_rdf_user_directory()
        assert os.path.isdir(d)
        shutil.rmtree(d)

        del self.request.session['username']
        d = m.get_rdf_user_directory()
        assert os.path.isdir(d)
开发者ID:askomics,项目名称:askomics,代码行数:9,代码来源:ParamManager_test.py


示例9: statistics

    def statistics(self):
        """ Get information about triplet store """
        self.log.debug("== STATS ==")
        data = {}
        pm = ParamManager(self.settings, self.request.session)

        sqb = SparqlQueryBuilder(self.settings, self.request.session)
        ql = QueryLauncher(self.settings, self.request.session)
        tse = TripleStoreExplorer(self.settings, self.request.session)

        results = ql.process_query(sqb.get_statistics_number_of_triples().query)
        data["ntriples"] = results[0]["no"]

        results = ql.process_query(sqb.get_statistics_number_of_entities().query)
        data["nentities"] = results[0]["no"]

        results = ql.process_query(sqb.get_statistics_distinct_classes().query)
        data["nclasses"] = results[0]["no"]

        # Get the list of classes
        res_list_classes = ql.process_query(sqb.get_statistics_list_classes().query)

        data["class"] = {}
        for obj in res_list_classes:
            class_name = pm.remove_prefix(obj['class'])
            data["class"][class_name] = {}

        # Get the number of instances by class
        res_nb_instances = ql.process_query(sqb.get_statistics_nb_instances_by_classe().query)

        for obj in res_nb_instances:
            if 'class' in obj:
                class_name = pm.remove_prefix(obj['class'])
                data["class"][class_name]["count"] = obj['count']

        # Get details on relations for each classes
        for obj in res_list_classes:
            if 'class' in obj:
                class_name = pm.remove_prefix(obj['class'])
                uri = obj['class']

                shortcuts_list = tse.has_setting(uri, 'shortcut')

                src = Node(class_name, # We don't care about counter in stats
                    uri,
                    class_name,
                    shortcuts_list)

                attributes, nodes, links = tse.get_neighbours_for_node(src, None)

                data["class"][class_name]["attributes"] = [a.to_dict() for a in attributes]
                data["class"][class_name]["neighbours"] = [n.to_dict() for n in nodes]
                data["class"][class_name]["relations"] = [l.to_dict() for l in links]

        return data
开发者ID:Piezoid,项目名称:askomics,代码行数:55,代码来源:ask_view.py


示例10: test_send_to_history

    def test_send_to_history(self):
        """Test the send_to_history method"""

        galaxy_connector = GalaxyConnector(self.settings, self.request.session, self.galaxy['url'], self.galaxy['key'])

        param_manager = ParamManager(self.settings, self.request.session)
        src_file = param_manager.get_upload_directory()
        filepath = src_file + 'play_instrument.tsv'

        galaxy_connector.send_to_history(filepath, 'play_instrument.tsv', 'tabular')

        assert self.interface_galaxy.check_dataset_presence('play_instrument.tsv') is True
开发者ID:abretaud,项目名称:askomics,代码行数:12,代码来源:GalaxyConnector_test.py


示例11: __init__

    def __init__(self, settings, session,
                 name = None, endpoint = None,
                 username=None, password=None,
                 urlupdate=None):
        ParamManager.__init__(self, settings, session)
        self.log = logging.getLogger(__name__)

        self.name = name
        self.endpoint = endpoint
        self.username = username
        self.password = password
        self.urlupdate = urlupdate
        self.allowUpdate = False
开发者ID:askomics,项目名称:askomics,代码行数:13,代码来源:QueryLauncher.py


示例12: __init__

    def __init__(self, settings, session, name = None, endpoint = None ,username=None, password=None,urlupdate=None,auth='Basic'):
        ParamManager.__init__(self, settings, session)
        self.log = logging.getLogger(__name__)

        self.name = name
        self.endpoint = endpoint
        self.username = username
        self.password = password
        self.urlupdate = urlupdate
        self.auth = auth
        self.allowUpdate = False

        if self.auth != 'Basic' and self.auth != 'Digest':
            raise ValueError("Invalid Auth parameter :"+self.auth)
开发者ID:abretaud,项目名称:askomics,代码行数:14,代码来源:QueryLauncher.py


示例13: __init__

    def __init__(self, settings, session):
        '''
            Manage Modules Askomics
        '''
        ParamManager.__init__(self, settings, session)

        '''
            All modules have to be composed with thes keys
        '''
        self.latt = ['module','comment','version','owl','rdf']

        self.moduleFiles = {}
        self.graph_modules="askomics:graph:module"
        self.modulesdir='askomics/static/modules/'
        self.data = {}
开发者ID:ofilangi,项目名称:askomics,代码行数:15,代码来源:ModulesManager.py


示例14: saveStartSparqlJob

    def saveStartSparqlJob(self,typeJob,requestGraph="{}",variates="{}"):

        conn = sqlite3.connect(self.pathdb,uri=True)
        c = conn.cursor()

        requestGraph = urllib.parse.quote(requestGraph)
        variates = ParamManager.encode(str(variates))

        reqSql = "INSERT INTO jobs VALUES ("\
                + "NULL,"     \
                +"'"+typeJob+"'," \
                + "'Wait',"     \
                + "strftime('%s','now'),"\
                + "0,"\
                + "NULL,"\
                + "''," \
                + "''," \
                + "'"+requestGraph+"'," \
                + "'"+variates+"'," \
                + "-1" \
                + ");"

        c.execute(reqSql)
        ID = c.lastrowid

        conn.commit()
        conn.close()
        return ID
开发者ID:abretaud,项目名称:askomics,代码行数:28,代码来源:JobManager.py


示例15: updateEndSparqlJob

    def updateEndSparqlJob(self,jobid,state,nr=-1, data=None, file=None):
        import json

        conn = sqlite3.connect(self.pathdb,uri=True)
        c = conn.cursor()

        d = 'NULL'

        if data:
            d = "'"+ParamManager.encode(json.dumps(data, ensure_ascii=False))+"'"

        f = 'NULL'
        if file:
            f = "'"+file+"'"

        reqSql = "UPDATE jobs SET "\
                + " state = '"+ state +"'," \
                + " end = strftime('%s','now'),"\
                + " nr = "+str(nr)+","\
                + " data = "+ d +"," \
                + " file = "+ f \
                + " WHERE jobID = "+str(jobid)

        c.execute(reqSql)
        conn.commit()
        conn.close()
开发者ID:abretaud,项目名称:askomics,代码行数:26,代码来源:JobManager.py


示例16: __init__

    def __init__(self, settings, session, type_dict=None, delims=None):
        #FIXME: Can we get dict()s from config ?
        self.type_dict = {
            'Numeric' : 'xsd:decimal',
            'Text'    : 'xsd:string',
            'Category': ':',
            'Entity'  : ':'} if type_dict is None else type_dict

        self.delims = {
            'Numeric' : ('', ''),
            'Text'    : ('"', '"'),
            'Category': (':', ''),
            'Entity'  : (':', '')} if delims is None else delims

        ParamManager.__init__(self, settings, session)
        self.log = logging.getLogger(__name__)
开发者ID:odameron,项目名称:askomics,代码行数:16,代码来源:SourceFileConvertor.py


示例17: source_file_overview

    def source_file_overview(self):
        """ Get the first lines of the tabulated files to convert """
        data = {}
        sfc = SourceFileConvertor(self.settings, self.request.session)

        pm = ParamManager(self.settings, self.request.session)

        source_files_first_lines = sfc.get_first_lines(int(self.settings["askomics.overview_lines_limit"])) # FIXME handle default value/value validation
        html_template = sfc.get_template(pm.ASKOMICS_html_template) # FIXME there must be a more elegant solution
        #turtle_template = sfc.get_template(self.settings["askomics.turtle_template"]) # FIXME there must be a more elegant solution

        turtle_template = pm.turtle_template()
        data["sourceFiles"] = {s.get_name(): s.to_dict() for s in source_files_first_lines}
        data["html_template"] = html_template
        data["turtle_template"] = turtle_template

        return data
开发者ID:odameron,项目名称:askomics,代码行数:17,代码来源:ask_view.py


示例18: __init__

    def __init__(self, settings, session):
        ParamManager.__init__(self, settings, session)

        self.log = logging.getLogger(__name__)

        self.ldap_server = self.settings['askomics.ldap_host']
        self.ldap_port = self.settings['askomics.ldap_port']
        # self.ldap_bind_dn = self.settings['askomics.ldap_bind_dn']
        # self.ldap_bind_passwd = self.settings['askomics.ldap_bind_passwd']
        self.ldap_user_search_base = self.settings['askomics.ldap_user_search_base']
        self.ldap_user_filter = self.settings['askomics.ldap_user_filter']
        self.ldap_username_attr = self.settings['askomics.ldap_username_attr']
        self.ldap_email_attr = self.settings['askomics.ldap_email_attr']

        self.username = None
        self.password = None
        self.email = None
开发者ID:askomics,项目名称:askomics,代码行数:17,代码来源:LdapAuth.py


示例19: __init__

    def __init__(self, settings, session, username, email, password, password2):
        ParamManager.__init__(self, settings, session)

        self.log = logging.getLogger(__name__)
        self.username = str(username)
        self.email = str(email)
        self.passwd = str(password)
        self.passwd2 = str(password2)
        self.admin = False
        self.blocked = True
        self.galaxy = False

        # concatenate askmics salt, password and random salt and hash it with sha256 function
        # see --"https://en.wikipedia.org/wiki/Salt_(cryptography)"-- for more info about salt
        alpabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
        self.randomsalt = ''.join(random.choice(alpabet) for i in range(20))
        salted_pw = self.settings["askomics.salt"] + self.passwd + self.randomsalt
        self.sha256_pw = hashlib.sha256(salted_pw.encode('utf8')).hexdigest()
开发者ID:ofilangi,项目名称:askomics,代码行数:18,代码来源:Security.py


示例20: __init__

    def __init__(self, settings, session, path, uri_set=None):

        ParamManager.__init__(self, settings, session)

        self.timestamp = datetime.datetime.now().isoformat()

        self.path = path

        self.metadatas = {}

        # The name should not contain extension as dots are not allowed in rdf names
        # self.name = os.path.splitext(os.path.basename(path))[0]
        self.name = os.path.basename(path)
        self.alphanum_name = re.sub('[^0-9a-zA-Z]+', '_', self.name)

        self.graph = 'askomics:unkown:uri:graph'
        if 'graph' in self.session:
            self.graph = self.session['graph']

        # Graph name can't contain any non alphanumeric characters. replace all with _
        self.graph = self.graph + ':' + self.alphanum_name + '_' + self.timestamp

        self.log = logging.getLogger(__name__)

        self.reset_cache()

        self.uri = {}
        pref_uri = "http://semanticweb.org/askomics/entity/"
        if self.is_defined('askomics.prefix'):
            pref_uri = self.get_param("askomics.prefix")

        self.uri = [ pref_uri for idx in range(20) ]

        if uri_set != None:
            for idx,uri in uri_set.items():
                if uri:
                    # uri have to end with # or /
                    if not uri.endswith('#') and not uri.endswith('/'):
                        uri = uri + "/"
                    self.uri[int(idx)] = uri
                else:
                    self.uri[int(idx)] = self.get_param("askomics.prefix")
开发者ID:abretaud,项目名称:askomics,代码行数:42,代码来源:SourceFile.py



注:本文中的askomics.libaskomics.ParamManager.ParamManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python QueryLauncher.QueryLauncher类代码示例发布时间:2022-05-24
下一篇:
Python context.get_for_tag_editor函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap