Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scapy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
CodeLinaro
public-release-test-restored
platform
external
scapy
Commits
197e5451
Commit
197e5451
authored
9 years ago
by
Pierre LALET
Browse files
Options
Downloads
Patches
Plain Diff
Rename argument set -> values; replace filter + lambda by comprehension
parent
2e1e7e10
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scapy/tools/UTscapy.py
+9
-8
9 additions, 8 deletions
scapy/tools/UTscapy.py
with
9 additions
and
8 deletions
scapy/tools/UTscapy.py
+
9
−
8
View file @
197e5451
...
@@ -138,15 +138,15 @@ class TestCampaign(TestClass):
...
@@ -138,15 +138,15 @@ class TestCampaign(TestClass):
class
TestSet
(
TestClass
):
class
TestSet
(
TestClass
):
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
name
=
name
self
.
set
=
[]
self
.
tests
=
[]
self
.
comments
=
""
self
.
comments
=
""
self
.
keywords
=
[]
self
.
keywords
=
[]
self
.
crc
=
None
self
.
crc
=
None
self
.
expand
=
1
self
.
expand
=
1
def
add_test
(
self
,
test
):
def
add_test
(
self
,
test
):
self
.
set
.
append
(
test
)
self
.
tests
.
append
(
test
)
def
__iter__
(
self
):
def
__iter__
(
self
):
return
self
.
set
.
__iter__
()
return
self
.
tests
.
__iter__
()
class
UnitTest
(
TestClass
):
class
UnitTest
(
TestClass
):
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
...
@@ -257,8 +257,9 @@ def compute_campaign_digests(test_campaign):
...
@@ -257,8 +257,9 @@ def compute_campaign_digests(test_campaign):
def
filter_tests_on_numbers
(
test_campaign
,
num
):
def
filter_tests_on_numbers
(
test_campaign
,
num
):
if
num
:
if
num
:
for
ts
in
test_campaign
:
for
ts
in
test_campaign
:
ts
.
set
=
filter
(
lambda
t
:
t
.
num
in
num
,
ts
.
set
)
ts
.
tests
=
[
t
for
t
in
ts
.
tests
if
t
.
num
in
num
]
test_campaign
.
campaign
=
filter
(
lambda
ts
:
len
(
ts
.
set
)
>
0
,
test_campaign
.
campaign
)
test_campaign
.
campaign
=
[
ts
for
ts
in
test_campaign
.
campaign
if
ts
.
tests
]
def
filter_tests_keep_on_keywords
(
test_campaign
,
kw
):
def
filter_tests_keep_on_keywords
(
test_campaign
,
kw
):
def
kw_match
(
lst
,
kw
):
def
kw_match
(
lst
,
kw
):
...
@@ -269,7 +270,7 @@ def filter_tests_keep_on_keywords(test_campaign, kw):
...
@@ -269,7 +270,7 @@ def filter_tests_keep_on_keywords(test_campaign, kw):
if
kw
:
if
kw
:
for
ts
in
test_campaign
:
for
ts
in
test_campaign
:
ts
.
set
=
filter
(
lambda
t
:
kw_match
(
t
.
keywords
,
kw
)
,
ts
.
set
)
ts
.
tests
=
[
t
for
t
in
ts
.
tests
if
kw_match
(
t
.
keywords
,
kw
)
]
def
filter_tests_remove_on_keywords
(
test_campaign
,
kw
):
def
filter_tests_remove_on_keywords
(
test_campaign
,
kw
):
def
kw_match
(
lst
,
kw
):
def
kw_match
(
lst
,
kw
):
...
@@ -280,11 +281,11 @@ def filter_tests_remove_on_keywords(test_campaign, kw):
...
@@ -280,11 +281,11 @@ def filter_tests_remove_on_keywords(test_campaign, kw):
if
kw
:
if
kw
:
for
ts
in
test_campaign
:
for
ts
in
test_campaign
:
ts
.
set
=
filter
(
lambda
t
:
not
kw_match
(
t
.
keywords
,
kw
)
,
ts
.
set
)
ts
.
tests
=
[
t
for
t
in
ts
.
tests
if
not
kw_match
(
t
.
keywords
,
kw
)
]
def
remove_empty_testsets
(
test_campaign
):
def
remove_empty_testsets
(
test_campaign
):
test_campaign
.
campaign
=
filter
(
lambda
ts
:
len
(
ts
.
set
)
>
0
,
test_campaign
.
campaign
)
test_campaign
.
campaign
=
[
ts
for
ts
in
test_campaign
.
campaign
if
ts
.
tests
]
#### RUN CAMPAIGN #####
#### RUN CAMPAIGN #####
...
...
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