本文整理汇总了Python中askomics.libaskomics.ParamManager.ParamManager类的典型用法代码示例。如果您正苦于以下问题:Python ParamManager类的具体用法?Python ParamManager怎么用?Python ParamManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParamManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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()
示例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 == ""
示例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__)
示例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>"
示例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.")
示例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)
示例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)
示例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
示例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
示例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
示例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)
示例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 = {}
示例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
示例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()