当前位置: 首页>>代码示例>>Python>>正文


Python Inventory.read方法代码示例

本文整理汇总了Python中inventory.Inventory.read方法的典型用法代码示例。如果您正苦于以下问题:Python Inventory.read方法的具体用法?Python Inventory.read怎么用?Python Inventory.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在inventory.Inventory的用法示例。


在下文中一共展示了Inventory.read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_inventory

# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import read [as 别名]
 def update_inventory(self, inventory_report):
     for inventory_diff in inventory_report.inventory_diffs:
         log.info('Updating inventory for %s', inventory_diff.path)
         try:
             inventory_inventory = Inventory.read(inventory_diff.path, self.base_inventory_path)
         except FileNotFoundError:
             inventory_inventory = Inventory(inventory_diff.path)
         inventory_inventory.update(inventory_diff.directories_missing_from_inventory,
                                    inventory_diff.directories_missing_from_fs,
                                    inventory_diff.files_missing_from_inventory,
                                    inventory_diff.files_missing_from_fs,
                                    inventory_diff.file_fixity_mismatch,
                                    timestamp=inventory_diff.timestamp)
         inventory_inventory.write(self.base_inventory_path)
开发者ID:gwu-libraries,项目名称:inventory,代码行数:16,代码来源:audit_tool.py

示例2: detect_change

# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import read [as 别名]
 def detect_change(self, path):
     log.info('Detecting changes for %s', path)
     inventory_diffs = []
     fs_inventories = Inventory.perform_recursive_inventory(path, self.base_fs_path,
                                                            fixity_threads=self.fixity_threads)
     # If path is not base path, check parent non-recursively to make sure added/deleted directory handled.
     if path != self.base_fs_path:
         fs_inventories.append(
             Inventory.perform_inventory(os.path.dirname(path), self.base_fs_path,
                                         fixity_threads=self.fixity_threads))
     for fs_inventory in fs_inventories:
         try:
             inventory_inventory = Inventory.read(fs_inventory.path, self.base_inventory_path)
         except FileNotFoundError:
             inventory_inventory = Inventory(fs_inventory.path)
         inventory_diff = InventoryDiff.generate_inventory_diff(fs_inventory, inventory_inventory)
         if inventory_diff.has_diffs():
             inventory_diffs.append(inventory_diff)
     return InventoryReport(path, inventory_diffs)
开发者ID:gwu-libraries,项目名称:inventory,代码行数:21,代码来源:audit_tool.py


注:本文中的inventory.Inventory.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。