(self)
| 1452 | |
| 1453 | |
| 1454 | def load_configuration(self): |
| 1455 | # default |
| 1456 | self.opts = {} |
| 1457 | |
| 1458 | # load configuration from file |
| 1459 | try: |
| 1460 | f = open(KP_CFGFILE, "rt") |
| 1461 | self.opts = json.load(f) |
| 1462 | f.close() |
| 1463 | except IOError: |
| 1464 | print("Keypatch: FAILED to load config file. Use default setup now.") |
| 1465 | except Exception as e: |
| 1466 | print("Keypatch: FAILED to load config file, with exception: {0}".format(str(e))) |
| 1467 | |
| 1468 | # use default values if not defined in config file |
| 1469 | if 'c_opt_padding' not in self.opts: |
| 1470 | self.opts['c_opt_padding'] = 1 |
| 1471 | |
| 1472 | if 'c_opt_comment' not in self.opts: |
| 1473 | self.opts['c_opt_comment'] = 2 |
| 1474 | |
| 1475 | self.opts['c_opt_chk'] = self.opts['c_opt_padding'] | self.opts['c_opt_comment'] |
| 1476 | |
| 1477 | def init(self): |
| 1478 | global kp_initialized |
no outgoing calls
no test coverage detected