250 @return flag indicating that one string starts with the other |
250 @return flag indicating that one string starts with the other |
251 (boolean) |
251 (boolean) |
252 """ |
252 """ |
253 return b.startswith(a) or a.startswith(b) |
253 return b.startswith(a) or a.startswith(b) |
254 |
254 |
255 if self.__noFixCodes: |
255 if ( |
256 for noFixCode in [c.strip() for c in self.__noFixCodes]: |
256 self.__noFixCodes and |
257 if mutualStartswith(code.lower(), noFixCode.lower()): |
257 any(mutualStartswith(code.lower(), noFixCode.lower()) |
258 return False |
258 for noFixCode in [c.strip() for c in self.__noFixCodes]) |
|
259 ): |
|
260 return False |
259 |
261 |
260 if self.__fixCodes: |
262 if self.__fixCodes: |
261 for fixCode in [c.strip() for c in self.__fixCodes]: |
263 return any(mutualStartswith(code.lower(), fixCode.lower()) |
262 if mutualStartswith(code.lower(), fixCode.lower()): |
264 for fixCode in [c.strip() for c in self.__fixCodes]) |
263 return True |
|
264 return False |
|
265 |
265 |
266 return True |
266 return True |
267 |
267 |
268 def fixIssue(self, line, pos, code): |
268 def fixIssue(self, line, pos, code): |
269 """ |
269 """ |
2419 ) |
2419 ) |
2420 hang = rel_indent[row] - rel_indent[open_row] |
2420 hang = rel_indent[row] - rel_indent[open_row] |
2421 |
2421 |
2422 if token_type == tokenize.OP and text in ']})': |
2422 if token_type == tokenize.OP and text in ']})': |
2423 pass |
2423 pass |
2424 elif visual_indent is True: |
2424 elif visual_indent is True and not indent[depth]: |
2425 if not indent[depth]: |
2425 indent[depth] = start[1] |
2426 indent[depth] = start[1] |
|
2427 |
2426 |
2428 # line altered: comments shouldn't define a visual indent |
2427 # line altered: comments shouldn't define a visual indent |
2429 if parens[row] and not indent[depth] and token_type not in ( |
2428 if parens[row] and not indent[depth] and token_type not in ( |
2430 tokenize.NL, tokenize.COMMENT |
2429 tokenize.NL, tokenize.COMMENT |
2431 ): |
2430 ): |
2882 badStartingSymbol = { |
2881 badStartingSymbol = { |
2883 '(': ')', |
2882 '(': ')', |
2884 '[': ']', |
2883 '[': ']', |
2885 '{': '}'}.get(lines[0][-1], None) |
2884 '{': '}'}.get(lines[0][-1], None) |
2886 |
2885 |
2887 if len(lines) > 1: |
2886 if ( |
2888 if (badStartingSymbol and |
2887 len(lines) > 1 and |
2889 lines[1].lstrip().startswith(badStartingSymbol)): |
2888 badStartingSymbol and |
2890 rank += 20 |
2889 lines[1].lstrip().startswith(badStartingSymbol) |
|
2890 ): |
|
2891 rank += 20 |
2891 |
2892 |
2892 if re.match(r".*[+\-\*/] \($", lines[0]): |
2893 if re.match(r".*[+\-\*/] \($", lines[0]): |
2893 # "1 * (\n" is ugly as hell. |
2894 # "1 * (\n" is ugly as hell. |
2894 rank += 100 |
2895 rank += 100 |
2895 |
2896 |