Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
455b1df2
Commit
455b1df2
authored
15 years ago
by
Alexander Cherniuk
Browse files
Options
Downloads
Patches
Plain Diff
Remove the sequence constraint, that is never used
parent
c272fce3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/command_system/mapping.py
+0
-26
0 additions, 26 deletions
src/command_system/mapping.py
with
0 additions
and
26 deletions
src/command_system/mapping.py
+
0
−
26
View file @
455b1df2
...
...
@@ -24,7 +24,6 @@ according to the command properties.
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 @@ def adapt_arguments(command, arguments, args, opts):
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 @@ def adapt_arguments(command, arguments, args, opts):
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 @@ def generate_usage(command, complete=True):
if
isinstance
(
value
,
BooleanType
):
value
=
str
()
elif
isinstance
(
value
,
(
TupleType
,
ListType
)):
value
=
'
={%s}
'
%
'
,
'
.
join
(
value
)
else
:
value
=
'
=%s
'
%
value
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment