mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-16 08:35:32 +01:00
Fix E711 comparison to None should be if cond is None:
This commit is contained in:
@@ -91,7 +91,7 @@ class SearchResult:
|
||||
|
||||
def __str__(self):
|
||||
|
||||
if self.provider == None:
|
||||
if self.provider is None:
|
||||
return "Invalid provider, unable to print self"
|
||||
|
||||
myString = self.provider.name + " @ " + self.url + "\n"
|
||||
|
||||
@@ -58,14 +58,14 @@ class DBConnection:
|
||||
|
||||
def action(self, query, args=None):
|
||||
|
||||
if query == None:
|
||||
if query is None:
|
||||
return
|
||||
|
||||
sqlResult = None
|
||||
|
||||
try:
|
||||
with self.connection as c:
|
||||
if args == None:
|
||||
if args is None:
|
||||
sqlResult = c.execute(query)
|
||||
else:
|
||||
sqlResult = c.execute(query, args)
|
||||
@@ -87,7 +87,7 @@ class DBConnection:
|
||||
|
||||
sqlResults = self.action(query, args).fetchall()
|
||||
|
||||
if sqlResults == None or sqlResults == [None]:
|
||||
if sqlResults is None or sqlResults == [None]:
|
||||
return []
|
||||
|
||||
return sqlResults
|
||||
|
||||
@@ -780,7 +780,7 @@ def getHybridRelease(fullreleaselist):
|
||||
# Change this value to change the sorting behaviour of none, returning
|
||||
# 'None' will put it at the top which was normal behaviour for pre-ngs
|
||||
# versions
|
||||
if releaseDate == None:
|
||||
if releaseDate is None:
|
||||
return 'None';
|
||||
|
||||
if releaseDate.count('-') == 2:
|
||||
|
||||
@@ -218,7 +218,7 @@ def getArtist(artistid, extrasonly=False):
|
||||
artist = musicbrainzngs.get_artist_by_id(artistid)['artist']
|
||||
newRgs = None
|
||||
artist['release-group-list'] = []
|
||||
while newRgs == None or len(newRgs) >= limit:
|
||||
while newRgs is None or len(newRgs) >= limit:
|
||||
newRgs = musicbrainzngs.browse_release_groups(artistid, release_type="album", offset=len(artist['release-group-list']), limit=limit)['release-group-list']
|
||||
artist['release-group-list'] += newRgs
|
||||
except musicbrainzngs.WebServiceError as e:
|
||||
@@ -299,7 +299,7 @@ def getArtist(artistid, extrasonly=False):
|
||||
try:
|
||||
limit = 200
|
||||
newRgs = None
|
||||
while newRgs == None or len(newRgs) >= limit:
|
||||
while newRgs is None or len(newRgs) >= limit:
|
||||
newRgs = musicbrainzngs.browse_release_groups(artistid, release_type=include, offset=len(mb_extras_list), limit=limit)['release-group-list']
|
||||
mb_extras_list += newRgs
|
||||
except musicbrainzngs.WebServiceError as e:
|
||||
@@ -417,7 +417,7 @@ def get_new_releases(rgid, includeExtras=False, forcefull=False):
|
||||
try:
|
||||
limit = 100
|
||||
newResults = None
|
||||
while newResults == None or len(newResults) >= limit:
|
||||
while newResults is None or len(newResults) >= limit:
|
||||
newResults = musicbrainzngs.browse_releases(release_group=rgid, includes=['artist-credits', 'labels', 'recordings', 'release-groups', 'media'], limit=limit, offset=len(results))
|
||||
if 'release-list' not in newResults:
|
||||
break #may want to raise an exception here instead ?
|
||||
|
||||
@@ -37,7 +37,7 @@ def sendNZB(nzb):
|
||||
addToTop = False
|
||||
nzbgetXMLrpc = "%(username)s:%(password)s@%(host)s/xmlrpc"
|
||||
|
||||
if headphones.CONFIG.NZBGET_HOST == None:
|
||||
if headphones.CONFIG.NZBGET_HOST is None:
|
||||
logger.error(u"No NZBget host found in configuration. Please configure it.")
|
||||
return False
|
||||
|
||||
@@ -90,7 +90,7 @@ def sendNZB(nzb):
|
||||
if nzb.resultType == "nzb":
|
||||
genProvider = GenericProvider("")
|
||||
data = genProvider.getURL(nzb.url)
|
||||
if (data == None):
|
||||
if (data is None):
|
||||
return False
|
||||
nzbcontent64 = standard_b64encode(data)
|
||||
nzbget_result = nzbGetRPC.append(nzb.name + ".nzb", headphones.CONFIG.NZBGET_CATEGORY, addToTop, nzbcontent64)
|
||||
|
||||
@@ -100,7 +100,7 @@ def sendNZB(nzb):
|
||||
logger.error(u"Error: " + str(e))
|
||||
return False
|
||||
|
||||
if f == None:
|
||||
if f is None:
|
||||
logger.info(u"No data returned from SABnzbd, NZB not sent")
|
||||
return False
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ def addTorrent(link, hash):
|
||||
# If there's no folder yet then it's probably a magnet, try until folder is populated
|
||||
if torrent_folder == active_dir or not torrent_folder:
|
||||
tries = 1
|
||||
while (torrent_folder == active_dir or torrent_folder == None) and tries <= 10:
|
||||
while (torrent_folder == active_dir or torrent_folder is None) and tries <= 10:
|
||||
tries += 1
|
||||
time.sleep(6)
|
||||
torrent_folder, cacheid = dirTorrent(hash, cacheid)
|
||||
|
||||
@@ -84,7 +84,7 @@ class BaseJobStore(six.with_metaclass(ABCMeta)):
|
||||
def get_all_jobs(self):
|
||||
"""
|
||||
Returns a list of all jobs in this job store. The returned jobs should be sorted by next run time (ascending).
|
||||
Paused jobs (next_run_time == None) should be sorted last.
|
||||
Paused jobs (next_run_time is None) should be sorted last.
|
||||
|
||||
The job store is responsible for setting the ``scheduler`` and ``jobstore`` attributes of the returned jobs to
|
||||
point to the scheduler and itself, respectively.
|
||||
|
||||
@@ -206,8 +206,8 @@ def string_dist(str1, str2):
|
||||
an edit distance, normalized by the string length, with a number of
|
||||
tweaks that reflect intuition about text.
|
||||
"""
|
||||
if str1 == None and str2 == None: return 0.0
|
||||
if str1 == None or str2 == None: return 1.0
|
||||
if str1 is None and str2 is None: return 0.0
|
||||
if str1 is None or str2 is None: return 1.0
|
||||
|
||||
str1 = str1.lower()
|
||||
str2 = str2.lower()
|
||||
|
||||
@@ -268,7 +268,7 @@ class Element(html5lib.treebuilders._base.Node):
|
||||
return self.element.contents
|
||||
|
||||
def getNameTuple(self):
|
||||
if self.namespace == None:
|
||||
if self.namespace is None:
|
||||
return namespaces["html"], self.name
|
||||
else:
|
||||
return self.namespace, self.name
|
||||
|
||||
@@ -1736,7 +1736,7 @@ if _XML_AVAILABLE:
|
||||
else:
|
||||
givenprefix = None
|
||||
prefix = self._matchnamespaces.get(lowernamespace, givenprefix)
|
||||
if givenprefix and (prefix == None or (prefix == '' and lowernamespace == '')) and not self.namespacesInUse.has_key(givenprefix):
|
||||
if givenprefix and (prefix is None or (prefix == '' and lowernamespace == '')) and not self.namespacesInUse.has_key(givenprefix):
|
||||
raise UndeclaredNamespace, "'%s' is not associated with a namespace" % givenprefix
|
||||
localname = str(localname).lower()
|
||||
|
||||
|
||||
@@ -939,7 +939,7 @@ the same interface as FileCache."""
|
||||
if response.has_key('location'):
|
||||
location = response['location']
|
||||
(scheme, authority, path, query, fragment) = parse_uri(location)
|
||||
if authority == None:
|
||||
if authority is None:
|
||||
response['location'] = urlparse.urljoin(absolute_uri, location)
|
||||
if response.status == 301 and method in ["GET", "HEAD"]:
|
||||
response['-x-permanent-redirect-url'] = response['location']
|
||||
|
||||
Reference in New Issue
Block a user