本文整理汇总了Python中world.res_filename函数的典型用法代码示例。如果您正苦于以下问题:Python res_filename函数的具体用法?Python res_filename怎么用?Python res_filename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了res_filename函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_summary_like_expected
def check_summary_like_expected(step, summary_file, expected_file):
summary_contents = []
expected_contents = []
with UnicodeReader(res_filename(summary_file)) as summary_handler:
for line in summary_handler:
summary_contents.append(line)
with UnicodeReader(res_filename(expected_file)) as expected_handler:
for line in expected_handler:
expected_contents.append(line)
eq_(summary_contents, expected_contents)
示例2: i_create_a_multivote
def i_create_a_multivote(step, predictions_file):
predictions_file = res_filename(predictions_file)
try:
with open(predictions_file, 'r') as predictions_file:
world.multivote = MultiVote(json.load(predictions_file))
except IOError:
assert False, "Failed to read %s" % predictions_file
示例3: i_upload_a_file_with_args
def i_upload_a_file_with_args(step, file, args):
resource = world.api.create_source(res_filename(file), json.loads(args))
# update status
world.status = resource['code']
world.location = resource['location']
world.source = resource['object']
# save reference
world.sources.append(resource['resource'])
示例4: i_upload_a_file
def i_upload_a_file(step, file):
resource = world.api.create_source(res_filename(file), {"project": world.project_id})
# update status
world.status = resource["code"]
world.location = resource["location"]
world.source = resource["object"]
# save reference
world.sources.append(resource["resource"])
示例5: the_local_association_set_is_like_file
def the_local_association_set_is_like_file(step, filename):
filename = res_filename(filename)
""" Uncomment if different text settings are used
with open(filename, "w") as filehandler:
json.dump(result, filehandler)
"""
with open(filename) as filehandler:
file_result = json.load(filehandler)
eq_(world.local_association_set, file_result)
示例6: i_upload_a_file_with_args
def i_upload_a_file_with_args(step, file, args):
args = json.loads(args)
args.update({"project": world.project_id})
resource = world.api.create_source(res_filename(file), args)
# update status
world.status = resource["code"]
world.location = resource["location"]
world.source = resource["object"]
# save reference
world.sources.append(resource["resource"])
示例7: the_association_set_is_like_file
def the_association_set_is_like_file(step, filename):
filename = res_filename(filename)
result = world.association_set.get("association_set",{}).get("result", [])
""" Uncomment if different text settings are used
with open(filename, "w") as filehandler:
json.dump(result, filehandler)
"""
with open(filename) as filehandler:
file_result = json.load(filehandler)
eq_(result, file_result)
示例8: i_upload_a_file_from_stdin
def i_upload_a_file_from_stdin(step, file):
file_name = res_filename(file)
with open(file_name, 'rb') as file_handler:
resource = world.api.create_source(file_handler, \
{'project': world.project_id})
# update status
world.status = resource['code']
world.location = resource['location']
world.source = resource['object']
# save reference
world.sources.append(resource['resource'])
示例9: i_create_using_dict_data
def i_create_using_dict_data(step, data):
# slurp CSV file to local variable
mode = "rb"
if sys.version > "3":
mode = "rt"
with open(res_filename(data), mode) as fid:
reader = csv.DictReader(fid)
dict_data = [row for row in reader]
# create source
resource = world.api.create_source(dict_data, {"project": world.project_id})
# update status
world.status = resource["code"]
world.location = resource["location"]
world.source = resource["object"]
# save reference
world.sources.append(resource["resource"])
示例10: i_create_using_dict_data
def i_create_using_dict_data(step, data):
# slurp CSV file to local variable
mode = 'rb'
if sys.version > '3':
mode = 'rt'
with open(res_filename(data), mode) as fid:
reader = csv.DictReader(fid)
dict_data = [row for row in reader]
# create source
resource = world.api.create_source(dict_data)
# update status
world.status = resource['code']
world.location = resource['location']
world.source = resource['object']
# save reference
world.sources.append(resource['resource'])
示例11: i_export_cluster
def i_export_cluster(step, filename):
world.api.export(world.cluster.get('resource'),
filename=res_filename(filename))
示例12: i_export_time_series
def i_export_time_series(step, filename):
world.api.export(world.time_series.get('resource'),
filename=res_filename(filename))
示例13: i_create_local_time_series_from_file
def i_create_local_time_series_from_file(step, export_file):
world.local_time_series = TimeSeries(res_filename(export_file))
示例14: i_create_local_anomaly_from_file
def i_create_local_anomaly_from_file(step, export_file):
world.local_anomaly = Anomaly(res_filename(export_file))
示例15: import_summary_file
def import_summary_file(step, summary_file):
world.fields_struct = world.fields.new_fields_structure( \
csv_attributes_file=res_filename(summary_file))