no need for .keys() when iterating

This commit is contained in:
rolux 2012-09-12 13:41:56 +02:00
parent 753ae2e6af
commit 2389e76659
1 changed files with 6 additions and 6 deletions

View File

@ -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(