Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def searchTitle(self, title, pagenumber, pagelen):
pubDate = datetime.datetime.now().strftime(self.common.pubDateFormat)

# Set the display type for the link (Fullscreen, Web page, Game Console)
if self.userPrefs.find('displayURL') != None:
if self.userPrefs.find('displayURL') is not None:
urlType = self.userPrefs.find('displayURL').text
else:
urlType = u'fullscreen'
Expand Down Expand Up @@ -519,7 +519,7 @@ def displayTreeView(self):
searchResultTree = []
searchFilter = etree.XPath(u"//item")
userSearchStrings = u'userSearchStrings'
if self.userPrefs.find(userSearchStrings) != None:
if self.userPrefs.find(userSearchStrings) is not None:
userSearch = self.userPrefs.find(userSearchStrings).xpath('./userSearch')
if len(userSearch):
for searchDetails in userSearch:
Expand Down Expand Up @@ -554,7 +554,7 @@ def displayTreeView(self):
# Create a structure of feeds that can be concurrently downloaded
rssData = etree.XML(u'<xml></xml>')
for feedType in [u'treeviewURLS', u'userFeeds']:
if self.userPrefs.find(feedType) == None:
if self.userPrefs.find(feedType) is None:
continue
if not len(self.userPrefs.find(feedType).xpath('./url')):
continue
Expand All @@ -581,7 +581,7 @@ def displayTreeView(self):
print

# Get the RSS Feed data
if rssData.find('url') != None:
if rssData.find('url') is not None:
try:
resultTree = self.common.getUrlData(rssData)
except Exception, errormsg:
Expand All @@ -592,7 +592,7 @@ def displayTreeView(self):
print

# Set the display type for the link (Fullscreen, Web page, Game Console)
if self.userPrefs.find('displayURL') != None:
if self.userPrefs.find('displayURL') is not None:
urlType = self.userPrefs.find('displayURL').text
else:
urlType = u'fullscreen'
Expand Down Expand Up @@ -638,7 +638,7 @@ def displayTreeView(self):
channelLanguage = u'en'
# Create a new directory and/or subdirectory if required
if names[0] != categoryDir:
if categoryDir != None:
if categoryDir is not None:
channelTree.append(categoryElement)
categoryElement = etree.XML(u'<directory></directory>')
categoryElement.attrib['name'] = names[0]
Expand Down Expand Up @@ -714,8 +714,8 @@ def displayTreeView(self):
break

# Add the last directory processed
if categoryElement != None:
if categoryElement.xpath('.//item') != None:
if categoryElement is not None:
if categoryElement.xpath('.//item') is not None:
channelTree.append(categoryElement)

# Check that there was at least some items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def getExternalIP():

ip = getExternalIP()

if ip == None:
if ip is None:
return {}

try:
Expand Down Expand Up @@ -371,7 +371,7 @@ def _initLogger(self):


def textUtf8(self, text):
if text == None:
if text is None:
return text
try:
return unicode(text, 'utf8')
Expand Down Expand Up @@ -541,7 +541,7 @@ def searchForVideos(self, title, pagenumber):
sys.stderr.write(u"! Error: Unknown error during a Video search (%s)\nError(%s)\n" % (title, e))
sys.exit(1)

if data == None:
if data is None:
return None
if not len(data):
return None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def initLogger(self, path=sys.stderr, log_name=u'MNV_Grabber'):


def textUtf8(self, text):
if text == None:
if text is None:
return text
try:
return unicode(text, 'utf8')
Expand Down Expand Up @@ -369,7 +369,7 @@ def getExternalIP():

ip = getExternalIP()

if ip == None:
if ip is None:
return {}

try:
Expand Down Expand Up @@ -508,7 +508,7 @@ def getUrlData(self, inputUrls, pageFilter=None):
urlDictionary[key]['morePages'] = u'false'
urlDictionary[key]['tmp'] = None
urlDictionary[key]['tree'] = None
if element.find('parameter') != None:
if element.find('parameter') is not None:
urlDictionary[key]['parameter'] = element.find('parameter').text

