[master/jenkins-fix][PATCH] Make pylint happy about the idx variable
Vratislav Podzimek
vpodzime at redhat.com
Mon Apr 14 16:06:50 UTC 2014
On Mon, 2014-04-14 at 11:34 -0400, David Shea wrote:
> On 04/14/2014 11:12 AM, Vratislav Podzimek wrote:
> > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > ---
> > pyanaconda/ui/gui/spokes/custom.py | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
> > index 65e36a2..644e51c 100644
> > --- a/pyanaconda/ui/gui/spokes/custom.py
> > +++ b/pyanaconda/ui/gui/spokes/custom.py
> > @@ -1947,6 +1947,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
> > found = None
> >
> > # TODO: implement and use function for finding item in combobox
> > + idx = None
> > for idx, data in enumerate(self._containerStore):
> > # we're looking for the original vg name
> > if data[0] == container_name:
> > @@ -1956,6 +1957,11 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
> > self._update_selectors()
> > return
> >
> > + if not idx:
> > + # nothing in the store, just update selectors and return
> > + self._update_selectors()
> > + return
> > +
> > c = self._storage_playground.devicetree.getDeviceByName(self._device_container_name)
> > freeSpace = getattr(c, "freeSpace", None)
> >
>
> Whoops, I already pushed a disable pragma for this. This patch is fine,
> but you can dump the else: branch of the for loop if using this.
Good point. I wanted to demonstrate the change that is needed due to
pylint's check to decide if we want to change the code or pylint
false-positives. We know that the store cannot be empty, that would be a
big issue for us, so the idx variable will always be initialized.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list