diff -r 17df5c8df8c1 -r 9125da0c227e eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/translations.py --- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/translations.py Thu Apr 01 19:48:36 2021 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Simplify/translations.py Fri Apr 02 15:35:44 2021 +0200 @@ -14,42 +14,55 @@ _simplifyMessages = { "Y101": QCoreApplication.translate( "SimplifyChecker", - """Multiple "isinstance()" calls which can be merged into a single """ - """call for variable '{0}'"""), + '''Multiple "isinstance()" calls which can be merged into a single ''' + '''call for variable "{0}"'''), "Y102": QCoreApplication.translate( "SimplifyChecker", - """Use a single if-statement instead of nested if-statements"""), + '''Use a single if-statement instead of nested if-statements'''), "Y103": QCoreApplication.translate( "SimplifyChecker", - """Return the condition "{0}" directly"""), + '''Return the condition "{0}" directly'''), "Y104": QCoreApplication.translate( "SimplifyChecker", - """Use "yield from {0}" """), + '''Use "yield from {0}"'''), "Y105": QCoreApplication.translate( "SimplifyChecker", - """Use "with contextlib.suppress({0}):" """), + '''Use "with contextlib.suppress({0}):"'''), "Y106": QCoreApplication.translate( "SimplifyChecker", - """Handle error-cases first"""), + '''Handle error-cases first'''), "Y107": QCoreApplication.translate( "SimplifyChecker", - """Don't use return in try/except and finally"""), + '''Don't use return in try/except and finally'''), "Y108": QCoreApplication.translate( "SimplifyChecker", - """Use ternary operator "{0} = {1} if {2} else {3}" """ - """instead of if-else-block"""), + '''Use ternary operator "{0} = {1} if {2} else {3}"''' + '''instead of if-else-block'''), "Y109": QCoreApplication.translate( "SimplifyChecker", - """Use "{0} in {1}" instead of "{2}" """), + '''Use "{0} in {1}" instead of "{2}"'''), "Y110": QCoreApplication.translate( "SimplifyChecker", - """Use "return any({0} for {1} in {2})" """), + '''Use "return any({0} for {1} in {2})"'''), "Y111": QCoreApplication.translate( "SimplifyChecker", - """Use "return all({0} for {1} in {2})" """), + '''Use "return all({0} for {1} in {2})"'''), "Y112": QCoreApplication.translate( "SimplifyChecker", - """Use "{0}" instead of "{1}" """), + '''Use "{0}" instead of "{1}"'''), + "Y113": QCoreApplication.translate( + "SimplifyChecker", + '''Use enumerate instead of "{0}"'''), + "Y114": QCoreApplication.translate( + "SimplifyChecker", + '''Use logical or ("({0}) or ({1})") and a single body'''), + "Y115": QCoreApplication.translate( + "SimplifyChecker", + '''Use context handler for opening files'''), + "Y116": QCoreApplication.translate( + "SimplifyChecker", + '''Use a dictionary lookup instead of 3+ if/elif-statements: ''' + '''return {0}'''), } _simplifyMessagesSampleArgs = { @@ -58,8 +71,11 @@ "Y104": ["iterable"], "Y105": ["Exception"], "Y108": ["foo", "bar", "condition", "baz"], - "Y109": ["foo", "[1, 2]", "foo == 1 or foo == 2"], + "Y109": ["foo", "[1, 42]", "foo == 1 or foo == 42"], "Y110": ["check", "foo", "iterable"], "Y111": ["check", "foo", "iterable"], "Y112": ["FOO", "foo"], + "Y113": ["foo"], + "Y114": ["foo > 42", "bar < 42"], + "Y116": ["mapping.get(foo, 42)"] }