if self.debug:
Expand Down Expand Up @@ -747,7 +747,7 @@ def linkWebPage(self, context, sourceLink):
# Currently there are no link specific Web pages
if not self.linksWebPage:
self.linksWebPage = etree.parse(u'%s/nv_python_libs/configs/XML/customeHtmlPageList.xml' % (self.baseProcessingDir, ))
if self.linksWebPage.find(sourceLink) != None:
if self.linksWebPage.find(sourceLink) is not None:
return u'file://%s/nv_python_libs/configs/HTML/%s' % (self.baseProcessingDir, self.linksWebPage.find(sourceLink).text)
return u'file://%s/nv_python_libs/configs/HTML/%s' % (self.baseProcessingDir, 'nodownloads.html')
# end linkWebPage()
Expand Down Expand Up @@ -1015,7 +1015,7 @@ def run(self):
else:
continue
# Was any data found?
if self.urlDictionary[self.urlKey]['tmp'].getroot() == None:
if self.urlDictionary[self.urlKey]['tmp'].getroot() is None:
sys.stderr.write(u"No Xslt results for Name(%s)\n" % self.urlKey)
sys.stderr.write(u"No Xslt results for url(%s)\n" % self.urlDictionary[self.urlKey]['href'])
if len(self.urlDictionary[self.urlKey]['filter']) == index-1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def getExternalIP():

ip = getExternalIP()

if ip == None:
if ip is None:
return {}

try:
Expand Down Expand Up @@ -658,7 +658,7 @@ def _initLogger(self):


def textUtf8(self, text):
if text == None:
if text is None:
return text
try:
return unicode(text, 'utf8')
Expand Down Expand Up @@ -747,7 +747,7 @@ def searchForVideos(self, title, pagenumber):
sys.stderr.write(u"! Error: Unknown error during a Video search (%s)\nError(%s)\n" % (title, e))
sys.exit(1)

if data == None:
if data is None:
return None
if not len(data):
return None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def displayTreeView(self):
searchResultTree = []
searchFilter = etree.XPath(u"//item")
userSearchStrings = u'userSearchStrings'
if self.userPrefs.find(userSearchStrings) != None:
if self.userPrefs.find(userSearchStrings) is not None:
userSearch = self.userPrefs.find(userSearchStrings).xpath('./userSearch')
if len(userSearch):
for searchDetails in userSearch:
Expand Down Expand Up @@ -513,7 +513,7 @@ def displayTreeView(self):
# Create a structure of feeds that can be concurrently downloaded
rssData = etree.XML(u'<xml></xml>')
for feedType in [u'treeviewURLS', ]:
if self.userPrefs.find(feedType) == None:
if self.userPrefs.find(feedType) is None:
continue
if not len(self.userPrefs.find(feedType).xpath('./url')):
continue
Expand All @@ -540,7 +540,7 @@ def displayTreeView(self):
print

# Get the RSS Feed data
if rssData.find('url') != None:
if rssData.find('url') is not None:
try:
resultTree = self.common.getUrlData(rssData)
except Exception, errormsg:
Expand Down Expand Up @@ -591,7 +591,7 @@ def displayTreeView(self):
channelLanguage = u'en'
# Create a new directory and/or subdirectory if required
if names[0] != categoryDir:
if categoryDir != None:
if categoryDir is not None:
channelTree.append(categoryElement)
categoryElement = etree.XML(u'<directory></directory>')
categoryElement.attrib['name'] = names[0]
Expand All @@ -617,7 +617,7 @@ def displayTreeView(self):
huluItem.find('author').text = u'Hulu'
huluItem.find('pubDate').text = pubdate
description = etree.HTML(etree.tostring(descriptionFilter(itemData)[0], method="text", encoding=unicode).strip())
if descFilter2(description)[0].text != None:
if descFilter2(description)[0].text is not None:
huluItem.find('description').text = self.common.massageText(descFilter2(description)[0].text.strip())
else:
huluItem.find('description').text = u''
Expand Down Expand Up @@ -667,8 +667,8 @@ def displayTreeView(self):
break

