From 17d73dd36f7419ae0bed9d3668919961411295d1 Mon Sep 17 00:00:00 2001 From: Foo Date: Sun, 1 Mar 2015 14:29:07 +0300 Subject: [PATCH] Define __eq__ for marks --- powerline/lint/markedjson/error.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/powerline/lint/markedjson/error.py b/powerline/lint/markedjson/error.py index 093bdfea..be0cd6d1 100644 --- a/powerline/lint/markedjson/error.py +++ b/powerline/lint/markedjson/error.py @@ -138,6 +138,13 @@ class Mark: def __str__(self): return self.to_string() + def __eq__(self, other): + return self is other or ( + self.name == other.name + and self.line == other.line + and self.column == other.column + ) + def echoerr(**kwargs): stream = kwargs.pop('stream', sys.stderr) @@ -154,9 +161,7 @@ def format_error(context=None, context_mark=None, problem=None, problem_mark=Non context_mark is not None and ( problem is None or problem_mark is None - or context_mark.name != problem_mark.name - or context_mark.line != problem_mark.line - or context_mark.column != problem_mark.column + or context_mark != problem_mark ) ): lines.append(context_mark.to_string(indent=indent))