[PATCH 2/3 v2] Define the _device, _label and _options attributes in constructor

Vratislav Podzimek vpodzime at redhat.com
Fri Jan 23 08:34:22 UTC 2015


That's how good guys do it.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 blivet/formats/__init__.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py
index 907eb20..5e97620 100644
--- a/blivet/formats/__init__.py
+++ b/blivet/formats/__init__.py
@@ -179,6 +179,10 @@ class DeviceFormat(ObjectID):
                 it via the 'device' kwarg to the :meth:`create` method.
         """
         ObjectID.__init__(self)
+        self._label = None
+        self._options = None
+        self._device = None
+
         self.device = kwargs.get("device")
         self.uuid = kwargs.get("uuid")
         self.exists = kwargs.get("exists", False)
@@ -271,7 +275,7 @@ class DeviceFormat(ObjectID):
 
            This method is not intended to be overridden.
         """
-        self._label = label # pylint: disable=attribute-defined-outside-init
+        self._label = label
 
     def _getLabel(self):
         """The label for this filesystem.
@@ -284,7 +288,7 @@ class DeviceFormat(ObjectID):
         return self._label
 
     def _setOptions(self, options):
-        self._options = options # pylint: disable=attribute-defined-outside-init
+        self._options = options
 
     def _getOptions(self):
         return self._options
@@ -294,7 +298,7 @@ class DeviceFormat(ObjectID):
     def _setDevice(self, devspec):
         if devspec and not devspec.startswith("/"):
             raise ValueError("device must be a fully qualified path")
-        self._device = devspec # pylint: disable=attribute-defined-outside-init
+        self._device = devspec
 
     def _getDevice(self):
         return self._device
-- 
2.1.0



More information about the anaconda-patches mailing list