# Add the last directory processed
if categoryElement != None:
if categoryElement.xpath('.//item') != None:
if categoryElement is not None:
if categoryElement.xpath('.//item') is not None:
channelTree.append(categoryElement)

# Check that there was at least some items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def searchForVideos(self, search_text, pagenumber):
self.config['target'].mashup_title = self.mashup_title

data_sets = self.config['target'].searchForVideos(search_text, pagenumber)
if data_sets == None:
if data_sets is None:
return
if not len(data_sets):
return
Expand Down Expand Up @@ -272,7 +272,7 @@ def displayTreeView(self):
self.config['target'].mashup_title = self.mashup_title

data_sets = self.config['target'].displayTreeView()
if data_sets == None:
if data_sets is None:
return
if not len(data_sets):
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def searchForVideos(self, title, pagenumber):
print

# Get the source data
if sourceData.find('url') != None:
if sourceData.find('url') is not None:
# Process each directory of the user preferences that have an enabled rss feed
try:
resultTree = self.common.getUrlData(sourceData)
Expand Down Expand Up @@ -488,7 +488,7 @@ def displayTreeView(self):
url = etree.XML(u'<url></url>')
etree.SubElement(url, "name").text = uniqueName
etree.SubElement(url, "href").text = source.attrib.get('url')
if source.attrib.get('parameter') != None:
if source.attrib.get('parameter') is not None:
etree.SubElement(url, "parameter").text = source.attrib.get('parameter')
if len(xsltFilename(source)):
for xsltName in xsltFilename(source):
Expand All @@ -502,7 +502,7 @@ def displayTreeView(self):
print

# Get the source data
if sourceData.find('url') != None:
if sourceData.find('url') is not None:
# Process each directory of the user preferences that have an enabled rss feed
try:
resultTree = self.common.getUrlData(sourceData)
Expand Down Expand Up @@ -566,7 +566,7 @@ def displayTreeView(self):

# Create a new directory and/or subdirectory if required
if names[0] != categoryDir:
if categoryDir != None:
if categoryDir is not None:
channelTree.append(categoryElement)
categoryElement = etree.XML(u'<directory></directory>')
categoryElement.attrib['name'] = names[0]
Expand Down Expand Up @@ -627,7 +627,7 @@ def displayTreeView(self):
break

# Add the last directory processed and the "Special" directories
if categoryElement != None:
if categoryElement is not None:
if len(itemFilter(categoryElement)):
channelTree.append(categoryElement)
# Add the special directories videos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def _initLogger(self):


def textUtf8(self, text):
if text == None:
if text is None:
return text
try:
return unicode(text, 'utf8')
Expand Down Expand Up @@ -392,7 +392,7 @@ def searchTitle(self, title, pagenumber, pagelen):
# Make sure there are no item elements that are None
for item in data:
for key in item.keys():
if item[key] == None:
if item[key] is None:
item[key] = u''

# Massage each field and eliminate any item without a URL
Expand Down Expand Up @@ -420,7 +420,7 @@ def searchTitle(self, title, pagenumber, pagelen):
if key == 'content':
if len(item[key]):
if item[key][0].has_key('language'):
if item[key][0]['language'] != None:
if item[key][0]['language'] is not None:
item['language'] = item[key][0]['language']
if key == 'published_parsed': # '2009-12-21T00:00:00Z'
if item[key]:
Expand Down Expand Up @@ -465,7 +465,7 @@ def videoDetails(self, url, title=u''):
metadata = {}
cur_size = True
for e in etree:
if e.tag.endswith(u'content') and e.text == None:
if e.tag.endswith(u'content') and e.text is None:
index = e.get('url').rindex(u':')
metadata['video'] = self.mtvHtmlPath % (title, e.get('url')[index+1:])
# !! This tag will need to be added at a later date
Expand Down Expand Up @@ -536,7 +536,7 @@ def searchForVideos(self, title, pagenumber):
sys.stderr.write(u"! Error: Unknown error during a Video search (%s)\nError(%s)\n" % (title, e))
sys.exit(1)

