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