A message at a file location, using the `<path>:<lineno>: <message>` format that most editors understand. Only the first line of the message is emitted.
| 1481 | |
| 1482 | @dataclasses.dataclass(eq=False) |
| 1483 | class ReprFileLocation(TerminalRepr): |
| 1484 | """A message at a file location, using the `<path>:<lineno>: <message>` |
| 1485 | format that most editors understand. |
| 1486 | |
| 1487 | Only the first line of the message is emitted. |
| 1488 | """ |
| 1489 | |
| 1490 | path: str |
| 1491 | lineno: int |
| 1492 | message: str |
| 1493 | |
| 1494 | def __post_init__(self) -> None: |
| 1495 | self.path = str(self.path) |
| 1496 | |
| 1497 | def toterminal(self, tw: TerminalWriter) -> None: |
| 1498 | msg = self.message |
| 1499 | i = msg.find("\n") |
| 1500 | if i != -1: |
| 1501 | msg = msg[:i] |
| 1502 | tw.write(self.path, bold=True, red=True) |
| 1503 | tw.line(f":{self.lineno}: {msg}") |
| 1504 | |
| 1505 | |
| 1506 | @dataclasses.dataclass(eq=False) |
no outgoing calls