Commit 74133769 authored by Laurent Bachelier's avatar Laurent Bachelier 🐧 Committed by ntome

config: Force everything to be an iterator

So this is Python 3 behavior in Python 2 but no change for Python 3.

This class is not really useful if you're asking .items()
expecting a list like Python 2 does.

As a bonus it doesn't make pyflakes.sh panic.
parent 6afe5de2
Pipeline #2200 created with stages
......@@ -24,7 +24,6 @@ import tempfile
from collections import Mapping, MutableMapping
import yaml
from six import PY2
from weboob.tools.compat import unicode
......@@ -76,14 +75,8 @@ class VirtualDict(MutableMapping):
for key in self.config.keys(self.base):
yield key
def iteritems(self):
return self.config.items(self.base)
def items(self):
if PY2:
return list(self.iteritems())
else:
return self.iteritems()
return self.config.items(self.base)
def __len__(self):
return self.config.count(self.base)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment