Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
042aa10a
Commit
042aa10a
authored
Mar 25, 2015
by
Maxime Perrotin
Browse files
Add missing generator for Sequence combinations
parent
c690f77e
Changes
1
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/sdlHandler.py
View file @
042aa10a
...
...
@@ -123,11 +123,10 @@ def compute_choice_combinations(asn1_ty, pool):
def
compute_sequence_combinations
(
asn1_ty
,
pool
):
''' Generator returning all combinations of SEQUENCE types '''
elems
=
[]
for
name
,
value_ty
in
asn1_ty
.
Children
.
viewitems
():
# Create a list of iterables
elems
.
append
(
compute_combinations
(
value_ty
,
pool
))
# Generator with all combinations
# Prepare generators to compute combinations of each field
elems
=
(
compute_combinations
(
sort
,
pool
)
for
sort
in
asn1_ty
.
Children
.
viewvalues
())
# Combine all field generators to get the complete set of values
for
each
in
itertools
.
product
(
*
elems
):
# each is a tuple with values for the sequence, join with fieldnames
pairs
=
itertools
.
izip
(
asn1_ty
.
Children
.
viewkeys
(),
each
)
...
...
@@ -495,6 +494,7 @@ class sdlHandler(QObject):
self
.
check_properties
(
new_hash
)
# TEMP TO TEST
# for name, typedef in self.proc.dataview.viewitems():
# if name != 'MySeq': continue
# print 'All combinations of ', name
# for combi in compute_combinations(typedef, self.proc.dataview):
# print combi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment