From 015d269667c50415a42e08b905b377648354e337 Mon Sep 17 00:00:00 2001 From: Jesse Mullan Date: Sat, 1 Nov 2014 16:22:05 -0700 Subject: [PATCH] Fix E711 comparison to None should be if cond is None: --- headphones/classes.py | 2 +- headphones/db.py | 6 +++--- headphones/importer.py | 2 +- headphones/mb.py | 6 +++--- headphones/nzbget.py | 4 ++-- headphones/sab.py | 2 +- headphones/utorrent.py | 2 +- lib/apscheduler/jobstores/base.py | 2 +- lib/beets/autotag/hooks.py | 4 ++-- lib/bs4/builder/_html5lib.py | 2 +- lib/feedparser.py | 2 +- lib/httplib2/__init__.py | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/headphones/classes.py b/headphones/classes.py index 165039e9..7d269741 100644 --- a/headphones/classes.py +++ b/headphones/classes.py @@ -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" diff --git a/headphones/db.py b/headphones/db.py index 717e8ac2..2d113088 100644 --- a/headphones/db.py +++ b/headphones/db.py @@ -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 diff --git a/headphones/importer.py b/headphones/importer.py index f94a7913..a7482523 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -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: diff --git a/headphones/mb.py b/headphones/mb.py index 5e338769..d097dced 100644 --- a/headphones/mb.py +++ b/headphones/mb.py @@ -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 ? diff --git a/headphones/nzbget.py b/headphones/nzbget.py index 80ce36db..d14dade8 100644 --- a/headphones/nzbget.py +++ b/headphones/nzbget.py @@ -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) diff --git a/headphones/sab.py b/headphones/sab.py index 5d55913e..a1466545 100644 --- a/headphones/sab.py +++ b/headphones/sab.py @@ -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 diff --git a/headphones/utorrent.py b/headphones/utorrent.py index df46de70..b984adac 100644 --- a/headphones/utorrent.py +++ b/headphones/utorrent.py @@ -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) diff --git a/lib/apscheduler/jobstores/base.py b/lib/apscheduler/jobstores/base.py index e09e40a2..d9f7147b 100644 --- a/lib/apscheduler/jobstores/base.py +++ b/lib/apscheduler/jobstores/base.py @@ -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. diff --git a/lib/beets/autotag/hooks.py b/lib/beets/autotag/hooks.py index 74c8cf82..883703f2 100644 --- a/lib/beets/autotag/hooks.py +++ b/lib/beets/autotag/hooks.py @@ -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() diff --git a/lib/bs4/builder/_html5lib.py b/lib/bs4/builder/_html5lib.py index 7de36ae7..d46b695b 100644 --- a/lib/bs4/builder/_html5lib.py +++ b/lib/bs4/builder/_html5lib.py @@ -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 diff --git a/lib/feedparser.py b/lib/feedparser.py index ed5695bf..15fdc95b 100644 --- a/lib/feedparser.py +++ b/lib/feedparser.py @@ -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() diff --git a/lib/httplib2/__init__.py b/lib/httplib2/__init__.py index 441dfdc8..3652df61 100755 --- a/lib/httplib2/__init__.py +++ b/lib/httplib2/__init__.py @@ -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']