1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-11 07:06:16 +01:00

Allow comparing File with a string

This commit is contained in:
Daniel Mach 2022-10-24 17:01:55 +02:00
parent 55503e13ca
commit 7d64d5d425

View File

@ -266,6 +266,8 @@ class File:
return self.name return self.name
def __eq__(self, other): def __eq__(self, other):
if isinstance(other, str):
return self.name == other
self_data = (self.name, self.md5, self.size, self.mtime, self.skipped) self_data = (self.name, self.md5, self.size, self.mtime, self.skipped)
other_data = (other.name, other.md5, other.size, other.mtime, other.skipped) other_data = (other.name, other.md5, other.size, other.mtime, other.skipped)
return self_data == other_data return self_data == other_data