1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 06:01:28 +00:00

Fix 'Missing call to __init__ during object initialization' from LGTM. See #1834

This commit is contained in:
dmiller
2019-12-16 05:55:45 +00:00
parent be3d719dd7
commit fa0353badd
3 changed files with 7 additions and 3 deletions

View File

@@ -1190,6 +1190,7 @@ class NmapContentHandler(xml.sax.handler.ContentHandler):
that is filled in and can be read back again once the parse method is that is filled in and can be read back again once the parse method is
finished.""" finished."""
def __init__(self, scan): def __init__(self, scan):
super(NmapContentHandler, self).__init__()
self.scan = scan self.scan = scan
# We keep a stack of the elements we've seen, pushing on start and # We keep a stack of the elements we've seen, pushing on start and

View File

@@ -313,6 +313,7 @@ class XMLReader(xml.sax.ContentHandler):
def __init__(self, file=None): def __init__(self, file=None):
""" """
""" """
super(XMLReader, self).__init__()
self.__text = "" self.__text = ""
self.__status = [] self.__status = []

View File

@@ -191,6 +191,7 @@ class ScriptHelpXMLContentHandler (xml.sax.handler.ContentHandler):
other information like categories and description, but all it gets is other information like categories and description, but all it gets is
filenames. (ScriptMetadata gets the other information.)""" filenames. (ScriptMetadata gets the other information.)"""
def __init__(self): def __init__(self):
super(ScriptHelpXMLContentHandler, self).__init__()
self.script_filenames = [] self.script_filenames = []
self.scripts_dir = None self.scripts_dir = None
self.nselib_dir = None self.nselib_dir = None
@@ -204,7 +205,8 @@ class ScriptHelpXMLContentHandler (xml.sax.handler.ContentHandler):
if u"path" not in attrs: if u"path" not in attrs:
raise ValueError( raise ValueError(
u'"directory" element did not have "path" attribute') u'"directory" element did not have "path" attribute')
path = attrs[u"path"].encode("raw_unicode_escape").decode(sys.getfilesystemencoding()) path = attrs[u"path"].encode("raw_unicode_escape").decode(
sys.getfilesystemencoding())
if dirname == u"scripts": if dirname == u"scripts":
self.scripts_dir = path self.scripts_dir = path
elif dirname == u"nselib": elif dirname == u"nselib":
@@ -423,13 +425,13 @@ class ScriptInterface:
def update(self): def update(self):
"""Updates the interface when the command entry is changed.""" """Updates the interface when the command entry is changed."""
#updates list of scripts # updates list of scripts
script_list = [] script_list = []
rules = self.ops["--script"] rules = self.ops["--script"]
if (self.prev_script_spec != rules): if (self.prev_script_spec != rules):
self.renew_script_list_timer(rules) self.renew_script_list_timer(rules)
self.prev_script_spec = rules self.prev_script_spec = rules
#updates arguments.. # updates arguments..
raw_argument = self.ops["--script-args"] raw_argument = self.ops["--script-args"]
if raw_argument is not None: if raw_argument is not None:
self.parse_script_args(raw_argument) self.parse_script_args(raw_argument)