Ejemplo n.º 1
0
 def __init__(self, filename=None, sufix='.encrypted'):
     key = utils.read_whole_file('aes.password', 'r').strip()
     self.cipher = AESCipher(key)
     self.base_filename = filename
     self.sufix = sufix
     if filename:
         self.open(filename)
     else:
         self.file = None
Ejemplo n.º 2
0
def main():
    draws, boards = utils.read_whole_file(pre_process_data)
    last_draw, board = get_losing_board(draws, boards)
    if board is None:
        print("Error: No board returned")
        return
    u_sum = board.get_unmarked_sum()
    print("The unmarked sum is {}. The marked sum is {}. The final score is {}.".format(u_sum, last_draw,
                                                                                        u_sum * last_draw))
Ejemplo n.º 3
0
def _run_program(input_path):
    input_nums = U.read_whole_file(input_path)
    game = CupsGame(debug=False)
    for num in input_nums:
        game.insert(int(num))
    part1(game)
    game = CupsGame(debug=False)
    for num in input_nums:
        game.insert(int(num))
    part2(game)
Ejemplo n.º 4
0
def get_data() -> np.ndarray:
    return utils.int_list(utils.read_whole_file(), ',')
Ejemplo n.º 5
0
def get_data() -> defaultdict:
    return utils.read_whole_file(pre_process_data)
Ejemplo n.º 6
0
def get_data() -> tuple:
    data = utils.read_whole_file().split('\n\n')
    template = data[0]
    rules = pre_process_rules(data[1])
    return template, rules
Ejemplo n.º 7
0
 def encrypt_file(self, filename):
     self.close()
     data = utils.read_whole_file(filename, 'rb')
     self.open(filename)
     self.write(data)
Ejemplo n.º 8
0
def get_data() -> tuple:
    return utils.read_whole_file(pre_process_data)