Format code to PEP8 standards

This commit is contained in:
2019-10-23 20:58:15 +02:00
parent 7b5196fb11
commit 769d4b116c

View File

@ -50,6 +50,7 @@ from clutch.core import Client
from collections import defaultdict
from pprint import pformat
def open_config_file():
"""Reads configuration from config.json file"""
@ -91,10 +92,15 @@ def filter_updatable_torrents():
for torrent, data in list(torrents.items()):
keys_to_check = {'local-version', 'remote-version', 'transmission-id'}
if not ( keys_to_check.issubset(data.keys())
and data['local-version'] < data['remote-version']):
if not (
keys_to_check.issubset(data.keys())
and
data['local-version'] < data['remote-version']
):
del torrents[torrent]
logging.info('The following torrents can be updated: %s', pformat(torrents))
logging.info(
'The following torrents can be updated: %s', pformat(torrents)
)
def prompt_for_update():
@ -173,10 +179,16 @@ def update_torrents():
"""
logging.info('Updating torrents')
for torrent in torrents.values():
old_name = os.path.join(config['mame-directory'], torrent['local-name'])
new_name = os.path.join(config['mame-directory'], torrent['remote-name'])
old_name = os.path.join(
config['mame-directory'],
torrent['local-name']
)
new_name = os.path.join(
config['mame-directory'],
torrent['remote-name']
)
client.torrent.remove(torrent['transmission-id']);
client.torrent.remove(torrent['transmission-id'])
os.rename(old_name, new_name)
client.torrent.add(
filename=torrent['remote-link'],
@ -198,7 +210,7 @@ if __name__ == '__main__':
print('{}\r'.format(i), end=''),
time.sleep(1)
re_mame_version = re.compile('MAME 0.(\d+) (.*)')
re_mame_version = re.compile(r'MAME 0.(\d+) (.*)')
config = open_config_file()
torrents = defaultdict(dict)