本文整理汇总了Python中inventory.Inventory.perform_inventory方法的典型用法代码示例。如果您正苦于以下问题:Python Inventory.perform_inventory方法的具体用法?Python Inventory.perform_inventory怎么用?Python Inventory.perform_inventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inventory.Inventory
的用法示例。
在下文中一共展示了Inventory.perform_inventory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: detect_change
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import perform_inventory [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)