ok
Direktori : /lib/python2.7/site-packages/kitchen/collections/ |
Current File : //lib/python2.7/site-packages/kitchen/collections/strictdict.pyo |
� i�:Oc @ s^ d Z y d d l m Z Wn! e k r= d d l m Z n Xd e f d � � YZ d Z d S( s� ---------- StrictDict ---------- :class:`kitchen.collections.StrictDict` provides a dictionary that treats :class:`str` and :class:`unicode` as distinct key values. i����( t defaultdictt StrictDictc B sJ e Z d Z d � Z d � Z d � Z d � Z e Z d � Z d � 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. c C s t j | t | � | f � S( N( R t __getitem__t repr( t selft key( ( sB /usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyR B s c C s# t j | t | � | f | � d S( N( R t __setitem__R ( R R t value( ( sB /usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyR E s c C s t j | t | � | f � d S( N( R t __delitem__R ( R R ( ( sB /usr/lib/python2.7/site-packages/kitchen/collections/strictdict.pyR H s c c s'