Added MarkedIssue.offset_by() utility function to simplify mark offsetting
This commit is contained in:
parent
1b86493599
commit
b808cc53d8
@ -1,3 +1,4 @@
|
||||
import copy
|
||||
|
||||
def find(l, predicate):
|
||||
results = [x for x in l if predicate(x)]
|
||||
@ -111,6 +112,11 @@ class MarkedIssue(Issue):
|
||||
super(MarkedIssue, self).__init__(type, message)
|
||||
self.mark = mark
|
||||
|
||||
def offset_by(self, base_mark):
|
||||
other = copy.copy(self)
|
||||
other.mark = base_mark.merge(self.mark)
|
||||
return other
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s type=%s message=%s mark=%s>' % (str(self.__class__).split('.')[-1][:-2], self.type, self.message, self.mark)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user