def parse(cls, data: Iterator[str]) -> Grid: ret = Transparency() for line in data: if not line: break coord = Coord2D.parse(line) ret.width = max(ret.width, coord.x + 1) ret.height = max(ret.height, coord.y + 1) ret[coord] = True return ret
def parse(cls, data: str) -> Vent: start, end = data.split(" -> ") return Vent(start=Coord2D.parse(start), end=Coord2D.parse(end))