if data == None:
if data is None:
return None
if not len(data):
return None
Expand Down Expand Up @@ -696,25 +696,25 @@ def getVideosForURL(self, url, dictionaries):
metadata['language'] = self.config['language']
for e in elements:
if e.tag.endswith(u'title'):
if e.text != None:
if e.text is not None:
metadata['title'] = self.massageDescription(e.text.strip())
else:
metadata['title'] = u''
continue
if e.tag == u'content':
if e.text != None:
if e.text is not None:
metadata['media_description'] = self.massageDescription(e.text.strip())
else:
metadata['media_description'] = u''
continue
if e.tag.endswith(u'published'): # '2007-03-06T00:00:00Z'
if e.text != None:
if e.text is not None:
pub_time = time.strptime(e.text.strip(), "%Y-%m-%dT%H:%M:%SZ")
metadata['published_parsed'] = time.strftime('%a, %d %b %Y %H:%M:%S GMT', pub_time)
else:
metadata['published_parsed'] = u''
continue
if e.tag.endswith(u'content') and e.text == None:
if e.tag.endswith(u'content') and e.text is None:
metadata['video'] = self.ampReplace(e.get('url'))
metadata['duration'] = e.get('duration')
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,13 @@ def updateRev3(self, create=False):
tmpName = anchor.text
if tmpName == u'Revision3 Beta':
continue
if showURL != None:
if showURL is not None:
url = etree.SubElement(tmpDirectory, "url")
etree.SubElement(url, "name").text = tmpName
etree.SubElement(url, "href").text = showURL
etree.SubElement(url, "filter").text = showFilter
etree.SubElement(url, "parserType").text = u'html'
if tmpDirectory.find('url') != None:
if tmpDirectory.find('url') is not None:
showData.append(tmpDirectory)

if self.config['debug_enabled']:
Expand Down Expand Up @@ -391,11 +391,11 @@ def updateRev3(self, create=False):
mp4Format.attrib['enabled'] = u'false'
mp4Format.attrib['name'] = format.text
mp4Format.attrib['rss'] = link
if tmpShow.find('mp4Format') != None:
if tmpShow.find('mp4Format') is not None:
tmpDirectory.append(tmpShow)

# If there is any data then add to new rev3.xml element tree
if tmpDirectory.find('show') != None:
if tmpDirectory.find('show') is not None:
userRev3.append(tmpDirectory)

if self.config['debug_enabled']:
Expand Down Expand Up @@ -731,16 +731,16 @@ def displayTreeView(self):
for index in range(len(names)):
names[index] = self.common.massageText(names[index])
channel = channelFilter(result)[0]
if channel.find('image') != None:
if channel.find('image') is not None:
channelThumbnail = self.common.ampReplace(imageFilter(channel)[0].text)
else:
channelThumbnail = self.common.ampReplace(channel.find('link').text.replace(u'/watch/', u'/images/')+u'100.jpg')
channelLanguage = u'en'
if channel.find('language') != None:
if channel.find('language') is not None:
channelLanguage = channel.find('language').text[:2]
# Create a new directory and/or subdirectory if required
if names[0] != categoryDir:
if categoryDir != None:
if categoryDir is not None:
channelTree.append(categoryElement)
categoryElement = etree.XML(u'<directory></directory>')
if names[0] == personalFeed:
Expand Down Expand Up @@ -813,7 +813,7 @@ def displayTreeView(self):
showElement.append(rev3Item)

# Add the last directory processed
if categoryElement.xpath('.//item') != None:
if categoryElement.xpath('.//item') is not None:
channelTree.append(categoryElement)

