storage/reflink: make revisions() more readable, use iglob

This commit is contained in:
Rusty Bird 2018-09-09 20:01:14 +00:00
parent 18f9356c2c
commit ef2698adb4
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF

View File

@ -297,10 +297,10 @@ class ReflinkVolume(qubes.storage.Volume):
@property
def revisions(self):
prefix = self._path_clean + '.'
paths = glob.glob(glob.escape(prefix) + '*@*Z')
items = sorted((path[len(prefix):-1].split('@') for path in paths),
key=lambda item: int(item[0]))
return collections.OrderedDict(items)
paths = glob.iglob(glob.escape(prefix) + '*@*Z')
items = (path[len(prefix):-1].split('@') for path in paths)
return collections.OrderedDict(sorted(items,
key=lambda item: int(item[0])))
@property
def usage(self):