| Total Complexity | 2 | 
| Total Lines | 31 | 
| Duplicated Lines | 0 % | 
| 1 | import autopep8  | 
            ||
| 9 | class PEP8Bear(Lint, LocalBear):  | 
            ||
| 10 | diff_message = "The code does not comply to PEP8."  | 
            ||
| 11 | gives_corrected = True  | 
            ||
| 12 | |||
| 13 | def lint(self, filename, file, **kwargs):  | 
            ||
| 14 |         new_file = autopep8.fix_code(''.join(file), options=kwargs) | 
            ||
| 15 | output = new_file.splitlines(True)  | 
            ||
| 16 | return self.process_output(output, filename, file)  | 
            ||
| 17 | |||
| 18 | def run(self,  | 
            ||
| 19 | filename,  | 
            ||
| 20 | file,  | 
            ||
| 21 | max_line_length: int=80,  | 
            ||
| 22 | tab_width: int=SpacingHelper.DEFAULT_TAB_WIDTH,  | 
            ||
| 23 | pep_ignore: typed_list(str)=(),  | 
            ||
| 24 | pep_select: typed_list(str)=()):  | 
            ||
| 25 | """  | 
            ||
| 26 | Detects and fixes PEP8 incompliant code. This bear will not change  | 
            ||
| 27 | functionality of the code in any way.  | 
            ||
| 28 | |||
| 29 | :param max_line_length: Maximum number of characters for a line.  | 
            ||
| 30 | :param tab_width: Number of spaces per indent level.  | 
            ||
| 31 | :param pep_ignore: A list of errors/warnings to ignore.  | 
            ||
| 32 | :param pep_select: A list of errors/warnings to exclusively apply.  | 
            ||
| 33 | """  | 
            ||
| 34 | return self.lint(filename,  | 
            ||
| 35 | file,  | 
            ||
| 36 | ignore=pep_ignore,  | 
            ||
| 37 | select=pep_select,  | 
            ||
| 38 | max_line_length=max_line_length,  | 
            ||
| 39 | indent_size=tab_width)  | 
            ||
| 40 |