Total Complexity | 5 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from subprocess import check_output, CalledProcessError |
||
14 | class FileValidatorsPlugin: |
||
15 | |||
16 | def __init__(self, plugin): |
||
17 | self.plugin = plugin |
||
18 | self._validator = None |
||
19 | |||
20 | def validate(self, file, validator=None): |
||
21 | |||
22 | if validator is None: |
||
23 | if self._validator is None: |
||
24 | self._validator = self.plugin.validators.register("cmd_validator_%s" % self.plugin.name, |
||
25 | "CMD validator for plugin %s" % self.plugin.name) |
||
26 | validator = self._validator |
||
27 | |||
28 | try: |
||
29 | output = check_output() |
||
30 | return_code = 0 |
||
31 | except CalledProcessError as e: |
||
32 | output = e.output |
||
33 | return_code = e.returncode |
||
34 | |||
35 |