488 |
488 |
489 __hash__ = object.__hash__ |
489 __hash__ = object.__hash__ |
490 |
490 |
491 def __eq__(self, other): |
491 def __eq__(self, other): |
492 try: |
492 try: |
493 return self.stat == other.stat |
493 # Only dev, ino, size, mtime and atime are likely to change. Out |
|
494 # of these, we shouldn't compare atime but should compare the |
|
495 # rest. However, one of the other fields changing indicates |
|
496 # something fishy going on, so return False if anything but atime |
|
497 # changes. |
|
498 return (self.stat.st_mode == other.stat.st_mode and |
|
499 self.stat.st_ino == other.stat.st_ino and |
|
500 self.stat.st_dev == other.stat.st_dev and |
|
501 self.stat.st_nlink == other.stat.st_nlink and |
|
502 self.stat.st_uid == other.stat.st_uid and |
|
503 self.stat.st_gid == other.stat.st_gid and |
|
504 self.stat.st_size == other.stat.st_size and |
|
505 self.stat.st_mtime == other.stat.st_mtime and |
|
506 self.stat.st_ctime == other.stat.st_ctime) |
494 except AttributeError: |
507 except AttributeError: |
495 return False |
508 return False |
496 |
509 |
497 def __ne__(self, other): |
510 def __ne__(self, other): |
498 return not self == other |
511 return not self == other |