Removed deprecated functionality.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parent cad4ed6 · Browse files · 4 files·+4 added−87 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+4 added−87 removed
- tests:+0 added−48 removed
- other:+4 added−39 removed
Provenance
- Commit
0d9731e- Tree
4571148- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
cad4ed6
4 files changed+4 added−87 removed
modified:click/core.py+2 added-39 removed
296 unmodified lines297 self._depth -= 1298 if self._depth == 0:299 self.close()300 301- def _get_invoked_subcommands(self):302- from warnings import warn303- warn(Warning('This API does not work properly and has been largely '304- 'removed in Click 3.2 to fix a regression the '305- 'introduction of this API caused. Consult the '306- 'upgrade documentation for more information. For '307- 'more information about this see '308- 'http://click.pocoo.org/upgrading/#upgrading-to-3.2'),309- stacklevel=2)310- if self.invoked_subcommand is None:311- return []312- return [self.invoked_subcommand]313- def _set_invoked_subcommands(self, value):314- self.invoked_subcommand = \315- len(value) > 1 and '*' or value and value[0] or None316- invoked_subcommands = property(_get_invoked_subcommands,317- _set_invoked_subcommands)318- del _get_invoked_subcommands, _set_invoked_subcommands319-301 def make_formatter(self):302 """Creates the formatter for the help and usage output."""303 return HelpFormatter(width=self.terminal_width,304 max_width=self.max_content_width)109 unmodified lines414 """415 self, callback = args[:2]416 ctx = self417 437- # This is just to improve the error message in cases where old438- # code incorrectly invoked this method. This will eventually be439- # removed.440- injected_arguments = False441-418 # It's also possible to invoke another command which might or419 # might not have a callback. In that case we also fill420 # in defaults and make a new context for this command.421 if isinstance(callback, Command):6 unmodified lines428 429 for param in other_cmd.params:430 if param.name not in kwargs and param.expose_value:431 kwargs[param.name] = param.get_default(ctx)456- injected_arguments = True432 433 args = args[2:]434 if getattr(callback, '__click_pass_context__', False):435 args = (ctx,) + args436 with augment_usage_errors(self):462- try:463- with ctx:464- return callback(*args, **kwargs)437+ with ctx:438+ return callback(*args, **kwargs)465- except TypeError as e:466- if not injected_arguments:467- raise468- if 'got multiple values for' in str(e):469- raise RuntimeError(470- 'You called .invoke() on the context with a command '471- 'but provided parameters as positional arguments. '472- 'This is not supported but sometimes worked by chance '473- 'in older versions of Click. To fix this see '474- 'http://click.pocoo.org/upgrading/#upgrading-to-3.2')475- raise439 440 def forward(*args, **kwargs):441 """Similar to :meth:`invoke` but fills in default keyword442 arguments from the current context if the other command expects1181 unmodified linesmodified:tests/test_chain.py-31 removed
101 unmodified lines102 'sdist called 2',103 ]104 105 106-def test_context_subcommand_info_sync(recwarn):107- @click.command()108- def cli():109- pass110-111- def _assert_warning():112- assert 'removed in Click 3.2' in str(recwarn.pop(Warning).message)113-114- ctx = click.Context(cli, info_name='cli')115-116- assert ctx.invoked_subcommand is None117-118- ctx.invoked_subcommand = 'foo'119- assert ctx.invoked_subcommand == 'foo'120- assert ctx.invoked_subcommands == ['foo']121-122- ctx.invoked_subcommands = ['foo']123- assert ctx.invoked_subcommand == 'foo'124- assert ctx.invoked_subcommands == ['foo']125-126- ctx.invoked_subcommands = []127- assert ctx.invoked_subcommand is None128- assert ctx.invoked_subcommands == []129-130- ctx.invoked_subcommands = ['foo', 'bar']131- assert ctx.invoked_subcommand == '*'132- assert ctx.invoked_subcommands == ['*']133-134- assert 'removed in Click 3.2' in str(recwarn.pop(Warning).message)135-136-106 def test_pipeline(runner):107 @click.group(chain=True, invoke_without_command=True)108 @click.option('-i', '--input', type=click.File('r'))109 def cli(input):45 unmodified linesmodified:tests/test_commands.py-17 removed
17 unmodified lines18 assert not result.exception19 assert result.output == '42\n'20 21 22-def test_other_command_invoke_invalid_custom_error(runner):23- @click.command()24- @click.pass_context25- def cli(ctx):26- return ctx.invoke(other_cmd, 42)27-28- @click.command()29- @click.argument('arg', type=click.INT)30- def other_cmd(arg):31- click.echo(arg)32-33- result = runner.invoke(cli, [])34- assert isinstance(result.exception, RuntimeError)35- assert 'upgrading-to-3.2' in str(result.exception)36- assert click.__version__ < '5.0'37-38-22 def test_other_command_forward(runner):23 cli = click.Group()24 25 @cli.command()230 unmodified linesmodified:CHANGES+2 added
6 unmodified lines7 -----------8 9 (codename to be decided, release date to be determined)10 11+- Removed various deprecated functionality.12+13 Version 4.014 -----------15 16 (codename "zoom zoom", released on March 31st 2015)206 unmodified lines