Skip to content
Myr

Added support for mixing nargs and multiple

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 640e464 · Browse files · 1 file+5 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−6 removed

  • other:+5 added−6 removed

1 file+5 added−6 removed

modified:click.py+5 added-6 removed
1010 unmodified lines
1011 def process_value(self, ctx, value):1012 """Given a value and context this runs the logic to convert the1013 value as necessary.1014 """1015 if self.type is not None:1016 if (self.nargs != 1 or self.multiple) and value is not None:1017 value = tuple(self.type(x, self, ctx) for x in value)1018 else:1019 value = self.type(value, self, ctx)1020 return value1015 def _convert(value, level):1016 if level == 0:1017 return self.type(value, self, ctx)1018 return tuple(_convert(x, level - 1) for x in value)1019 return _convert(value, (self.nargs != 1) + bool(self.multiple))10201021 def full_process_value(self, ctx, value):1022 value = self.process_value(ctx, value)1023
605 unmodified lines