mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
Start replacing UserDict.DictMixin with collections.MutableMapping (the bsddb modules are next).
This commit is contained in:
parent
15ebc88d87
commit
b9da9bc0a0
4 changed files with 19 additions and 7 deletions
|
@ -59,12 +59,12 @@ the persistent dictionary on disk, if feasible).
|
|||
from pickle import Pickler, Unpickler
|
||||
from io import BytesIO
|
||||
|
||||
import UserDict
|
||||
import collections
|
||||
import warnings
|
||||
|
||||
__all__ = ["Shelf","BsdDbShelf","DbfilenameShelf","open"]
|
||||
|
||||
class Shelf(UserDict.DictMixin):
|
||||
class Shelf(collections.MutableMapping):
|
||||
"""Base class for shelf implementations.
|
||||
|
||||
This is initialized with a dictionary-like object.
|
||||
|
@ -81,7 +81,7 @@ class Shelf(UserDict.DictMixin):
|
|||
self.cache = {}
|
||||
self.keyencoding = "utf-8"
|
||||
|
||||
def keys(self):
|
||||
def __iter__(self):
|
||||
for k in self.dict.keys():
|
||||
yield k.decode(self.keyencoding)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue