Variable "ret" referenced before assignment

Variable defined in sub-scope ("for", "if") are not defined above.

* tiramisu/option.py (Multi.append): Define "ret" to None.

* tiramisu/option.py (Multi._setvalue): Ditoo.

* tiramisu/option.py (Multi.pop): Ditoo.
This commit is contained in:
Daniel Dehennin 2013-01-29 15:21:31 +01:00
parent e2a02c5b7a
commit f267073e0d

View file

@ -84,6 +84,7 @@ class Multi(list):
except TypeError:
return self._setvalue(value, who=settings.get_owner())
multis = []
ret = None
for name, multi in self.config:
multis.append(multi)
for multi in multis:
@ -106,6 +107,7 @@ class Multi(list):
raise ConfigError("invalid value {0} "
"for option {1}".format(str(value), self.opt._name))
oldvalue = list(self)
ret = None
if key is None:
ret = super(Multi, self).append(value)
else:
@ -131,6 +133,7 @@ class Multi(list):
return self._pop(key)
multis = []
ret = None
for name, multi in self.config:
multis.append(multi)
for multi in multis: