INNER CODE UNIT · Python
Piece
bsilverthorn/maccarone · src/maccarone/preprocessor.py:24
class Piece:
start: int
end: int
@dataclass
class PresentPiece(Piece):
text: str
@dataclass
class MissingPiece(Piece):
indent: str
guidance: str
inlined: Optional[str] = None
enabled: bool = True
def get_line_pos(self, raw_source: str) -> Tuple[int, int]:
start_line = raw_source.count('\n', 0, self.start) + 1
end_line = raw_source.count('\n', 0, self.end) + 1