(self, quiet=False)
| 205 | return datetime.datetime.fromtimestamp(self.time).strftime("%Y-%m-%d %H:%M:%S") |
| 206 | |
| 207 | def save(self, quiet=False): |
| 208 | file_name = "{}.ta.chkpt".format(int(self.time * 1000)) |
| 209 | if not os.path.exists(self.attack_args.checkpoint_dir): |
| 210 | os.makedirs(self.attack_args.checkpoint_dir) |
| 211 | path = os.path.join(self.attack_args.checkpoint_dir, file_name) |
| 212 | if not quiet: |
| 213 | print("\n\n" + "=" * 125) |
| 214 | logger.info( |
| 215 | 'Saving checkpoint under "{}" at {} after {} attacks.'.format( |
| 216 | path, self.datetime, self.results_count |
| 217 | ) |
| 218 | ) |
| 219 | print("=" * 125 + "\n") |
| 220 | with open(path, "wb") as f: |
| 221 | pickle.dump(self, f, protocol=pickle.HIGHEST_PROTOCOL) |
| 222 | |
| 223 | @classmethod |
| 224 | def load(cls, path): |
no outgoing calls
no test coverage detected