Exemplo n.º 1
0
def dimensions_from_file(fn: str) -> list[Dimension]:
    return list(dimensions_from_lines(open(relative_path(__file__, fn))))
Exemplo n.º 2
0
 def from_file(cls, fn: str) -> 'Node':
     return cls.from_str(open(relative_path(__file__, fn)).readline())
Exemplo n.º 3
0
def door_id_from_file(fn: str) -> str:
    return open(relative_path(__file__, fn)).readline().strip()
Exemplo n.º 4
0
 def many_from_file(cls, fn: str) -> list['Number']:
     return list(cls.many_from_lines(open(relative_path(__file__, fn))))
Exemplo n.º 5
0
 def from_file(cls, fn: str) -> 'HeightMap':
     return cls.from_lines(open(relative_path(__file__, fn)))
Exemplo n.º 6
0
def data_from_file(fn: str) -> tuple[RuleList, Ticket, list[Ticket]]:
    return data_from_lines(open(relative_path(__file__, fn)))
Exemplo n.º 7
0
def load_document(fn: str):
    return json.load(open(relative_path(__file__, fn)))
Exemplo n.º 8
0
def game_from_file(fn: str) -> Game:
    return game_from_lines(open(relative_path(__file__, fn)))
Exemplo n.º 9
0
 def from_file(cls, fn: str) -> 'Packet':
     return cls.from_hex(open(relative_path(__file__, fn)).readline().strip())
Exemplo n.º 10
0
def serial_from_file(fn: str) -> int:
    return int(open(relative_path(__file__, fn)).readline())
Exemplo n.º 11
0
def passports_from_file(fn: str) -> list[Passport]:
    return list(passports_from_lines(open(relative_path(__file__, fn))))
Exemplo n.º 12
0
def state_from_file(dimensions: int, fn: str) -> set[Pos]:
    return set(active_positions_from_lines(dimensions, relative_path(__file__, fn)))
Exemplo n.º 13
0
def load_data(fn: str) -> list[int]:
    return [
        int(line_stripped) for line in relative_path(__file__, fn)
        if (line_stripped := line.strip())
    ]
Exemplo n.º 14
0
def input_from_file(fn: str) -> tuple[str, Rules]:
    return input_from_lines(open(relative_path(__file__, fn)))
Exemplo n.º 15
0
def claims_from_file(fn: str) -> list[Claim]:
    return list(claims_from_lines(open(relative_path(__file__, fn))))
Exemplo n.º 16
0
def circuit_from_file(fn: str) -> Circuit:
    return list(connections_from_lines(open(relative_path(__file__, fn))))
Exemplo n.º 17
0
def box_ids_from_file(fn: str) -> list[str]:
    return box_ids_from_lines(open(relative_path(__file__, fn)))
Exemplo n.º 18
0
 def parse_file(cls, fn: str) -> list['Walk']:
     return list(cls.parse_lines(open(relative_path(__file__, fn))))
Exemplo n.º 19
0
 def from_file(
     cls, fn: str,
     teams: Iterable[Team] = tuple(default_teams())) -> 'Battle':
     return cls.from_lines(open(relative_path(__file__, fn)), teams)
Exemplo n.º 20
0
def instructions_from_file(fn: str) -> list[Steps]:
    return list(instructions_from_lines(open(relative_path(__file__, fn))))
Exemplo n.º 21
0
def tape_from_file(fn: str) -> Tape:
    return list(instructions_from_lines(open(relative_path(__file__, fn))))
Exemplo n.º 22
0
def instructions_from_file(fn: str) -> str:
    return open(relative_path(__file__, fn)).readline().strip()
Exemplo n.º 23
0
def spreadsheet_from_file(fn: str) -> Spreadsheet:
    return spreadsheet_from_lines(open(relative_path(__file__, fn)))
Exemplo n.º 24
0
def frequencies_from_file(fn: str) -> list[int]:
    return [int(line.strip()) for line in open(relative_path(__file__, fn))]
Exemplo n.º 25
0
def passes_from_file(fn: str) -> list[str]:
    return [line.strip() for line in open(relative_path(__file__, fn))]
Exemplo n.º 26
0
def groups_from_file(fn: str) -> list[Group]:
    return list(groups_from_lines(open(relative_path(__file__, fn))))
Exemplo n.º 27
0
 def from_file(cls, fn: str):
     return cls.from_lines(open(relative_path(__file__, fn)))
Exemplo n.º 28
0
def decks_from_file(fn: str) -> Decks:
    return decks_from_lines(open(relative_path(__file__, fn)))
Exemplo n.º 29
0
def links_from_file(fn: str) -> list[Link]:
    return list(links_from_lines(open(relative_path(__file__, fn))))
Exemplo n.º 30
0
def elf_count_from_file(fn: str) -> int:
    return int(open(relative_path(__file__, fn)).readline().strip())