Improve Python linting when there is invalid syntax