mirror of
https://github.com/nmap/nmap.git
synced 2025-12-22 07:29:01 +00:00
Replace key existence tests with dict.get()
Replaced instances of this pattern:
if 'key' in somedict:
var = somedict['key']
else:
var = ""
...with this much simpler pattern:
var = somedict.get('key', "")
Some variations, like returning None if the key is not found were also
replaced.
This commit is contained in:
@@ -2042,10 +2042,7 @@ class NetNode(Node):
|
||||
if info == None:
|
||||
return self.__draw_info
|
||||
|
||||
if info in self.__draw_info:
|
||||
return self.__draw_info[info]
|
||||
|
||||
return None
|
||||
return self.__draw_info.get(info)
|
||||
|
||||
def set_draw_info(self, info):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user