# Check that there was at least some items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def can_int(x):
>>> _can_int("A test")
False
"""
if x == None:
if x is None:
return False
try:
int(x)
Expand Down Expand Up @@ -433,7 +433,7 @@ def searchTitle(self, title, pagenumber, pagelen, ignoreError=False):
itemDwnLink = etree.XPath('.//media:content', namespaces=self.common.namespaces)
itemDict = {}
for result in searchResults:
if linkFilter(result) != None: # Make sure that this result actually has a video
if linkFilter(result) is not None: # Make sure that this result actually has a video
thewbItem = etree.XML(self.common.mnvItem)
# These videos are only viewable in the US so add a country indicator
etree.SubElement(thewbItem, "{http://www.mythtv.org/wiki/MythNetvision_Grabber_Script_Format}country").text = u'us'
Expand Down Expand Up @@ -600,11 +600,11 @@ def displayTreeView(self):

# Process any user specified searches
showItems = {}
if len(showFeeds) != None:
if len(showFeeds) is not None:
for searchDetails in showFeeds:
try:
data = self.searchTitle(searchDetails.text.strip(), 1, self.page_limit, ignoreError=True)
if data[0] == None:
if data[0] is None:
continue
except TheWBVideoNotFound, msg:
sys.stderr.write(u"%s\n" % msg)
Expand Down Expand Up @@ -685,7 +685,7 @@ def displayTreeView(self):
self.rssName = etree.XPath('title', namespaces=self.common.namespaces)
self.feedFilter = etree.XPath('//url[text()=$url]')
self.HTMLparser = etree.HTMLParser()
if rssData.find('url') != None:
if rssData.find('url') is not None:
try:
resultTree = self.common.getUrlData(rssData)
except Exception, errormsg:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def __init__(self, key, secret,
self.authorization_url = authorization_url
self.consumer = oauth.OAuthConsumer(self.key, self.secret)

if token != None and token_secret != None:
if token is not None and token_secret is not None:
self.token = oauth.OAuthToken(token, token_secret)
else:
self.token = None
Expand Down Expand Up @@ -325,9 +325,9 @@ def vimeo_albums_getAll(self, user_id, sort=None,
params = {'user_id': user_id}
if sort in ('newest', 'oldest', 'alphabetical'):
params['sort'] = sort
if per_page != None:
if per_page is not None:
params['per_page'] = per_page
if page != None:
if page is not None:
params['page'] = page
return self._do_vimeo_unauthenticated_call(inspect.stack()[0][3].replace('_', '.'),
parameters=params)
Expand All @@ -347,9 +347,9 @@ def vimeo_videos_search(self, query, sort=None,
params['sort'] = sort
else:
params['sort'] = 'most_liked'
if per_page != None:
if per_page is not None:
params['per_page'] = per_page
if page != None:
if page is not None:
params['page'] = page
params['full_response'] = '1'
#params['query'] = query.replace(u' ', u'_')
Expand All @@ -371,9 +371,9 @@ def vimeo_channels_getAll(self, sort=None,
if sort in ('newest', 'oldest', 'alphabetical',
'most_videos', 'most_subscribed', 'most_recently_updated'):
params['sort'] = sort
if per_page != None:
if per_page is not None:
params['per_page'] = per_page
if page != None:
if page is not None:
params['page'] = page

return self._do_vimeo_unauthenticated_call(inspect.stack()[0][3].replace('_', '.'),
Expand All @@ -388,13 +388,13 @@ def vimeo_channels_getVideos(self, channel_id=None, full_response=None,
"""
# full_response channel_id
params = {}
if channel_id != None:
if channel_id is not None:
params['channel_id'] = channel_id
if full_response != None:
if full_response is not None:
params['full_response'] = 1
if per_page != None:
if per_page is not None:
params['per_page'] = per_page
if page != None:
if page is not None:
params['page'] = page

