Fix PEP8 whitespace violations

This commit is contained in:
Labrys 2018-12-25 16:04:58 -05:00 committed by Lizband
commit 52c6096b6a
14 changed files with 237 additions and 225 deletions

View file

@ -35,12 +35,13 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp
pass pass
control_value_dict = {"input_directory": text_type(input_directory1)} control_value_dict = {"input_directory": text_type(input_directory1)}
new_value_dict = {"input_name": text_type(input_name1), new_value_dict = {
"input_name": text_type(input_name1),
"input_hash": text_type(input_hash), "input_hash": text_type(input_hash),
"input_id": text_type(input_id), "input_id": text_type(input_id),
"client_agent": text_type(client_agent), "client_agent": text_type(client_agent),
"status": 0, "status": 0,
"last_update": datetime.date.today().toordinal() "last_update": datetime.date.today().toordinal(),
} }
my_db.upsert("downloads", new_value_dict, control_value_dict) my_db.upsert("downloads", new_value_dict, control_value_dict)

View file

@ -146,6 +146,7 @@ def rename_script(dirname):
except Exception as error: except Exception as error:
logger.error("Unable to rename file due to: {error}".format(error=error), "EXCEPTION") logger.error("Unable to rename file due to: {error}".format(error=error), "EXCEPTION")
def par2(dirname): def par2(dirname):
newlist = [] newlist = []
sofar = 0 sofar = 0

View file

@ -45,10 +45,15 @@ requests.packages.urllib3.disable_warnings()
# Monkey Patch shutil.copyfileobj() to adjust the buffer length to 512KB rather than 4KB # Monkey Patch shutil.copyfileobj() to adjust the buffer length to 512KB rather than 4KB
shutil.copyfileobjOrig = shutil.copyfileobj shutil.copyfileobjOrig = shutil.copyfileobj
def copyfileobj_fast(fsrc, fdst, length=512 * 1024): def copyfileobj_fast(fsrc, fdst, length=512 * 1024):
shutil.copyfileobjOrig(fsrc, fdst, length=length) shutil.copyfileobjOrig(fsrc, fdst, length=length)
shutil.copyfileobj = copyfileobj_fast shutil.copyfileobj = copyfileobj_fast
def report_nzb(failure_link, client_agent): def report_nzb(failure_link, client_agent):
# Contact indexer site # Contact indexer site
logger.info("Sending failure notification to indexer site") logger.info("Sending failure notification to indexer site")
@ -605,6 +610,7 @@ def parse_vuze(args):
return input_directory, input_name, input_category, input_hash, input_id return input_directory, input_name, input_category, input_hash, input_id
def parse_qbittorrent(args): def parse_qbittorrent(args):
# qbittorrent usage: C:\full\path\to\nzbToMedia\TorrentToMedia.py "%D|%N|%L|%I" # qbittorrent usage: C:\full\path\to\nzbToMedia\TorrentToMedia.py "%D|%N|%L|%I"
try: try:
@ -634,6 +640,7 @@ def parse_qbittorrent(args):
return input_directory, input_name, input_category, input_hash, input_id return input_directory, input_name, input_category, input_hash, input_id
def parse_args(client_agent, args): def parse_args(client_agent, args):
clients = { clients = {
'other': parse_other, 'other': parse_other,
@ -1309,6 +1316,7 @@ def get_download_info(input_name, status):
return sql_results return sql_results
class WindowsProcess(object): class WindowsProcess(object):
def __init__(self): def __init__(self):
self.mutex = None self.mutex = None
@ -1385,6 +1393,7 @@ class PosixProcess(object):
if os.path.isfile(self.pidpath): if os.path.isfile(self.pidpath):
os.unlink(self.pidpath) os.unlink(self.pidpath)
if os.name == 'nt': if os.name == 'nt':
RunningProcess = WindowsProcess RunningProcess = WindowsProcess
else: else:

View file

@ -19,6 +19,7 @@ try:
except ImportError: except ImportError:
import simplejson as json import simplejson as json
class UTorrentClient(object): class UTorrentClient(object):
def __init__(self, base_url, username, password): def __init__(self, base_url, username, password):

View file

@ -53,8 +53,7 @@ class MultiPartForm(object):
# Add the files to upload # Add the files to upload
parts.extend( parts.extend(
[part_boundary, [part_boundary,
'Content-Disposition: file; name="%s"; filename="%s"' % \ 'Content-Disposition: file; name="%s"; filename="%s"' % (field_name, filename),
(field_name, filename),
'Content-Type: %s' % content_type, 'Content-Type: %s' % content_type,
'', '',
body, body,

View file

@ -668,12 +668,13 @@ def process(input_directory, input_name=None, status=0, client_agent='manual', d
pass pass
control_value_dict = {"input_directory": text_type(input_directory1)} control_value_dict = {"input_directory": text_type(input_directory1)}
new_value_dict = {"input_name": text_type(input_name1), new_value_dict = {
"input_name": text_type(input_name1),
"input_hash": text_type(download_id), "input_hash": text_type(download_id),
"input_id": text_type(download_id), "input_id": text_type(download_id),
"client_agent": text_type(client_agent), "client_agent": text_type(client_agent),
"status": 0, "status": 0,
"last_update": datetime.date.today().toordinal() "last_update": datetime.date.today().toordinal(),
} }
my_db.upsert("downloads", new_value_dict, control_value_dict) my_db.upsert("downloads", new_value_dict, control_value_dict)