DTA/InfoFlow: change exclude to handle None

This is a little clearer than having an empty list, from the caller side.
This commit is contained in:
Chris PeBenito 2015-03-27 09:06:16 -04:00
parent ec9de08ac6
commit 84217f0d73
2 changed files with 11 additions and 4 deletions

View File

@ -27,7 +27,7 @@ class DomainTransitionAnalysis(object):
"""Domain transition analysis.""" """Domain transition analysis."""
def __init__(self, policy, reverse=False, exclude=[]): def __init__(self, policy, reverse=False, exclude=None):
""" """
Parameter: Parameter:
policy The policy to analyze. policy The policy to analyze.
@ -128,7 +128,11 @@ class DomainTransitionAnalysis(object):
exclude A list of types. exclude A list of types.
""" """
self.exclude = [self.policy.lookup_type(t) for t in exclude] if exclude:
self.exclude = [self.policy.lookup_type(t) for t in exclude]
else:
self.exclude = []
self.rebuildsubgraph = True self.rebuildsubgraph = True
def shortest_path(self, source, target): def shortest_path(self, source, target):

View File

@ -30,7 +30,7 @@ class InfoFlowAnalysis(object):
"""Information flow analysis.""" """Information flow analysis."""
def __init__(self, policy, perm_map, minweight=1, exclude=[]): def __init__(self, policy, perm_map, minweight=1, exclude=None):
""" """
Parameters: Parameters:
policy The policy to analyze. policy The policy to analyze.
@ -92,7 +92,10 @@ class InfoFlowAnalysis(object):
exclude A list of types. exclude A list of types.
""" """
self.exclude = [self.policy.lookup_type(t) for t in exclude] if exclude:
self.exclude = [self.policy.lookup_type(t) for t in exclude]
else:
self.exclude = []
self.rebuildsubgraph = True self.rebuildsubgraph = True