當前位置: 首頁>>代碼示例>>Python>>正文


Python File.get_by_filename方法代碼示例

本文整理匯總了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
開發者ID:0-T-0,項目名稱:TACTIC,代碼行數:13,代碼來源:flash_file_naming.py

示例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)
開發者ID:0-T-0,項目名稱:TACTIC,代碼行數:16,代碼來源:snapshot_builder.py


注:本文中的pyasm.biz.File.get_by_filename方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。