Skip to content
Snippets Groups Projects
Commit da04d639 authored by Jean-Christophe Fillion-Robin's avatar Jean-Christophe Fillion-Robin
Browse files

STYLE: src/Admin: Update python scripts to use "is None" instead of "== None"

Rational copied from https://www.python.org/dev/peps/pep-0290/#testing-for-none

// -----------------
Since there is only one None object, equality can be tested with identity. Identity
tests are slightly faster than equality tests. Also, some object types may overload
comparison, so equality testing may be much slower.

Pattern:

if v == None  -->  if v is None:
if v != None  -->  if v is not None:
// -----------------


Former-commit-id: 48ab42f0
parent f095f263
No related branches found
No related tags found
No related merge requests found
......@@ -88,7 +88,7 @@ def getPage(url):
for i in f.readlines():
page += i
date = f.info().getdate('Last-Modified')
if date == None:
if date is None:
date = (0, 0, 0)
else:
date = date[:3]
......@@ -112,7 +112,7 @@ def getRobotParser(startUrl):
robotUrl = urlparse.urljoin(startUrl, "/robots.txt")
page, date, url = getPage(robotUrl)
if page == None:
if page is None:
print "Could not read ROBOTS.TXT at:", robotUrl
return None
# end if
......@@ -205,11 +205,11 @@ def parsePages(startUrl, maxUrls, blockExtensions):
while True:
url = getUrlToProcess(pageMap)
if url == None:
if url is None:
break
print " ", url
page, date, newUrl = getPage(url)
if page == None:
if page is None:
del pageMap[url]
elif url != newUrl:
print "Redirect -> " + newUrl
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment