def recognizes(cls, file):
"""
Identifies if a given file has XML extension
Args:
file - a diffoscope.comparators.utils.file.File object
Returns:
False if file is not a XML File, True otherwise
"""
if not super().recognizes(file):
return False
with open(file.path) as f:
try:
file.parsed = _parse(f)
except (ExpatError, UnicodeDecodeError) as e:
return False
return True
评论列表
文章目录