Remove unused None from dict.get()

Since the default value is None when can't get a key from a dict,
So there is no need to use dict.get('key', None).

Change-Id: If22a4a6dbfd010a0b9574b42c23ba19a2c54dd6d
This commit is contained in:
sudhir_agarwal 2017-07-17 11:25:14 +05:30 committed by Gage Hugo
parent 120b24295d
commit 277daaf094
2 changed files with 3 additions and 3 deletions

View File

@ -24,11 +24,11 @@ def get_url(bid):
# later though.
from bandit.core import extension_loader
info = extension_loader.MANAGER.plugins_by_id.get(bid, None)
info = extension_loader.MANAGER.plugins_by_id.get(bid)
if info is not None:
return BASE_URL + ('plugins/%s.html' % info.plugin.__name__)
info = extension_loader.MANAGER.blacklist_by_id.get(bid, None)
info = extension_loader.MANAGER.blacklist_by_id.get(bid)
if info is not None:
template = 'blacklists/blacklist_{kind}.html#{id}-{name}'
info['name'] = info['name'].replace('_', '-')

View File

@ -105,7 +105,7 @@ class FunctionalTests(testtools.TestCase):
for rank in C.RANKING:
label = '{0}.{1}'.format(criteria, rank)
expected = 0
if expect['issues'].get(criteria, None).get(rank, None):
if expect['issues'].get(criteria).get(rank):
expected = expect['issues'][criteria][rank]
self.assertEqual(expected, m['_totals'][label])