Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

PEP 8 – Comparison to 'None' Part 1

Gormogon57eed89a8510
diff --git a/ext/dns/rdataclass.py b/ext/dns/rdataclass.py
index 7d13f525..6caf7c25 100644
--- a/ext/dns/rdataclass.py
+++ b/ext/dns/rdataclass.py
@@ -81,7 +81,7 @@ def from_text(text):
value = _by_text.get(text.upper())
if value is None:
match = _unknown_class_pattern.match(text)
- if match == None:
+ if match is None:
raise UnknownRdataclass
value = int(match.group(1))
if value < 0 or value > 65535:
diff --git a/ext/dns/rdatatype.py b/ext/dns/rdatatype.py
index ff81a054..00777cee 100644
--- a/ext/dns/rdatatype.py
+++ b/ext/dns/rdatatype.py
@@ -192,7 +192,7 @@ def from_text(text):
value = _by_text.get(text.upper())
if value is None:
match = _unknown_type_pattern.match(text)
- if match == None:
+ if match is None:
raise UnknownRdatatype
value = int(match.group(1))
if value < 0 or value > 65535:
diff --git a/ext/pyPdf/generic.py b/ext/pyPdf/generic.py
index aaf50318..0edb432a 100644
--- a/ext/pyPdf/generic.py
+++ b/ext/pyPdf/generic.py
@@ -81,7 +81,7 @@ def readObject(stream, pdf):
return NumberObject.readFromStream(stream)
peek = stream.read(20)
stream.seek(-len(peek), 1) # reset to start
- if re.match(r"(\d+)\s(\d+)\sR[^a-zA-Z]", peek) != None:
+ if re.match(r"(\d+)\s(\d+)\sR[^a-zA-Z]", peek) is not None:
return IndirectObject.readFromStream(stream, pdf)
else:
return NumberObject.readFromStream(stream)
@@ -169,7 +169,7 @@ class IndirectObject(PdfObject):
def __eq__(self, other):
return (
- other != None and
+ other is not None and
isinstance(other, IndirectObject) and
self.idnum == other.idnum and
self.generation == other.generation and
@@ -489,7 +489,7 @@ class DictionaryObject(dict, PdfObject):
# return None if no metadata was found on the document root.
def getXmpMetadata(self):
metadata = self.get("/Metadata", None)
- if metadata == None:
+ if metadata is None:
return None
metadata = metadata.getObject()
import xmp
diff --git a/ext/pyPdf/pdf.py b/ext/pyPdf/pdf.py
index 6e3fbd41..ee0c4d27 100644
--- a/ext/pyPdf/pdf.py
+++ b/ext/pyPdf/pdf.py
@@ -198,7 +198,7 @@ class PdfFileWriter(object):
# flag is on.
def encrypt(self, user_pwd, owner_pwd = None, use_128bit = True):
import time, random
- if owner_pwd == None:
+ if owner_pwd is None:
owner_pwd = user_pwd
if use_128bit:
V = 2
@@ -252,7 +252,7 @@ class PdfFileWriter(object):
# copying in a new copy of the page object.
for objIndex in xrange(len(self._objects)):
obj = self._objects[objIndex]
- if isinstance(obj, PageObject) and obj.indirectRef != None:
+ if isinstance(obj, PageObject) and obj.indirectRef is not None:
data = obj.indirectRef
if not externalReferenceMap.has_key(data.pdf):
externalReferenceMap[data.pdf] = {}
@@ -341,7 +341,7 @@ class PdfFileWriter(object):
return data
else:
newobj = externMap.get(data.pdf, {}).get(data.generation, {}).get(data.idnum, None)
- if newobj == None:
+ if newobj is None:
newobj = data.pdf.getObject(data)
self._objects.append(None) # placeholder
idnum = len(self._objects)
@@ -427,7 +427,7 @@ class PdfFileReader(object):
# Stability: Added in v1.0, will exist for all v1.x releases.
# @return Returns an integer.
def getNumPages(self):
- if self.flattenedPages == None:
+ if self.flattenedPages is None:
self._flatten()
return len(self.flattenedPages)
@@ -446,7 +446,7 @@ class PdfFileReader(object):
def getPage(self, pageNumber):
## ensure that we're not trying to access an encrypted PDF
#assert not self.trailer.has_key("/Encrypt")
- if self.flattenedPages == None:
+ if self.flattenedPages is None:
self._flatten()
return self.flattenedPages[pageNumber]
@@ -466,7 +466,7 @@ class PdfFileReader(object):
# @return Returns a dict which maps names to {@link #Destination
# destinations}.
def getNamedDestinations(self, tree=None, retval=None):
- if retval == None:
+ if retval is None:
retval = {}
catalog = self.trailer["/Root"]
@@ -478,7 +478,7 @@ class PdfFileReader(object):
if names.has_key("/Dests"):
tree = names['/Dests']
- if tree == None:
+ if tree is None:
return retval
if tree.has_key("/Kids"):
@@ -494,7 +494,7 @@ class PdfFileReader(object):
if isinstance(val, DictionaryObject) and val.has_key('/D'):
val = val['/D']
dest = self._buildDestination(key, val)
- if dest != None:
+ if dest is not None:
retval[key] = dest
return retval
@@ -512,7 +512,7 @@ class PdfFileReader(object):
# Stability: Added in v1.10, will exist for all future v1.x releases.
# @return Returns a nested list of {@link #Destination destinations}.
def getOutlines(self, node=None, outlines=None):
- if outlines == None:
+ if outlines is None:
outlines = []
catalog = self.trailer["/Root"]
@@ -523,7 +523,7 @@ class PdfFileReader(object):
node = lines["/First"]
self._namedDests = self.getNamedDestinations()
- if node == None:
+ if node is None:
return outlines
# see if there are any more outlines
@@ -589,9 +589,9 @@ class PdfFileReader(object):
NameObject("/Resources"), NameObject("/MediaBox"),
NameObject("/CropBox"), NameObject("/Rotate")
)
- if inherit == None:
+ if inherit is None:
inherit = dict()
- if pages == None:
+ if pages is None:
self.flattenedPages = []
catalog = self.trailer["/Root"].getObject()
pages = catalog["/Pages"].getObject()
@@ -617,7 +617,7 @@ class PdfFileReader(object):
def getObject(self, indirectReference):
retval = self.resolvedObjects.get(indirectReference.generation, {}).get(indirectReference.idnum, None)
- if retval != None:
+ if retval is not None:
return retval
if indirectReference.generation == 0 and \
self.xref_objStm.has_key(indirectReference.idnum):
@@ -960,10 +960,10 @@ def getRectangle(self, name, defaults):
retval = self.get(name)
if isinstance(retval, RectangleObject):
return retval
- if retval == None:
+ if retval is None:
for d in defaults:
retval = self.get(d)
- if retval != None:
+ if retval is not None:
break
if isinstance(retval, IndirectObject):
retval = self.pdf.getObject(retval)
diff --git a/modules/sfp_accounts.py b/modules/sfp_accounts.py
index 01bae5b5..90abdf5f 100644
--- a/modules/sfp_accounts.py
+++ b/modules/sfp_accounts.py
@@ -79,7 +79,7 @@ class sfp_accounts(SpiderFootPlugin):
}
)
- if res['content'] == None:
+ if res['content'] is None:
self.sf.debug("Unable to check the status of account " + name \
+ " on " + site)
else:
@@ -106,7 +106,7 @@ class sfp_accounts(SpiderFootPlugin):
kw = self.sf.domainKeyword(eventData, self.opts['_internettlds'])
sites = self.checkSites(kw)
- if sites == None:
+ if sites is None:
return None
for site in sites:
@@ -132,7 +132,7 @@ class sfp_accounts(SpiderFootPlugin):
for user in users:
sites = self.checkSites(user)
- if sites == None:
+ if sites is None:
return None
for site in sites:
diff --git a/modules/sfp_adblock.py b/modules/sfp_adblock.py
index 180da321..7e2cac03 100644
--- a/modules/sfp_adblock.py
+++ b/modules/sfp_adblock.py
@@ -61,9 +61,9 @@ class sfp_adblock(SpiderFootPlugin):
if self.errorState:
return None
- if self.rules == None:
+ if self.rules is None:
raw = self.sf.fetchUrl(self.opts['blocklist'], timeout=30)
- if raw['content'] != None:
+ if raw['content'] is not None:
lines = raw['content'].split('\n')
self.sf.debug("RULE LINES: " + str(len(lines)))
try:
diff --git a/modules/sfp_bingsearch.py b/modules/sfp_bingsearch.py
index 10beb25d..be729691 100644
--- a/modules/sfp_bingsearch.py
+++ b/modules/sfp_bingsearch.py
@@ -63,7 +63,7 @@ class sfp_bingsearch(SpiderFootPlugin):
# Sites hosted on the domain
pages = self.sf.bingIterate("site:" + eventData, dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'], timeout=self.opts['_fetchtimeout']))
- if pages == None:
+ if pages is None:
self.sf.info("No results returned from Bing.")
return None
diff --git a/modules/sfp_blacklist.py b/modules/sfp_blacklist.py
index 8778d538..b890f76d 100644
--- a/modules/sfp_blacklist.py
+++ b/modules/sfp_blacklist.py
@@ -131,7 +131,7 @@ class sfp_blacklist(SpiderFootPlugin):
text = self.checks[domain][k] + " (" + qaddr + ")"
break
- if text != None:
+ if text is not None:
if eventName == "AFFILIATE_IPADDR":
e = "BLACKLISTED_AFFILIATE_IPADDR"
if eventName == "IP_ADDRESS":
diff --git a/modules/sfp_crossref.py b/modules/sfp_crossref.py
index a3113b29..9d226a7b 100644
--- a/modules/sfp_crossref.py
+++ b/modules/sfp_crossref.py
@@ -81,7 +81,7 @@ class sfp_crossref(SpiderFootPlugin):
res = self.sf.fetchUrl(eventData, timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
- if res['content'] == None:
+ if res['content'] is None:
self.sf.debug("Ignoring " + eventData + " as no data returned")
return None
@@ -109,7 +109,7 @@ class sfp_crossref(SpiderFootPlugin):
res = self.sf.fetchUrl(url, timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
- if res['content'] != None:
+ if res['content'] is not None:
for name in self.getTarget().getNames():
pat = re.compile("([\.\'\/\"\ ]" + name + "[\'\/\"\ ])",
re.IGNORECASE)
diff --git a/modules/sfp_defaced.py b/modules/sfp_defaced.py
index adbc9c42..eb0a5527 100644
--- a/modules/sfp_defaced.py
+++ b/modules/sfp_defaced.py
@@ -67,7 +67,7 @@ class sfp_defaced(SpiderFootPlugin):
curDate = time.strftime("%Y%m%d")
url = "http://www.zone-h.org/archive/" + typeId + "=" + target
res = self.sf.fetchUrl(url, useragent=self.opts['_useragent'])
- if res['content'] == None:
+ if res['content'] is None:
self.sf.debug("Unable to fetch data from Zone-H for " + target + "(" + typeId + ")")
return None
@@ -134,7 +134,7 @@ class sfp_defaced(SpiderFootPlugin):
return None
# Notify other modules of what you've found
- if url != None:
+ if url is not None:
text = eventData + "\n" + url
evt = SpiderFootEvent(evtType, text, self.__name__, event)
self.notifyListeners(evt)
diff --git a/modules/sfp_dns.py b/modules/sfp_dns.py
index 620fb7d8..6c703174 100644
--- a/modules/sfp_dns.py
+++ b/modules/sfp_dns.py
@@ -159,7 +159,7 @@ class sfp_dns(SpiderFootPlugin):
return None
pat = re.compile("(%..)?([a-zA-Z0-9\-\.]+\." + name + ")", re.IGNORECASE)
matches = re.findall(pat, urllib2.unquote(eventData))
- if matches != None:
+ if matches is not None:
for match in matches:
self.processHost(match[1], parentEvent, affiliate=False)
# Nothing left to do with internal links and raw data
@@ -321,7 +321,7 @@ class sfp_dns(SpiderFootPlugin):
self.sf.debug("Found host: " + host)
# If the returned hostname is aliaseed to our
# target in some way, flag it as an affiliate
- if affiliate == None:
+ if affiliate is None:
affil = True
if self.getTarget().matches(host):
affil = False
diff --git a/modules/sfp_filemeta.py b/modules/sfp_filemeta.py
index 1752a2b6..64f99f9c 100644
--- a/modules/sfp_filemeta.py
+++ b/modules/sfp_filemeta.py
@@ -79,7 +79,7 @@ class sfp_filemeta(SpiderFootPlugin):
# typically large.
ret = self.sf.fetchUrl(eventData, timeout=self.opts['timeout'],
useragent=self.opts['_useragent'], dontMangle=True)
- if ret['content'] == None:
+ if ret['content'] is None:
self.sf.error("Unable to fetch file for meta analysis: " + \
eventData, False)
return None
@@ -122,14 +122,14 @@ class sfp_filemeta(SpiderFootPlugin):
try:
raw = StringIO(ret['content'])
data = exifread.process_file(raw)
- if data == None or len(data) == 0:
+ if data is None or len(data) == 0:
return None
meta = str(data)
except BaseException as e:
self.sf.error("Unable to parse meta data from: " + \
eventData + "(" + str(e) + ")", False)
- if meta != None:
+ if meta is not None:
evt = SpiderFootEvent("RAW_FILE_META_DATA", meta,
self.__name__, event)
self.notifyListeners(evt)
@@ -148,7 +148,7 @@ class sfp_filemeta(SpiderFootPlugin):
if data.has_key("Image Software"):
val = str(data['Image Software'])
- if val != None:
+ if val is not None:
# Strip non-ASCII
val = ''.join([i if ord(i) < 128 else ' ' for i in val])
evt = SpiderFootEvent("SOFTWARE_USED", val,
diff --git a/modules/sfp_geoip.py b/modules/sfp_geoip.py
index 76255aa1..fdd6d6b5 100644
--- a/modules/sfp_geoip.py
+++ b/modules/sfp_geoip.py
@@ -56,7 +56,7 @@ class sfp_geoip(SpiderFootPlugin):
res = self.sf.fetchUrl("http://freegeoip.net/json/" + eventData,
timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])
- if res['content'] == None:
+ if res['content'] is None:
self.sf.info("No GeoIP info found for " + eventData)
try:
hostip = json.loads(res['content'])
diff --git a/sfdb.py b/sfdb.py
index 566b412a..2bd17fb7 100644
--- a/sfdb.py
+++ b/sfdb.py
@@ -178,7 +178,7 @@ class SpiderFootDb:
# at least we can use this opportunity to ensure we have permissions to
# read and write to such a file.
dbh = sqlite3.connect(self.sf.myPath() + "/" + opts['__database'], timeout=10)
- if dbh == None:
+ if dbh is None:
self.sf.fatal("Could not connect to internal database, and couldn't create " + \
opts['__database'])
dbh.text_factory = str
@@ -238,19 +238,19 @@ class SpiderFootDb:
WHERE s.scan_instance_id = c.scan_instance_id AND \
t.event = c.type AND c.source_event_hash = s.hash "
- if criteria.get('scan_id') != None:
+ if criteria.get('scan_id') is not None:
qry += "AND c.scan_instance_id = ? "
qvars.append(criteria['scan_id'])
- if criteria.get('type') != None:
+ if criteria.get('type') is not None:
qry += " AND c.type = ? "
qvars.append(criteria['type'])
- if criteria.get('value') != None:
+ if criteria.get('value') is not None:
qry += " AND c.data LIKE ? "
qvars.append(criteria['value'])
- if criteria.get('regex') != None:
+ if criteria.get('regex') is not None:
qry += " AND c.data REGEXP ? "
qvars.append(criteria['regex'])
@@ -275,7 +275,7 @@ class SpiderFootDb:
# Log an event to the database
def scanLogEvent(self, instanceId, classification, message, component=None):
- if component == None:
+ if component is None:
component = "SpiderFoot"
qry = "INSERT INTO tbl_scan_log \
@@ -315,15 +315,15 @@ class SpiderFootDb:
qvars = list()
qry = "UPDATE tbl_scan_instance SET "
- if started != None:
+ if started is not None:
qry += " started = ?,"
qvars.append(started)
- if ended != None:
+ if ended is not None:
qry += " ended = ?,"
qvars.append(ended)
- if status != None:
+ if status is not None:
qry += " status = ?,"
qvars.append(status)
@@ -437,7 +437,7 @@ class SpiderFootDb:
ORDER BY generated DESC"
qvars = [instanceId]
- if limit != None:
+ if limit is not None:
qry += " LIMIT ?"
qvars.append(limit)
@@ -455,7 +455,7 @@ class SpiderFootDb:
AND type = 'ERROR' ORDER BY generated DESC"
qvars = [instanceId]
- if limit != None:
+ if limit is not None:
qry += " LIMIT ?"
qvars.append(limit)
diff --git a/sflib.py b/sflib.py
index 43fb57a8..2dc39fd7 100644
--- a/sflib.py
+++ b/sflib.py
@@ -110,7 +110,7 @@ class SpiderFoot:
return self.dbh.scanLogEvent(self.GUID, level, message, component)
def error(self, error, exception=True):
- if self.dbh == None:
+ if self.dbh is None:
print '[Error] ' + error
else:
self._dblog("ERROR", error)
@@ -118,7 +118,7 @@ class SpiderFoot:
raise BaseException("Internal Error Encountered: " + error)
def fatal(self, error):
- if self.dbh == None:
+ if self.dbh is None:
print '[Fatal] ' + error
else:
self._dblog("FATAL", error)
@@ -126,7 +126,7 @@ class SpiderFoot:
sys.exit(-1)
def status(self, message):
- if self.dbh == None:
+ if self.dbh is None:
print "[Status] " + message
else:
self._dblog("STATUS", message)
@@ -135,12 +135,12 @@ class SpiderFoot:
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
- if mod == None:
+ if mod is None:
modName = "Unknown"
else:
modName = mod.__name__
- if self.dbh == None:
+ if self.dbh is None:
print '[' + modName + '] ' + message
else:
self._dblog("INFO", message, modName)
@@ -152,12 +152,12 @@ class SpiderFoot:
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
- if mod == None:
+ if mod is None:
modName = "Unknown"
else:
modName = mod.__name__
- if self.dbh == None:
+ if self.dbh is None:
print '[' + modName + '] ' + message
else:
self._dblog("DEBUG", message, modName)
@@ -338,7 +338,7 @@ class SpiderFoot:
def modulesProducing(self, events):
modlist = list()
for mod in self.opts['__modules__'].keys():
- if self.opts['__modules__'][mod]['provides'] == None:
+ if self.opts['__modules__'][mod]['provides'] is None:
continue
for evtype in self.opts['__modules__'][mod]['provides']:
@@ -352,7 +352,7 @@ class SpiderFoot:
def modulesConsuming(self, events):
modlist = list()
for mod in self.opts['__modules__'].keys():
- if self.opts['__modules__'][mod]['consumes'] == None:
+ if self.opts['__modules__'][mod]['consumes'] is None:
continue
for evtype in self.opts['__modules__'][mod]['consumes']:
@@ -367,7 +367,7 @@ class SpiderFoot:
evtlist = list()
for mod in modules:
if mod in self.opts['__modules__'].keys():
- if self.opts['__modules__'][mod]['provides'] != None:
+ if self.opts['__modules__'][mod]['provides'] is not None:
for evt in self.opts['__modules__'][mod]['provides']:
evtlist.append(evt)
@@ -379,7 +379,7 @@ class SpiderFoot:
evtlist = list()
for mod in modules:
if mod in self.opts['__modules__'].keys():
- if self.opts['__modules__'][mod]['consumes'] != None:
+ if self.opts['__modules__'][mod]['consumes'] is not None:
for evt in self.opts['__modules__'][mod]['consumes']:
evtlist.append(evt)
@@ -444,7 +444,7 @@ class SpiderFoot:
else:
bits = re.match('(.[^/:]*)[:/]', url)
- if bits == None:
+ if bits is None:
return url.lower()
#self.debug('base url of ' + url + ' is: ' + bits.group(1))
@@ -523,7 +523,7 @@ class SpiderFoot:
if needle not in haystack.keys():
return None
- if haystack[needle] == None:
+ if haystack[needle] is None:
return None
for c in haystack[needle]:
@@ -534,12 +534,12 @@ class SpiderFoot:
# Find the element with no parents, that's our root.
root = None
for k in data.keys():
- if data[k] == None:
+ if data[k] is None:
continue
contender = True
for ck in data.keys():
- if data[ck] == None:
+ if data[ck] is None:
continue
if k in data[ck]:
@@ -549,7 +549,7 @@ class SpiderFoot:
root = k
break
- if root == None:
+ if root is None:
#print "*BUG*: Invalid structure - needs to go back to one root."
final = { }
else:
@@ -587,7 +587,7 @@ class SpiderFoot:
def parseLinks(self, url, data, domains):
returnLinks = dict()
- if data == None or len(data) == 0:
+ if data is None or len(data) == 0:
self.debug('parseLinks() called with no data to parse')
return None
@@ -656,11 +656,11 @@ class SpiderFoot:
absLink = self.urlBaseUrl(url) + link
# Maybe the domain was just mentioned and not a link, so we make it one
- if absLink == None and domain.lower() in link.lower():
+ if absLink is None and domain.lower() in link.lower():
absLink = 'http://' + link
# Otherwise, it's a flat link within the current directory
- if absLink == None:
+ if absLink is None:
absLink = self.urlBaseDir(url) + link
# Translate any relative pathing (../)
@@ -680,7 +680,7 @@ class SpiderFoot:
'realurl': None
}
- if url == None:
+ if url is None:
self.error('Blank URL supplied to be fetched')
return result
@@ -695,12 +695,12 @@ class SpiderFoot:
header['User-Agent'] = useragent
# Add custom headers
- if headers != None:
+ if headers is not None:
for k in headers.keys():
header[k] = headers[k]
req = urllib2.Request(url, None, header)
- if cookies != None:
+ if cookies is not None:
req.add_header('cookie', cookies)
self.info("Fetching (incl. cookies): " + url + \
" [user-agent: " + header['User-Agent'] + "] [timeout: " + \
@@ -793,7 +793,7 @@ class SpiderFoot:
self.error("Google doesn't like us right now..", False)
return None
- if firstPage['content'] == None:
+ if firstPage['content'] is None:
self.error("Failed to fetch content from Google.", False)
return None
@@ -813,7 +813,7 @@ class SpiderFoot:
if "start=" + str(fetches*10) in match:
nextUrl = match.replace("&amp;", "&")
- if nextUrl == None:
+ if nextUrl is None:
self.debug("Nothing left to scan for in Google results.")
return returnResults
self.info("Next Google URL: " + nextUrl)
@@ -830,7 +830,7 @@ class SpiderFoot:
self.error("Google doesn't like us right now..", False)
return returnResults
- if nextPage['content'] == None:
+ if nextPage['content'] is None:
self.error("Failed to fetch subsequent content from Google.", False)
return returnResults
@@ -869,7 +869,7 @@ class SpiderFoot:
self.error("Bing doesn't like us right now..", False)
return None
- if firstPage['content'] == None:
+ if firstPage['content'] is None:
self.error("Failed to fetch content from Bing.", False)
return None
@@ -888,7 +888,7 @@ class SpiderFoot:
if "first=" + str((fetches*10)+1) in match:
nextUrl = match.replace("&amp;", "&").replace("%3a", ":")
- if nextUrl == None:
+ if nextUrl is None:
self.debug("Nothing left to scan for in Bing results.")
return returnResults
self.info("Next Bing URL: " + nextUrl)
@@ -905,7 +905,7 @@ class SpiderFoot:
self.error("Bing doesn't like us any more..", False)
return returnResults
- if nextPage['content'] == None:
+ if nextPage['content'] is None:
self.error("Failed to fetch subsequent content from Bing.", False)
return returnResults
@@ -944,7 +944,7 @@ class SpiderFoot:
self.error("Yahoo doesn't like us right now..", False)
return None
- if firstPage['content'] == None:
+ if firstPage['content'] is None:
self.error("Failed to fetch content from Yahoo.", False)
return None
@@ -960,7 +960,7 @@ class SpiderFoot:
if "b=" + str((fetches*10)+1) in match:
nextUrl = u"https://search.yahoo.com" + match
- if nextUrl == None:
+ if nextUrl is None:
self.debug("Nothing left to scan for in Yahoo results.")
return returnResults
self.info("Next Yahoo URL: " + nextUrl)
@@ -977,7 +977,7 @@ class SpiderFoot:
self.error("Yahoo doesn't like us any more..", False)
return returnResults
- if nextPage['content'] == None:
+ if nextPage['content'] is None:
self.error("Failed to fetch subsequent content from Yahoo.", False)
return returnResults
@@ -1051,7 +1051,7 @@ class SpiderFootPlugin(object):
# Gets the current target this module is acting against
def getTarget(self):
- if self._currentTarget == None:
+ if self._currentTarget is None:
print "Internal Error: Module called getTarget() but no target set."
sys.exit(-1)
return self._currentTarget
@@ -1069,7 +1069,7 @@ class SpiderFootPlugin(object):
eventData = sfEvent.data
storeOnly = False # Under some conditions, only store and don't notify
- if eventData == None or (type(eventData) is unicode and len(eventData) == 0):
+ if eventData is None or (type(eventData) is unicode and len(eventData) == 0):
#print "No data to send for " + eventName + " to " + listener.__module__
return None
@@ -1088,8 +1088,8 @@ class SpiderFootPlugin(object):
# notification from one of the upstream events.
prevEvent = sfEvent.sourceEvent
- while prevEvent != None:
- if prevEvent.sourceEvent != None:
+ while prevEvent is not None:
+ if prevEvent.sourceEvent is not None:
if prevEvent.sourceEvent.eventType == sfEvent.eventType and \
prevEvent.sourceEvent.data.lower() == sfEvent.data.lower():
#print "Skipping notification of " + sfEvent.eventType + " / " + sfEvent.data
@@ -1237,7 +1237,7 @@ class SpiderFootTarget(object):
def matches(self, value, includeParents=False, includeChildren=True):
value = value.lower()
- if value == None or value == "":
+ if value is None or value == "":
return False
if netaddr.valid_ipv4(value):