Commits

Michał Górny committed 8bec0a9

PackageFiles API: iterate over values instead of keys.

  • Participants
  • Parent commits 3cd2513

Comments (0)

Files changed (2)

File lib/flaggie/cli.py

 			print('Warning: %s' % e)
 
 	if sort_flags:
-		for f in pfiles.values():
+		for f in pfiles:
 			for pe in f:
 				pe.sort()
 	if sort_entries:
-		for f in pfiles.values():
+		for f in pfiles:
 			f.sort()
 
 	pfiles.write()

File lib/flaggie/packagefile.py

 				f.remove(e)
 			f.modified = True
 
-class PackageFiles(dict):
+class PackageFiles(object):
 	def __init__(self):
-		dict.__init__(self, {
+		self.files = {
 			'use': PackageFileSet('/etc/portage/package.use'),
 			'kw': PackageFileSet('/etc/portage/package.keywords'),
 			'lic': PackageFileSet('/etc/portage/package.license')
-		})
+		}
+
+	def __getitem__(self, k):
+		return self.files[k]
+
+	def __iter__(self):
+		return iter(self.files.values())
 
 	def write(self):
-		for f in self.values():
+		for f in self:
 			f.write()