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


Python Difference.add_details方法代码示例

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


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

示例1: compare

# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import add_details [as 别名]
 def compare(self, other, source=None):
     differences = []
     try:
         listing_diff = Difference.from_text('\n'.join(list_files(self.path)),
                                             '\n'.join(list_files(other.path)),
                                             self.path, other.path, source='file list')
         if listing_diff:
             differences.append(listing_diff)
     except RequiredToolNotFound:
         logger.info("Unable to find 'getfacl'.")
     differences.extend(compare_meta(self.name, other.name))
     my_container = DirectoryContainer(self)
     other_container = DirectoryContainer(other)
     my_names = my_container.get_member_names()
     other_names = other_container.get_member_names()
     for name in sorted(set(my_names).intersection(other_names)):
         my_file = my_container.get_member(name)
         other_file = other_container.get_member(name)
         inner_difference = diffoscope.comparators.compare_files(
                                my_file, other_file, source=name)
         meta_differences = compare_meta(my_file.name, other_file.name)
         if meta_differences and not inner_difference:
             inner_difference = Difference(None, my_file.path, other_file.path)
         if inner_difference:
             inner_difference.add_details(meta_differences)
             differences.append(inner_difference)
     if not differences:
         return None
     difference = Difference(None, self.path, other.path, source)
     difference.add_details(differences)
     return difference
开发者ID:anthraxx,项目名称:diffoscope,代码行数:33,代码来源:directory.py

示例2: _compare_using_details

# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import add_details [as 别名]
 def _compare_using_details(self, other, source):
     details = [d for d in self.compare_details(other, source) if d is not None]
     if len(details) == 0:
         return None
     difference = Difference(None, self.name, other.name, source=source)
     difference.add_details(details)
     return difference
开发者ID:pombredanne,项目名称:diffoscope-1,代码行数:9,代码来源:binary.py

示例3: compare

# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import add_details [as 别名]
 def compare(self, other, source=None):
     differences = []
     try:
         find_diff = Difference.from_command(FindAll, self.path, other.path)
         if find_diff:
             differences.append(find_diff)
     except RequiredToolNotFound:
         logger.info("Unable to find 'getfacl'.")
     differences.extend(compare_meta(self.name, other.name))
     with DirectoryContainer(self).open() as my_container, \
          DirectoryContainer(other).open() as other_container:
         my_names = my_container.get_member_names()
         other_names = other_container.get_member_names()
         for name in sorted(set(my_names).intersection(other_names)):
             my_file = my_container.get_member(name)
             other_file = other_container.get_member(name)
             with my_file.get_content(), other_file.get_content():
                 inner_difference = diffoscope.comparators.compare_files(
                                        my_file, other_file, source=name)
                 meta_differences = compare_meta(my_file.name, other_file.name)
                 if meta_differences and not inner_difference:
                     inner_difference = Difference(None, my_file.path, other_file.path)
                 if inner_difference:
                     inner_difference.add_details(meta_differences)
                     differences.append(inner_difference)
     if not differences:
         return None
     difference = Difference(None, self.path, other.path, source)
     difference.add_details(differences)
     return difference
开发者ID:pombredanne,项目名称:diffoscope-1,代码行数:32,代码来源:directory.py

示例4: _compare_using_details

# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import add_details [as 别名]
 def _compare_using_details(self, other, source):
     details = []
     if hasattr(self, 'compare_details'):
         details.extend(filter(None, self.compare_details(other, source)))
     if self.as_container:
         details.extend(filter(None, self.as_container.compare(other.as_container)))
     if not details:
         return None
     difference = Difference(None, self.name, other.name, source=source)
     difference.add_details(details)
     return difference
开发者ID:satyamz,项目名称:diffoscope,代码行数:13,代码来源:binary.py

示例5: compare

# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import add_details [as 别名]
 def compare(self, other, source=None):
     my_encoding = self.encoding or 'utf-8'
     other_encoding = other.encoding or 'utf-8'
     try:
         with codecs.open(self.path, 'r', encoding=my_encoding) as my_content, \
              codecs.open(other.path, 'r', encoding=other_encoding) as other_content:
             difference = Difference.from_text_readers(my_content, other_content, self.name, other.name, source)
             if my_encoding != other_encoding:
                 if difference is None:
                     difference = Difference(None, self.path, other.path, source)
                 difference.add_details([Difference.from_text(my_encoding, other_encoding, None, None, source='encoding')])
             return difference
     except (LookupError, UnicodeDecodeError):
         # unknown or misdetected encoding
         return self.compare_bytes(other, source)
开发者ID:pombredanne,项目名称:diffoscope-1,代码行数:17,代码来源:text.py


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