From bb9a8106c3226c7291d1ff91e25c0e7ffc582431 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Tue, 12 May 2020 09:33:11 -0700 Subject: [PATCH] support flake8 3.8 (#140) * support flake8 3.8 * rename variable to pass flake8 3.8 --- test/test_flake8.py | 24 +++++++++++++++++++----- vcstool/clients/git.py | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/test/test_flake8.py b/test/test_flake8.py index 523bff06..9c40e187 100644 --- a/test/test_flake8.py +++ b/test/test_flake8.py @@ -37,11 +37,25 @@ def get_style_guide(argv=None): # this is a fork of flake8.api.legacy.get_style_guide # to allow passing command line argument application = Application() - application.parse_preliminary_options_and_args([]) - application.make_config_finder() - application.find_plugins() - application.register_plugin_options() - application.parse_configuration_and_cli(argv) + if hasattr(application, 'parse_preliminary_options'): + prelim_opts, remaining_args = application.parse_preliminary_options( + argv) + from flake8 import configure_logging + configure_logging(prelim_opts.verbose, prelim_opts.output_file) + from flake8.options import config + config_finder = config.ConfigFileFinder( + application.program, prelim_opts.append_config, + config_file=prelim_opts.config, + ignore_config_files=prelim_opts.isolated) + application.find_plugins(config_finder) + application.register_plugin_options() + application.parse_configuration_and_cli(config_finder, remaining_args) + else: + application.parse_preliminary_options_and_args([]) + application.make_config_finder() + application.find_plugins() + application.register_plugin_options() + application.parse_configuration_and_cli(argv) application.make_formatter() application.make_guide() application.make_file_checker_manager() diff --git a/vcstool/clients/git.py b/vcstool/clients/git.py index 97f3bd64..a305a7af 100644 --- a/vcstool/clients/git.py +++ b/vcstool/clients/git.py @@ -28,7 +28,7 @@ def branch(self, command): if not command.all and not result['returncode']: # only show current branch lines = result['output'].splitlines() - lines = [l[2:] for l in lines if l.startswith('* ')] + lines = [line[2:] for line in lines if line.startswith('* ')] result['output'] = '\n'.join(lines) return result