Commits

Michał Górny committed 9093b55

Move mtime getting to Kernel object.

  • Participants
  • Parent commits 9b251ac

Comments (0)

Files changed (2)

File ecleankernel/kernel.py

 					getattr(self, k), PathRef):
 				yield k
 
+	@property
+	def mtime(self):
+		return os.path.getmtime(self.vmlinuz)
+
 	def unrefall(self):
 		del self.vmlinuz
 		del self.systemmap

File ecleankernel/process.py

 			used = frozenset(unprefixify(realpaths))
 
 		if limit is not None:
-			def getmtime(k):
-				return os.path.getmtime(k.vmlinuz)
-
-			ordered = sorted(kernels, key = getmtime, reverse = True)
+			ordered = sorted(kernels, key = lambda k: k.mtime, reverse = True)
 			candidates = ordered[limit:]
 		else:
 			candidates = kernels