PEP8: Test for membership should be 'not in'

This commit is contained in:
labrys 2016-05-31 03:25:16 -04:00 committed by Labrys
parent 38ed3350ac
commit 061a167b56
5 changed files with 11 additions and 11 deletions

View file

@ -71,7 +71,7 @@ class autoProcessComics(object):
if "Post Processing SUCCESSFUL" in line: if "Post Processing SUCCESSFUL" in line:
success = True success = True
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))]

View file

@ -78,7 +78,7 @@ class autoProcessGames(object):
logger.error("No library specified to move files to. Please edit your configuration.", section) logger.error("No library specified to move files to. Please edit your configuration.", section)
return [1, "%s: Failed to post-process - No library defined in %s" % (section, section)] return [1, "%s: Failed to post-process - No library defined in %s" % (section, section)]
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))]
elif result['success']: elif result['success']:

View file

@ -213,7 +213,7 @@ class autoProcessMovie(object):
logger.error("Transcoding failed for files in %s" % (dirName), section) logger.error("Transcoding failed for files in %s" % (dirName), section)
return [1, "%s: Failed to post-process - Transcoding failed" % (section)] return [1, "%s: Failed to post-process - Transcoding failed" % (section)]
for video in listMediaFiles(dirName, media=True, audio=False, meta=False, archives=False): for video in listMediaFiles(dirName, media=True, audio=False, meta=False, archives=False):
if not release and not ".cp(tt" in video and imdbid: if not release and ".cp(tt" not in video and imdbid:
videoName, videoExt = os.path.splitext(video) videoName, videoExt = os.path.splitext(video)
video2 = "%s.cp(%s)%s" % (videoName, imdbid, videoExt) video2 = "%s.cp(%s)%s" % (videoName, imdbid, videoExt)
if not (clientAgent in [core.TORRENT_CLIENTAGENT, 'manual'] and core.USELINK == 'move-sym'): if not (clientAgent in [core.TORRENT_CLIENTAGENT, 'manual'] and core.USELINK == 'move-sym'):
@ -248,7 +248,7 @@ class autoProcessMovie(object):
return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section)] return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section)]
result = r.json() result = r.json()
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))]
elif result['success']: elif result['success']:
@ -290,7 +290,7 @@ class autoProcessMovie(object):
return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section)] return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section)]
result = r.json() result = r.json()
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))]
elif result['success']: elif result['success']:
@ -311,7 +311,7 @@ class autoProcessMovie(object):
return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section)] return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section)]
result = r.json() result = r.json()
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))]
elif result['success']: elif result['success']:

View file

@ -117,7 +117,7 @@ class autoProcessMusic(object):
logger.debug("Result: %s" % (r.text), section) logger.debug("Result: %s" % (r.text), section)
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))]
elif r.text == "OK": elif r.text == "OK":

View file

@ -24,7 +24,7 @@ class autoProcessTV(object):
except requests.ConnectionError: except requests.ConnectionError:
logger.error("Unable to open URL: %s" % (url1), section) logger.error("Unable to open URL: %s" % (url1), section)
return None return None
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return None return None
else: else:
@ -41,7 +41,7 @@ class autoProcessTV(object):
except requests.ConnectionError: except requests.ConnectionError:
logger.error("Unable to open URL: %s" % (url2), section) logger.error("Unable to open URL: %s" % (url2), section)
return False return False
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return False return False
else: else:
@ -136,7 +136,7 @@ class autoProcessTV(object):
if e.errno != errno.EEXIST: if e.errno != errno.EEXIST:
raise raise
if not 'process_method' in fork_params or (clientAgent in ['nzbget', 'sabnzbd'] and nzbExtractionBy != "Destination"): if 'process_method' not in fork_params or (clientAgent in ['nzbget', 'sabnzbd'] and nzbExtractionBy != "Destination"):
if inputName: if inputName:
process_all_exceptions(inputName, dirName) process_all_exceptions(inputName, dirName)
inputName, dirName = convert_to_ascii(inputName, dirName) inputName, dirName = convert_to_ascii(inputName, dirName)
@ -288,7 +288,7 @@ class autoProcessTV(object):
logger.error("Unable to open URL: %s" % (url), section) logger.error("Unable to open URL: %s" % (url), section)
return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section)] return [1, "%s: Failed to post-process - Unable to connect to %s" % (section, section)]
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error("Server returned status %s" % (str(r.status_code)), section) logger.error("Server returned status %s" % (str(r.status_code)), section)
return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))] return [1, "%s: Failed to post-process - Server returned status %s" % (section, str(r.status_code))]