return self._do_vimeo_unauthenticated_call(inspect.stack()[0][3].replace('_', '.'),
Expand Down Expand Up @@ -824,7 +824,7 @@ def _initLogger(self):


def textUtf8(self, text):
if text == None:
if text is None:
return text
try:
return unicode(text, 'utf8')
Expand Down Expand Up @@ -915,7 +915,7 @@ def searchTitle(self, title, pagenumber, pagelen):
except Exception, msg:
raise VimeoVideosSearchError(u'%s' % msg)

if xml_data == None:
if xml_data is None:
raise VimeoVideoNotFound(self.error_messages['VimeoVideoNotFound'] % title)

if not len(xml_data.keys()):
Expand Down Expand Up @@ -1063,7 +1063,7 @@ def searchForVideos(self, title, pagenumber):
sys.stderr.write(u"! Error: Unknown error during a Video search (%s)\nError(%s)\n" % (title, e))
sys.exit(1)

if data == None:
if data is None:
return None
if not len(data):
return None
Expand Down Expand Up @@ -1123,7 +1123,7 @@ def getChannels(self):
except Exception, msg:
raise VimeoAllChannelError(u'%s' % msg)

if xml_data == None:
if xml_data is None:
raise VimeoAllChannelError(self.error_messages['1-VimeoAllChannelError'] % sort)

if not len(xml_data.keys()):
Expand Down Expand Up @@ -1311,7 +1311,7 @@ def getTreeVideos(self, method, dictionaries):
except Exception, msg:
raise VimeoVideosSearchError(u'%s' % msg)

if xml_data == None:
if xml_data is None:
raise VimeoVideoNotFound(self.error_messages['VimeoVideoNotFound'] % self.dir_name)

if not len(xml_data.keys()):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def cinemarvLinkGeneration(self, context, *args):
webURL = args[0]
# If this is for the download then just return what was found for the "link" element
if self.persistence.has_key('cinemarvLinkGeneration'):
if self.persistence['cinemarvLinkGeneration'] != None:
if self.persistence['cinemarvLinkGeneration'] is not None:
returnValue = self.persistence['cinemarvLinkGeneration']
self.persistence['cinemarvLinkGeneration'] = None
return returnValue
Expand All @@ -124,7 +124,7 @@ def cinemarvLinkGeneration(self, context, *args):
except Exception, errmsg:
sys.stderr.write(u'!Warning: The web page URL(%s) could not be read, error(%s)\n' % (webURL, errmsg))
return webURL
if webPageElement == None:
if webPageElement is None:
self.persistence['cinemarvLinkGeneration'] = webURL
return webURL

Expand All @@ -147,7 +147,7 @@ def cinemarvIsCustomHTML(self, context, *args):
return True if the link does not starts with "http://"
return False if the link starts with "http://"
'''
if self.persistence['cinemarvLinkGeneration'] == None:
if self.persistence['cinemarvLinkGeneration'] is None:
return False

if self.persistence['cinemarvLinkGeneration'].startswith(u'http://'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def nasaTitleEp(self, context, *arg):
mythtv = "{%s}" % mythtvNamespace
NSMAP = {'mythtv' : mythtvNamespace}
elementTmp = etree.Element(mythtv + "mythtv", nsmap=NSMAP)
if not episodeNumber == None:
if not episodeNumber is None:
etree.SubElement(elementTmp, "title").text = u"EP%02d: %s" % (episodeNumber, title)
etree.SubElement(elementTmp, mythtv + "episode").text = u"%s" % episodeNumber
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def skyAtNightTitleEp(self, context, *arg):
mythtv = "{%s}" % mythtvNamespace
NSMAP = {'mythtv' : mythtvNamespace}
elementTmp = etree.Element(mythtv + "mythtv", nsmap=NSMAP)
if not episodeNumber == None:
if not episodeNumber is None:
etree.SubElement(elementTmp, "title").text = u"EP%02d" % episodeNumber
etree.SubElement(elementTmp, mythtv + "episode").text = u"%s" % episodeNumber
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def tributecaLinkGeneration(self, context, *args):

# If this is for the download then just return what was found for the "link" element
if self.persistence.has_key('tributecaLinkGeneration'):
if self.persistence['tributecaLinkGeneration'] != None:
if self.persistence['tributecaLinkGeneration'] is not None:
returnValue = self.persistence['tributecaLinkGeneration']
self.persistence['tributecaLinkGeneration'] = None
if returnValue != webURL:
Expand Down Expand Up @@ -233,7 +233,7 @@ def tributecaIsCustomHTML(self, context, *args):
return True if the link does not starts with "http://"
return False if the link starts with "http://"
'''
if self.persistence['tributecaLinkGeneration'] == None:
if self.persistence['tributecaLinkGeneration'] is None:
return False

if self.persistence['tributecaLinkGeneration'].startswith(u'http://'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ def __init__(self,

# Read region code from user preferences, used by tree view
region = self.userPrefs.find("region")
if region != None and region.text:
if region is not None and region.text:
self.config['region'] = region.text
else:
self.config['region'] = u'us'

self.apikey = getData().update(getData().a)

apikey = self.userPrefs.find("apikey")
if apikey != None and apikey.text:
if apikey is not None and apikey.text:
self.apikey = apikey.text

self.feed_icons = {
Expand Down Expand Up @@ -256,7 +256,7 @@ def getExternalIP():

ip = getExternalIP()

if ip == None:
if ip is None:
return {}

try:
Expand Down Expand Up @@ -445,7 +445,7 @@ def parseDetails(self, entry):

for key in item.keys():
# Make sure there are no item elements that are None
if item[key] == None:
if item[key] is None:
item[key] = u''
elif key == 'published_parsed': # 2010-01-23T08:38:39.000Z
if item[key]:
Expand Down Expand Up @@ -499,7 +499,7 @@ def searchForVideos(self, title, pagenumber):
sys.stderr.write(u"! Error: Unknown error during a Video search (%s)\nError(%s)\n" % (title, e))
sys.exit(1)

if data == None:
if data is None:
return None
if not len(data):
return None
Expand Down
16 changes: 8 additions & 8 deletions mythtv/programs/scripts/metadata/Music/mbutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def find_disc(cddrive):
if "offset-list" in result['disc']:
offsets = None
for offset in result['disc']['offset-list']:
if offsets == None:
if offsets is None:
offsets = str(offset)
else:
offsets += " " + str(offset)
Expand Down Expand Up @@ -358,11 +358,11 @@ def main():
performSelfTest()

if opts.searchreleases:
if opts.artist == None:
if opts.artist is None:
print("Missing --artist argument")
sys.exit(1)

if opts.album == None:
if opts.album is None:
print("Missing --album argument")
sys.exit(1)

Expand All @@ -373,7 +373,7 @@ def main():
search_releases(opts.artist, opts.album, limit)

if opts.searchartists:
if opts.artist == None:
if opts.artist is None:
print("Missing --artist argument")
sys.exit(1)

Expand All @@ -384,25 +384,25 @@ def main():
search_artists(opts.artist, limit)

if opts.getartist:
if opts.id == None:
if opts.id is None:
print("Missing --id argument")
sys.exit(1)

get_artist(opts.id)

if opts.finddisc:
if opts.cddevice == None:
if opts.cddevice is None:
print("Missing --cddevice argument")
sys.exit(1)

find_disc(opts.cddevice)

if opts.findcoverart:
if opts.id == None and opts.relgroupid == None:
if opts.id is None and opts.relgroupid is None:
print("Missing --id or --relgroupid argument")
sys.exit(1)

if opts.id != None:
if opts.id is not None:
find_coverart(opts.id)
else:
find_coverart_releasegroup(opts.relgroupid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _unicode(string, encoding=None):
if isinstance(string, compat.unicode):
unicode_string = string
elif isinstance(string, compat.bytes):
# use given encoding, stdin, preferred until something != None is found
# use given encoding, stdin, preferred until something is not None is found
if encoding is None:
encoding = sys.stdin.encoding
if encoding is None:
Expand Down
20 changes: 10 additions & 10 deletions mythtv/programs/scripts/metadata/Television/ttvdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ def fuzzysearch(self, term = None, key = None):
class Episode( tvdb_api.Episode ):
_re_strippart = re.compile('(.*) \([0-9]+\)')
def fuzzysearch(self, term = None, key = None):
if term == None:
if term is None:
raise TypeError("must supply string to search for (contents)")

term = unicode(term).lower()
Expand Down Expand Up @@ -1643,7 +1643,7 @@ def get_graphics(t, opts, series_season_ep, graphics_type, single_option, langua
graphics = sorted(graphics, key=lambda k: k['rating'], reverse=True)
for URL in graphics:
if graphics_type == 'filename':
if URL[graphics_type] == None:
if URL[graphics_type] is None:
continue
if language and 'language' in URL: # Is there a language to filter URLs on?
if language == URL['language']:
Expand Down Expand Up @@ -1753,7 +1753,7 @@ def Getseries_episode_data(t, opts, series_season_ep, language = None):
genres_string = series_data[u'genre'].encode('utf-8')
except:
genres_string=''
if genres_string != None and genres_string != '':
if genres_string is not None and genres_string != '':
genres = change_amp(genres_string)
genres = change_to_commas(genres)

Expand Down Expand Up @@ -1791,7 +1791,7 @@ def Getseries_episode_data(t, opts, series_season_ep, language = None):
continue
i = data_keys.index(key) # Include only specific episode data
except ValueError:
if series_data[season][episode][key] != None:
if series_data[season][episode][key] is not None:
text = series_data[season][episode][key]
if isinstance(text, dict):
# handle language tuple
Expand All @@ -1810,11 +1810,11 @@ def Getseries_episode_data(t, opts, series_season_ep, language = None):
continue
text = series_data[season][episode][key]

if text == None and key.title() == 'Director':
if text is None and key.title() == 'Director':
text = u"Unknown"
if isinstance(text, list):
text = ', '.join(text)
if text == None or text == 'None':
if text is None or text == 'None':
continue
else:
# handle language tuple
Expand All @@ -1832,7 +1832,7 @@ def Getseries_episode_data(t, opts, series_season_ep, language = None):
print(u"Title:%s" % series_data[u'seriesname'])

for key in data_titles:
if key_values[index] != None:
if key_values[index] is not None:
if data_titles[index] == u'ReleaseDate:' and len(key_values[index]) > 4:
print(u'%s%s'% (u'Year:', key_values[index][:4]))
if key_values[index] != 'None':
Expand Down Expand Up @@ -2119,7 +2119,7 @@ def displaySearchXML(tvdb_api):

tvdbQueryXslt = etree.XSLT(etree.parse(u'%s%s' % (tvdb_api.baseXsltDir, u'tvdbQuery.xsl')))
items = tvdbQueryXslt(tvdb_api.searchTree)
if items.getroot() != None:
if items.getroot() is not None:
if len(items.xpath('//item')):
sys.stdout.write(etree.tostring(items, encoding='UTF-8', method="xml", xml_declaration=True, pretty_print=True, ))
return 0
Expand All @@ -2144,7 +2144,7 @@ def displaySeriesXML(tvdb_api, series_season_ep):

tvdbQueryXslt = etree.XSLT(etree.parse(u'%s%s' % (tvdb_api.baseXsltDir, u'tvdbVideo.xsl')))
items = tvdbQueryXslt(allDataElement)
if items.getroot() != None:
if items.getroot() is not None:
if len(items.xpath('//item')):
sys.stdout.write(etree.tostring(items, encoding='UTF-8', method="xml", xml_declaration=True, pretty_print=True, ))
return 0
Expand All @@ -2169,7 +2169,7 @@ def displayCollectionXML(tvdb_api):

tvdbCollectionXslt = etree.XSLT(etree.parse(u'%s%s' % (tvdb_api.baseXsltDir, u'tvdbCollection.xsl')))
items = tvdbCollectionXslt(tvdb_api.seriesInfoTree)
if items.getroot() != None:
if items.getroot() is not None:
if len(items.xpath('//item')):
sys.stdout.write(etree.tostring(items, encoding='UTF-8', method="xml", xml_declaration=True, pretty_print=True, ))
return 0
Expand Down