36 "N804", "N805", "N806", |
36 "N804", "N805", "N806", |
37 "W191", "W291", "W292", "W293", "W391", "W603", |
37 "W191", "W291", "W292", "W293", "W391", "W603", |
38 ] |
38 ] |
39 |
39 |
40 |
40 |
41 class CodeStyleFixer(object): |
41 class CodeStyleFixer: |
42 """ |
42 """ |
43 Class implementing a fixer for certain code style issues. |
43 Class implementing a fixer for certain code style issues. |
44 """ |
44 """ |
45 def __init__(self, filename, sourceLines, fixCodes, noFixCodes, |
45 def __init__(self, filename, sourceLines, fixCodes, noFixCodes, |
46 maxLineLength, blankLines, inPlace, eol, backup=False): |
46 maxLineLength, blankLines, inPlace, eol, backup=False): |
2037 self.__source[line - 1] = self.__source[line - 1].replace("<>", "!=") |
2037 self.__source[line - 1] = self.__source[line - 1].replace("<>", "!=") |
2038 # '<>' replaced by '!='. |
2038 # '<>' replaced by '!='. |
2039 return (1, "FIXW603", [], 0) |
2039 return (1, "FIXW603", [], 0) |
2040 |
2040 |
2041 |
2041 |
2042 class Reindenter(object): |
2042 class Reindenter: |
2043 """ |
2043 """ |
2044 Class to reindent badly-indented code to uniformly use four-space |
2044 Class to reindent badly-indented code to uniformly use four-space |
2045 indentation. |
2045 indentation. |
2046 |
2046 |
2047 Released to the public domain, by Tim Peters, 03 October 2000. |
2047 Released to the public domain, by Tim Peters, 03 October 2000. |
2462 last_token_multiline = (start[0] != end[0]) |
2462 last_token_multiline = (start[0] != end[0]) |
2463 |
2463 |
2464 return valid_indents |
2464 return valid_indents |
2465 |
2465 |
2466 |
2466 |
2467 class LineShortener(object): |
2467 class LineShortener: |
2468 """ |
2468 """ |
2469 Class used to shorten lines to a given maximum of characters. |
2469 Class used to shorten lines to a given maximum of characters. |
2470 """ |
2470 """ |
2471 def __init__(self, curLine, prevLine, nextLine, maxLength=79, eol="\n", |
2471 def __init__(self, curLine, prevLine, nextLine, maxLength=79, eol="\n", |
2472 indentWord=" ", isDocString=False): |
2472 indentWord=" ", isDocString=False): |