explicitly set __hash__ of Base class to None

This suppressing the warning generated when running offlineimap on
python2 with -3 switch:

  offlineimap/folder/Base.py:29: DeprecationWarning: Overriding __eq__
  blocks inheritance of __hash__ in 3.x

Since this object is mutable it should not be hashable.

From Python documentation[1]:

  A class that overrides __eq__() and does not define __hash__() will
  have its __hash__() implicitly set to None.

Therefore old behaviour is preserved.

[1] https://docs.python.org/3/reference/datamodel.html

Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Łukasz Żarnowiecki 2016-08-05 18:28:53 +00:00 committed by Nicolas Sebrecht
parent 48611398e0
commit f634546980

View File

@ -27,6 +27,8 @@ import offlineimap.accounts
class BaseFolder(object): class BaseFolder(object):
__hash__ = None
def __init__(self, name, repository): def __init__(self, name, repository):
""" """
:param name: Path & name of folder minus root or reference :param name: Path & name of folder minus root or reference