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