| Conditions | 1 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | from coalib.misc.Decorators import generate_ordering, generate_repr |
||
| 6 | class Match: |
||
| 7 | """ |
||
| 8 | Stores information about a single textual match. |
||
| 9 | """ |
||
| 10 | |||
| 11 | def __init__(self, match, position): |
||
| 12 | """ |
||
| 13 | Instantiates a new Match. |
||
| 14 | |||
| 15 | :param match: The actual matched string. |
||
| 16 | :param position: The position where the match was found. Starts from |
||
| 17 | zero. |
||
| 18 | """ |
||
| 19 | self._match = match |
||
| 20 | self._position = position |
||
| 21 | |||
| 22 | def __len__(self): |
||
| 23 | return len(self.match) |
||
| 24 | |||
| 25 | def __str__(self): |
||
| 26 | return self.match |
||
| 27 | |||
| 28 | @property |
||
| 29 | def match(self): |
||
| 30 | """ |
||
| 31 | Returns the text matched. |
||
| 32 | |||
| 33 | :returns: The text matched. |
||
| 34 | """ |
||
| 35 | return self._match |
||
| 36 | |||
| 37 | @property |
||
| 38 | def position(self): |
||
| 39 | """ |
||
| 64 |