changeset 6dde8dcbf882 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=6dde8dcbf882 description: Remove the sequence constraint, that is never used
diffstat:
src/command_system/mapping.py | 26 -------------------------- 1 files changed, 0 insertions(+), 26 deletions(-)
diffs (57 lines):
diff -r 400638ce2686 -r 6dde8dcbf882 src/command_system/mapping.py --- a/src/command_system/mapping.py Fri Feb 26 12:35:09 2010 +0200 +++ b/src/command_system/mapping.py Fri Feb 26 12:53:06 2010 +0200 @@ -24,7 +24,6 @@
import re from types import BooleanType, UnicodeType -from types import TupleType, ListType from operator import itemgetter
from errors import DefinitionError, CommandError @@ -125,10 +124,6 @@ an option which does not take an argument. If a switch is followed by an argument - then this argument will be treated just like a normal positional argument. - - If the initial value of a keyword argument is a sequence, that is a - tuple or list - then a value of this option will be considered - correct only if it is present in the sequence. """ spec_args, spec_kwargs, var_args, var_kwargs = command.extract_specification() norm_kwargs = dict(spec_kwargs) @@ -274,25 +269,6 @@ if not isinstance(value, BooleanType): raise CommandError("%s: Switch can not take an argument" % key, command)
- # Detect every sequence constraint and ensure that if corresponding - # options are given - they contain proper values, within the - # constraint range. - for key, value in opts: - initial = norm_kwargs.get(key) - if isinstance(initial, (TupleType, ListType)): - if value not in initial: - raise CommandError("%s: Invalid argument" % key, command) - - # If argument to an option constrained by a sequence was not given - - # then it's value should be set to None. - for spec_key, spec_value in spec_kwargs: - if isinstance(spec_value, (TupleType, ListType)): - for key, value in opts: - if spec_key == key: - break - else: - opts.append((spec_key, None)) - # We need to encode every keyword argument to a simple string, not # the unicode one, because ** expansion does not support it. for index, (key, value) in enumerate(opts): @@ -331,8 +307,6 @@
if isinstance(value, BooleanType): value = str() - elif isinstance(value, (TupleType, ListType)): - value = '={%s}' % ', '.join(value) else: value = '=%s' % value