本文整理汇总了Python中pyasm.biz.File.get_by_filename方法的典型用法代码示例。如果您正苦于以下问题:Python File.get_by_filename方法的具体用法?Python File.get_by_filename怎么用?Python File.get_by_filename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.biz.File
的用法示例。
在下文中一共展示了File.get_by_filename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_unique_filename
# 需要导入模块: from pyasm.biz import File [as 别名]
# 或者: from pyasm.biz.File import get_by_filename [as 别名]
def _get_unique_filename(my):
filename = my.file_object.get_full_file_name()
# find if this filename has been used for this project
file = File.get_by_filename(filename, skip_id=my.file_object.get_id())
if file:
root, ext = os.path.splitext(filename)
parts = [root]
filename = my.add_ending(parts, auto_version=True)
return filename
else:
return None
示例2: add_ref_by_file_path
# 需要导入模块: from pyasm.biz import File [as 别名]
# 或者: from pyasm.biz.File import get_by_filename [as 别名]
def add_ref_by_file_path(my, file_path, type='ref', node_name='', tag='main'):
'''add a reference based on the file name. If the file is unique, then
a reference can be found based on the file name'''
from pyasm.biz import File
filename = os.path.basename(file_path)
file = File.get_by_filename(filename, padding=4)
if not file:
Environment.add_warning("Unknown File Reference", "File reference [%s] does not exist in database" % file_path)
my.add_unknown_ref(file_path)
return
else:
snapshot_code = file.get_value("snapshot_code")
return my.add_ref_by_snapshot_code(snapshot_code, type=type, node_name=node_name, tag=tag)