Conditions | 3 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
1 | from coalib.misc.Decorators import ( |
||
9 | @enforce_signature |
||
|
|||
10 | def __init__(self, line: (int, None)=None, column: (int, None)=None): |
||
11 | """ |
||
12 | Creates a new TextPosition object that represents the position inside |
||
13 | a string with line/column numbers. |
||
14 | |||
15 | :param line: The line in file or None, the first line is 1. |
||
16 | :param column: The column indicating the character. The first one |
||
17 | in a line is 1. |
||
18 | :raises TypeError: Raised when line or columns are no integers. |
||
19 | :raises ValueError: Raised when a column is set but line is None. |
||
20 | """ |
||
21 | if line is None and column is not None: |
||
22 | raise ValueError("A column can only be set if a line is set.") |
||
23 | |||
24 | self._line = line |
||
25 | self._column = column |
||
26 | |||
34 |