diff options
| author | Eric N. Vander Weele <ericvw@gmail.com> | 2019-10-25 15:01:30 -0400 |
|---|---|---|
| committer | Eric N. Vander Weele <ericvw@gmail.com> | 2019-10-25 17:07:43 -0400 |
| commit | 4151ae0e532c9f5660b08747ac7f1b8411aada19 (patch) | |
| tree | 770520b7790c623c78a04712436dcbab443265b4 /src | |
| parent | b9c8c3e118492a5201c444434a3000436a007926 (diff) | |
| download | flake8-4151ae0e532c9f5660b08747ac7f1b8411aada19.tar.gz | |
application: Ensure `--version` is unknown during preliminary parsing
Now that the preliminary parser is being used, we can remove needing to
prune out `--version` and copying the original `argv` list.
Diffstat (limited to 'src')
| -rw-r--r-- | src/flake8/main/application.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index 5e61fb0..8290068 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -116,21 +116,7 @@ class Application(object): :rtype: (argparse.Namespace, list) """ - # We haven't found or registered our plugins yet, so let's defer - # printing the version until we aggregate options from config files - # and the command-line. First, let's clone our arguments on the CLI, - # then we'll attempt to remove ``--version`` so that we can avoid - # triggering the "version" action in argparse. If it's not there, we - # do not need to worry and we can continue. If it is, we successfully - # defer printing the version until just a little bit later. - # Similarly we have to defer printing the help text until later. - args = argv[:] - try: - args.remove("--version") - except ValueError: - pass - - return self.prelim_arg_parser.parse_known_args(args) + return self.prelim_arg_parser.parse_known_args(argv) def exit(self): # type: () -> None |
