Skip to content
Myr

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

4 files+4 added−87 removed

modified:click/core.py+2 added-39 removed
296 unmodified lines
297 self._depth -= 1298 if self._depth == 0:299 self.close()300301 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_subcommands319301 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 lines
414 """415 self, callback = args[:2]416 ctx = self417437 # 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 = False441418 # 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 lines
428429 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 = True432433 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 raise439440 def forward(*args, **kwargs):441 """Similar to :meth:`invoke` but fills in default keyword442 arguments from the current context if the other command expects
1181 unmodified lines
modified:tests/test_chain.py-31 removed
101 unmodified lines
102 'sdist called 2',103 ]104105106def test_context_subcommand_info_sync(recwarn):107 @click.command()108 def cli():109 pass110111 def _assert_warning():112 assert 'removed in Click 3.2' in str(recwarn.pop(Warning).message)113114 ctx = click.Context(cli, info_name='cli')115116 assert ctx.invoked_subcommand is None117118 ctx.invoked_subcommand = 'foo'119 assert ctx.invoked_subcommand == 'foo'120 assert ctx.invoked_subcommands == ['foo']121122 ctx.invoked_subcommands = ['foo']123 assert ctx.invoked_subcommand == 'foo'124 assert ctx.invoked_subcommands == ['foo']125126 ctx.invoked_subcommands = []127 assert ctx.invoked_subcommand is None128 assert ctx.invoked_subcommands == []129130 ctx.invoked_subcommands = ['foo', 'bar']131 assert ctx.invoked_subcommand == '*'132 assert ctx.invoked_subcommands == ['*']133134 assert 'removed in Click 3.2' in str(recwarn.pop(Warning).message)135136106def 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 lines
modified:tests/test_commands.py-17 removed
17 unmodified lines
18 assert not result.exception19 assert result.output == '42\n'202122def 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)2728 @click.command()29 @click.argument('arg', type=click.INT)30 def other_cmd(arg):31 click.echo(arg)3233 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'373822def test_other_command_forward(runner):23 cli = click.Group()2425 @cli.command()
230 unmodified lines
modified:CHANGES+2 added
6 unmodified lines
7-----------89(codename to be decided, release date to be determined)1011- Removed various deprecated functionality.1213Version 4.014-----------1516(codename "zoom zoom", released on March 31st 2015)
206 unmodified lines