| Total Complexity | 7 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 90% |
| 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_only_fail_rule(self, rules): |
|
| 12 | """ |
||
| 13 | Function processes array of matched IDs of rules in selected file. |
||
| 14 | Function retunes array of failed matched IDs of rules in selected file. |
||
| 15 | """ |
||
| 16 | raise NotImplementedError |
||
| 17 | |||
| 18 | 1 | def _get_rows_of_unselected_rules(self): |
|
| 19 | """ |
||
| 20 | Function retunes array of rows where is not selected IDs of rules in selected file. |
||
| 21 | """ |
||
| 22 | raise NotImplementedError |
||
| 23 | |||
| 24 | 1 | def get_json_data_file(self): |
|
| 25 | 1 | with open(self.source_filename, 'r') as file_: |
|
| 26 | 1 | try: |
|
| 27 | 1 | return json.load(file_) |
|
| 28 | 1 | except Exception: |
|
| 29 | 1 | raise ValueError( |
|
| 30 | 'Used file "{}" is not valid json.'.format( |
||
| 31 | self.source_filename)) |
||
| 32 | |||
| 33 | 1 | def search_rules_id(self): |
|
| 34 | 1 | rules = self._get_wanted_rules( |
|
| 35 | self.json_data_file.keys()) |
||
| 36 | 1 | notselected_rules = [] |
|
| 37 | return self._check_rules_id(rules, notselected_rules) |
||
| 38 |