Failed Conditions
Pull Request — master (#2076)
by Abdeali
02:11
created

coalib/results/TextPosition.py (8 issues)

1
from coalib.misc.Decorators import (
2
    enforce_signature, generate_ordering, generate_repr)
3
4
5
@generate_repr("line", "column")
6
@generate_ordering("line", "column")
7
class TextPosition:
8
9
    @enforce_signature
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable enforce_signature does not seem to be defined.
Loading history...
10
    def __init__(self, line: (int, None)=None, column: (int, None)=None):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable int does not seem to be defined.
Loading history...
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:
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable column does not seem to be defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable line does not seem to be defined.
Loading history...
22
            raise ValueError("A column can only be set if a line is set.")
23
24
        self._line = line
25
        self._column = column
26
27
    @property
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable property does not seem to be defined.
Loading history...
28
    def line(self):
29
        return self._line
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable self does not seem to be defined.
Loading history...
30
31
    @property
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable property does not seem to be defined.
Loading history...
32
    def column(self):
33
        return self._column
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable self does not seem to be defined.
Loading history...
34