本文整理匯總了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)