PEP8: Fix formatting

* Remove redundant backslash between brackets
* Fix multiple statements on one line
* Fix missing/excess whitespace
* Fix comments not starting with a single `#` and a space
* Convert tabs to spaces
This commit is contained in:
Labrys 2016-05-31 11:59:25 -04:00
parent 0a1fe84306
commit 38ed3350ac
5 changed files with 97 additions and 95 deletions

View file

@ -13,8 +13,8 @@ requests.packages.urllib3.disable_warnings()
class autoProcessComics(object):
def processEpisode(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None):
if int(status) != 0:
logger.warning("FAILED DOWNLOAD DETECTED, nothing to process.",section)
return [1, "%s: Failed to post-process. %s does not support failed downloads" % (section, section) ]
logger.warning("FAILED DOWNLOAD DETECTED, nothing to process.", section)
return [1, "%s: Failed to post-process. %s does not support failed downloads" % (section, section)]
host = core.CFG[section][inputCategory]["host"]
port = core.CFG[section][inputCategory]["port"]
@ -41,7 +41,7 @@ class autoProcessComics(object):
url = "%s%s:%s%s/post_process" % (protocol, host, port, web_root)
if not server_responding(url):
logger.error("Server did not respond. Exiting", section)
return [1, "%s: Failed to post-process - %s did not respond." % (section, section) ]
return [1, "%s: Failed to post-process - %s did not respond." % (section, section)]
inputName, dirName = convert_to_ascii(inputName, dirName)
clean_name, ext = os.path.splitext(inputName)
@ -64,18 +64,20 @@ class autoProcessComics(object):
r = requests.get(url, auth=(username, password), params=params, stream=True, verify=False, timeout=(30, 300))
except requests.ConnectionError:
logger.error("Unable to open 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)]
for line in r.iter_lines():
if line: logger.postprocess("%s" % (line), section)
if "Post Processing SUCCESSFUL" in line: success = True
if line:
logger.postprocess("%s" % (line), section)
if "Post Processing SUCCESSFUL" in line:
success = True
if not r.status_code in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
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))]
if success:
logger.postprocess("SUCCESS: This issue has been processed successfully",section)
return [0, "%s: Successfully post-processed %s" % (section, inputName) ]
logger.postprocess("SUCCESS: This issue has been processed successfully", section)
return [0, "%s: Successfully post-processed %s" % (section, inputName)]
else:
logger.warning("The issue does not appear to have successfully processed. Please check your Logs",section)
return [1, "%s: Failed to post-process - Returned log from %s was not as expected." % (section, section) ]
logger.warning("The issue does not appear to have successfully processed. Please check your Logs", section)
return [1, "%s: Failed to post-process - Returned log from %s was not as expected." % (section, section)]