Total Complexity | 6 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """Schema implementation based on JSONSchema v4 draft |
||
21 | class SchemaValidator(object): |
||
22 | |||
23 | __slots__ = ('_input_validator') |
||
24 | |||
25 | def __init__(self, input_spec): |
||
26 | if input_spec: |
||
27 | try: |
||
28 | self._input_validator = jsonschema.Draft4Validator(input_spec) |
||
29 | |||
30 | except jsonschema.SchemaError: |
||
31 | raise |
||
32 | |||
33 | else: |
||
34 | self._input_validator = None |
||
35 | |||
36 | def validate(self, some_input): |
||
37 | if self._input_validator is not None: |
||
38 | try: |
||
39 | self._input_validator.validate(some_input) |
||
40 | return True |
||
41 | |||
42 | except jsonschema.ValidationError: |
||
43 | raise |
||
44 | |||
45 | else: |
||
46 | # No input schema meams we accept everything |
||
47 | return True |
||
48 | |||
55 |
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.py
files in your module folders. Make sure that you place one file in each sub-folder.