| Total Complexity | 6 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | 1 | import json |
|
| 2 | |||
| 3 | 1 | from .client import Client |
|
| 4 | |||
| 5 | |||
| 6 | 1 | class ClientJsonInput(Client): |
|
| 7 | 1 | def __init__(self, args): |
|
| 8 | 1 | super().__init__(args) |
|
| 9 | 1 | self.json_data_file = self.get_json_data_file() |
|
| 10 | |||
| 11 | 1 | def get_json_data_file(self): |
|
| 12 | 1 | with open(self.source_filename, 'r') as f: |
|
| 13 | 1 | try: |
|
| 14 | 1 | return json.load(f) |
|
| 15 | 1 | except Exception as error: |
|
| 16 | 1 | raise ValueError( |
|
| 17 | 'Used file "{}" is not valid json.'.format( |
||
| 18 | self.source_filename)) |
||
| 19 | |||
| 20 | 1 | def load_rule_names(self): |
|
| 21 | 1 | return self.json_data_file.keys() |
|
| 22 | |||
| 23 | 1 | def search_rules_id(self): |
|
| 24 | 1 | rules = self._get_wanted_rules_from_array_of_IDs( |
|
| 25 | self.load_rule_names()) |
||
| 26 | 1 | notselected_rules = [] |
|
| 27 | return self._check_rules_id(rules, notselected_rules) |
||
| 28 |