input: filename (str) and a key (int) output: returns true if decrypt process was successful otherwise false if key not passed the method uses the key by the constructor. otherwise key = 1
(self, file, key)
| 153 | return True |
| 154 | |
| 155 | def decrypt_file(self, file, key): |
| 156 | """ |
| 157 | input: filename (str) and a key (int) |
| 158 | output: returns true if decrypt process was |
| 159 | successful otherwise false |
| 160 | if key not passed the method uses the key by the constructor. |
| 161 | otherwise key = 1 |
| 162 | """ |
| 163 | |
| 164 | # precondition |
| 165 | assert isinstance(file, str) and isinstance(key, int) |
| 166 | |
| 167 | try: |
| 168 | with open(file, "r") as fin: |
| 169 | with open("decrypt.out", "w+") as fout: |
| 170 | # actual encrypt-process |
| 171 | for line in fin: |
| 172 | fout.write(self.decrypt_string(line, key)) |
| 173 | |
| 174 | except: |
| 175 | return False |
| 176 | |
| 177 | return True |
| 178 | |
| 179 | |
| 180 | # Tests |
nothing calls this directly
no test coverage detected