Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
983d1187
authored
Dec 05, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: use set() for 'in' in a loop
https://wiki.python.org/moin/TimeComplexity
parent
651a6105
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
circle/firewall/models.py
+2
-2
No files found.
circle/firewall/models.py
View file @
983d1187
...
@@ -487,7 +487,7 @@ class Host(models.Model):
...
@@ -487,7 +487,7 @@ class Host(models.Model):
nat
=
True
,
proto
=
proto
)
nat
=
True
,
proto
=
proto
)
else
:
else
:
ports
=
self
.
rules
.
filter
(
proto
=
proto
,
)
ports
=
self
.
rules
.
filter
(
proto
=
proto
,
)
return
ports
.
values_list
(
'dport'
,
flat
=
True
)
return
set
(
ports
.
values_list
(
'dport'
,
flat
=
True
)
)
def
_get_random_port
(
self
,
proto
,
used_ports
=
None
):
def
_get_random_port
(
self
,
proto
,
used_ports
=
None
):
"""
"""
...
@@ -496,7 +496,7 @@ class Host(models.Model):
...
@@ -496,7 +496,7 @@ class Host(models.Model):
:param proto: The transport protocol of the generated port (tcp|udp).
:param proto: The transport protocol of the generated port (tcp|udp).
:type proto: str.
:type proto: str.
:param used_ports: Optional
lis
t of used ports returned by
:param used_ports: Optional
se
t of used ports returned by
_get_ports_used.
_get_ports_used.
:returns: int -- the generated port number.
:returns: int -- the generated port number.
:raises: ValidationError
:raises: ValidationError
...
...
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