for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from coalib.misc.Decorators import (enforce_signature,
generate_ordering,
generate_repr)
from coalib.results.TextPosition import TextPosition
@generate_repr("file", "line", "column")
@generate_ordering("file", "line", "column")
class SourcePosition(TextPosition):
@enforce_signature
def __init__(self, file: str, line=None, column=None):
"""
Creates a new result position object that represents the position of a
result in the source code.
:param file: The filename or None.
:param line: The line in file or None, the first line is 1.
:param column: The column indicating the character. The first one
in a line is 1.
:raises TypeError: Raised when line or columns are no integers.
:raises ValueError: If a line number without a file is provided.
TextPosition.__init__(self, line, column)
if file is None and line is not None:
raise ValueError("A line must be associated to a file.")
self._file = file
@property
def file(self):
return self._file