[blivet:master 03/11] Simplify _getSize() and currentSize().

mulhern amulhern at redhat.com
Tue Nov 25 23:22:39 UTC 2014


In _getSize():
Remove pointless boolean expression. Only returning self.targetSize if it
does not equal self._size is kind of pointless, because if they are equal
then it is just as good to return the value of one as the other.

Make currentSize() look more like _getSize() so they're easier to compare.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/fs.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 746221f..b154f7d 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -218,10 +218,7 @@ class FS(DeviceFormat):
 
     def _getSize(self):
         """ Get this filesystem's size. """
-        size = self._size
-        if self.resizable and self.targetSize != size:
-            size = self.targetSize
-        return size
+        return self.targetSize if self.resizable else self._size
 
     size = property(_getSize, doc="This filesystem's size, accounting "
                                   "for pending changes")
@@ -359,10 +356,7 @@ class FS(DeviceFormat):
     @property
     def currentSize(self):
         """ The filesystem's current actual size. """
-        size = Size(0)
-        if self.exists:
-            size = self._size
-        return size
+        return self._size if self.exists else Size(0)
 
     @property
     def free(self):
-- 
1.9.3



More information about the anaconda-patches mailing list