本文整理汇总了Python中pump.pump.Pump.get方法的典型用法代码示例。如果您正苦于以下问题:Python Pump.get方法的具体用法?Python Pump.get怎么用?Python Pump.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pump.pump.Pump
的用法示例。
在下文中一共展示了Pump.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pump_get_default_filename
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import get [as 别名]
def test_pump_get_default_filename(self):
import os
p = Pump("data/building_def.json")
filename = p.out_filename
p.get()
self.assertTrue(os.path.isfile(filename))
os.remove(filename)
示例2: test_boolean_get
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import get [as 别名]
def test_boolean_get(self):
from pump.vivopump import read_csv
p = Pump("data/faculty_boolean_def.json")
p.get()
data = read_csv('pump_data.txt', delimiter='\t')
nfac = 0
for row, vals in data.items():
if vals['faculty'] == '1':
nfac += 1
self.assertEqual(5, nfac)
示例3: test_get_filter
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import get [as 别名]
def test_get_filter(self):
p = Pump("data/building_def.json")
p.out_filename = "data/buildings_filtered.txt"
n_rows = p.get()
self.assertEqual(2, n_rows)
示例4: test_get_no_filter
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import get [as 别名]
def test_get_no_filter(self):
p = Pump()
p.filter = False
n_rows = p.get()
self.assertEqual(2, n_rows)
示例5: test_pump_get
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import get [as 别名]
def test_pump_get(self):
p = Pump("data/building_def.json")
n_rows = p.get()
print n_rows
self.assertEqual(2, n_rows)
示例6: test_pathlength_def
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import get [as 别名]
def test_pathlength_def(self):
with self.assertRaises(PathLengthException):
p = Pump('data/grant_invalidpathlength_def.json')
n = p.get()
print n
示例7: main
# 需要导入模块: from pump.pump import Pump [as 别名]
# 或者: from pump.pump.Pump import get [as 别名]
def main():
"""
The main function. Does the work of Simple VIVO
:return: None
"""
return_code = 0
print datetime.now(), "Start"
args = get_args()
# Create a Pump and use it to perform the requested actions based on arguments
try:
p = Pump(args.defn, args.src)
except DefNotFoundException:
print args.defn, "definition file not found"
sys.exit(1)
except InvalidDefException as invalid:
print "Invalid definition file", args.defn, "\n", invalid
sys.exit(1)
p.filter = not args.nofilters
p.inter = args.inter
p.intra = args.intra
p.rdfprefix = args.rdfprefix
p.uriprefix = args.uriprefix
p.queryuri = args.queryuri
p.username = args.username
p.password = args.password
p.prefix = args.prefix
if args.action == 'get':
n_rows = p.get()
print datetime.now(), n_rows, "rows in", args.src
elif args.action == 'update':
try:
[add_graph, sub_graph] = p.update()
except IOError:
print args.src, "file not found"
return_code = 1
else:
add_file = open(args.rdfprefix + '_add.rdf', 'w')
print >>add_file, add_graph.serialize(format='nt')
add_file.close()
sub_file = open(args.rdfprefix + '_sub.rdf', 'w')
print >>sub_file, sub_graph.serialize(format='nt')
sub_file.close()
make_inverse_subs(args.rdfprefix + '_sub.rdf', p.query_parms)
print datetime.now(), len(add_graph), 'triples to add', len(sub_graph), 'triples to sub'
elif args.action == 'summarize':
print p.summarize()
elif args.action == 'serialize':
print p.serialize()
elif args.action == 'test':
test_result = p.test()
print test_result
if 'Check' in test_result:
return_code = 1
else:
print datetime.now(), "Unknown action. Try sv -h for help"
print datetime.now(), "Finish"
sys.exit(return_code)