From 2389e76659c51432753fcc6ffaa8072a95619b09 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 12 Sep 2012 13:41:56 +0200 Subject: [PATCH] no need for .keys() when iterating --- pandoraclient | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandoraclient b/pandoraclient index 98a3cec..5b3814e 100755 --- a/pandoraclient +++ b/pandoraclient @@ -132,7 +132,7 @@ def organize(): issues['duplicate files'].append(sorted(map(lambda x: x['path'], files_by_hash[hash]))) print 'Scanning for inconsistencies' - for key in sorted(files_by_item.keys()): + for key in sorted(files_by_item): item_files = files_by_item[key] # missing video, missing subtitles, multiple versions versions = ox.movie.parse_item_files(item_files) @@ -239,11 +239,11 @@ def organize(): print 'Writing %s' % FILES['organize'] data = ['{'] - sections = sorted(keys.keys()) + sections = sorted(keys) for s, section in enumerate(sections): data.append('') data.append(4 * ' ' + '"%s": {' % section) - actions = sorted(keys[section].keys()) + actions = sorted(keys[section]) for a, action in enumerate(actions): data.append('') data.append(8 * ' ' + '"%s": [' % action) @@ -350,7 +350,7 @@ def sync(): print file['path'] sys.exit() file_path_by_hash[i][file['hash']] = file['path'] - for path in sorted(directories[i].keys()): + for path in sorted(directories[i]): directory = directories[i][path] hashes[i][directory['hashes']] = path paths[i][directory['paths']] = path @@ -362,7 +362,7 @@ def sync(): 'unique directory': [], 'unique file': [] } - for path in sorted(directories[0].keys()): + for path in sorted(directories[0]): directory = directories[0][path] file_hashes = [ directory['hashes'].split('\n'), @@ -421,7 +421,7 @@ def sync(): sync['unique directory'].append([directory['files'], None]) for hash in file_hashes: del file_path_by_hash[0][hash] - for path in sorted(directories[1].keys()): + for path in sorted(directories[1]): directory = directories[1][path] file_hashes = directory['hashes'].split('\n') if len(