eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py

changeset 8259
2bbec88047dd
parent 8243
cc717c2ae956
child 8273
698ae46f40a4
equal deleted inserted replaced
8258:82b608e352ec 8259:2bbec88047dd
1430 1430
1431 # This is necessary since pycodestyle sometimes reports columns that 1431 # This is necessary since pycodestyle sometimes reports columns that
1432 # goes past the end of the physical line. This happens in cases like, 1432 # goes past the end of the physical line. This happens in cases like,
1433 # foo(bar\n=None) 1433 # foo(bar\n=None)
1434 col = min(pos, len(text) - 1) 1434 col = min(pos, len(text) - 1)
1435 if text[col].strip(): 1435 newText = (
1436 newText = text 1436 text
1437 else: 1437 if text[col].strip() else
1438 newText = text[:col].rstrip() + text[col:].lstrip() 1438 text[:col].rstrip() + text[col:].lstrip()
1439 )
1439 1440
1440 # There could be an escaped newline 1441 # There could be an escaped newline
1441 if newText.endswith(('=\\\n', '=\\\r\n', '=\\\r')): 1442 if newText.endswith(('=\\\n', '=\\\r\n', '=\\\r')):
1442 self.__source[line] = newText.rstrip("\n\r \t\\") 1443 self.__source[line] = newText.rstrip("\n\r \t\\")
1443 self.__source[line + 1] = self.__source[line + 1].lstrip() 1444 self.__source[line + 1] = self.__source[line + 1].lstrip()

eric ide

mercurial