Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/kitchen/collections/ |
| [Home] [System Details] [Kill Me] |
�
i�:Oc@s^dZyddlmZWn!ek
r=ddlmZnXdefd��YZdZdS(s�
----------
StrictDict
----------
:class:`kitchen.collections.StrictDict` provides a dictionary that treats
:class:`str` and :class:`unicode` as distinct key values.
i����(tdefaultdictt
StrictDictcBsJeZdZd�Zd�Zd�Zd�ZeZd�Zd�Z RS(sQ
Map class that considers :class:`unicode` and :class:`str` different
keys
Ordinarily when you are dealing with a :class:`dict` keyed on strings
you
want to have keys that have the same characters end up in the same
bucket
even if one key is :class:`unicode` and the other is a byte
:class:`str`.
The normal :class:`dict` type does this for :term:`ASCII` characters
(but
not for anything outside of the :term:`ASCII` range.)
Sometimes, however, you want to keep the two string classes strictly
separate, for instance, if you're creating a single table that can
map
from :class:`unicode` characters to :class:`str` characters and vice
versa. This class will help you do that by making all :class:`unicode`
keys evaluate to a different key than all :class:`str` keys.
.. seealso::
:class:`dict`
for documentation on this class's methods. This class
implements
all the standard :class:`dict` methods. Its treatment of
:class:`unicode` and :class:`str` keys as separate is the only
difference.
cCstj|t|�|f�S(N(Rt__getitem__trepr(tselftkey((sB/usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyRBscCs#tj|t|�|f|�dS(N(Rt__setitem__R(RRtvalue((sB/usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyREscCs
tj|t|�|f�dS(N(Rt__delitem__R(RR((sB/usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyRHsccs'x
tj|�D]}|dVqWdS(Ni(Rt__iter__(Rti((sB/usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyR KscCst|j��S(N(tlistR (R((sB/usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pytkeysQscCstj|t|�|f�S(N(Rt__contains__R(RR((sB/usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyR
Ts(
t__name__t
__module__t__doc__RRRR titerkeysRR
(((sB/usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyR)s N(R(RtcollectionsRtImportErrortkitchen.pycompat25.collectionsRt__all__(((sB/usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyt<module>s
.