Current File : //usr/lib/python2.7/site-packages/kitchen/pycompat25/collections/_defaultdict.pyo |
�
i�:Oc @ sB d Z d d l Z d d l m Z d e f d � � YZ d Z d S( s
-----------
defaultdict
-----------
This is a pure python implementation of defaultdict that is compatible with
the defaultdict class provided by python-2.5 and above.
.. seealso::
:class:`collections.defaultdict`
for documentation on this module
i����N( t b_t defaultdictc B sS e Z d d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z
RS( c O sQ | d k r1 t | d � r1 t t d � � � n t j | | | � | | _ d S( Nt __call__s First argument must be callable( t Nonet hasattrt TypeErrorR t dictt __init__t default_factory( t selfR t argst kwargs( ( sO /usr/lib/python2.7/site-packages/kitchen/pycompat25/collections/_defaultdict.pyR Z s
c C s6 y t j | | � SWn t k
r1 | j | � SXd S( N( R t __getitem__t KeyErrort __missing__( R t key( ( sO /usr/lib/python2.7/site-packages/kitchen/pycompat25/collections/_defaultdict.pyR a s
c C s6 | j d k r t | � � n | j � | | <} | S( N( R R R
( R R t value( ( sO /usr/lib/python2.7/site-packages/kitchen/pycompat25/collections/_defaultdict.pyR g s c C sF | j d k r t � } n | j f } t | � | d d | j � f S( N( R R t tuplet typet iteritems( R R
( ( sO /usr/lib/python2.7/site-packages/kitchen/pycompat25/collections/_defaultdict.pyt
__reduce__m s c C s
| j � S( N( t __copy__( R ( ( sO /usr/lib/python2.7/site-packages/kitchen/pycompat25/collections/_defaultdict.pyt copyt s c C s t | � | j | � S( N( R R ( R ( ( sO /usr/lib/python2.7/site-packages/kitchen/pycompat25/collections/_defaultdict.pyR w s c C s1 d d l } t | � | j | j | j � � � S( Ni����( R R R t deepcopyt items( R t memoR ( ( sO /usr/lib/python2.7/site-packages/kitchen/pycompat25/collections/_defaultdict.pyt __deepcopy__z s c C sk t | j t j � rE | j j d k rE t | j j t � rE d } n t | j � } d | t
j | � f S( Ns- <bound method sub._factory of defaultdict(...s defaultdict(%s, %s)( t
isinstanceR t typest
MethodTypet im_selfR t
issubclasst im_classR t reprR t __repr__( R t defrepr( ( sO /usr/lib/python2.7/site-packages/kitchen/pycompat25/collections/_defaultdict.pyR"