import autopep8

from coalib.bears.LocalBear import LocalBear
from coalib.results.Result import Result
from coalib.results.Diff import Diff


class PEP8Bear(LocalBear):
    def run(self, filename, file):
        """
        Detects and fixes PEP8 incompliant code. This bear will not change
        functionality of the code in any way.
        """
        content = ''.join(file)
        new_content = autopep8.fix_code(content)
        if new_content != content:
            wholediff = Diff.from_string_arrays(file,
                                                new_content.splitlines(True))
            for diff in wholediff.split_diff():
                yield Result(
                    self,
                    "The code does not comply to PEP8.",
                    affected_code=(diff.range(filename),),
                    diffs={filename: diff})

@@ -19,635 +19,521 @@
 rom 
-coalib.bears.LocalBear import LocalBear%0Afrom coalib.results.Result import Result%0Afrom coalib.results.Diff import Diff%0A%0A%0Aclass PEP8Bear(LocalBear):%0A    def run(self, filename, file):%0A        %22%22%22%0A        Detects and fixes PEP8 incompliant code. This bear will not change%0A        functionality of the code in any way.%0A        %22%22%22%0A        content = ''.join(file)%0A        new_content = autopep8.fix_code(content)%0A        if new_content != content:%0A            wholediff = Diff.from_string_arrays(file,%0A                                                new_content.splitlines(True))%0A            for diff in wholediff.split_diff():%0A    
+bears.linters.CorrectionBasedBear import CorrectionBasedBear%0A%0A%0Aclass PEP8Bear(CorrectionBasedBear):%0A    GET_REPLACEMENT = staticmethod(%0A        lambda file: (autopep8.fix_code(''.join(file)).splitlines(True), %5B%5D))%0A    RESULT_MESSAGE = %22The code does not comply to PEP8.%22%0A%0A    def run(self, filename, file):%0A        %22%22%22%0A        Detects and fixes PEP8 incompliant code. This bear will not change%0A        functionality of the code in any way.%0A        %22%22%22%0A        for result in self.retrieve_results(filename, file):%0A
     
@@ -550,198 +550,11 @@
 eld 
-R
+r
 esult
-(%0A                    self,%0A                    %22The code does not comply to PEP8.%22,%0A                    affected_code=(diff.range(filename),),%0A                    diffs=%7Bfilename: diff%7D)
 %0A

Use CorrectionBasedBear