code/source: remove support for comparing Source with str
Cross-type comparisons like this are a bad idea. This isn't used.
This commit is contained in:
@@ -44,13 +44,10 @@ class Source:
|
||||
else:
|
||||
self.lines = deindent(getsource(obj).lines)
|
||||
|
||||
def __eq__(self, other):
|
||||
try:
|
||||
return self.lines == other.lines
|
||||
except AttributeError:
|
||||
if isinstance(other, str):
|
||||
return str(self) == other
|
||||
return False
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if not isinstance(other, Source):
|
||||
return NotImplemented
|
||||
return self.lines == other.lines
|
||||
|
||||
# Ignore type because of https://github.com/python/mypy/issues/4266.
|
||||
__hash__ = None # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user