³ò
3ÒÇIc        
   @   s¥   d  Z  y d d k l Z Wn# e j
 o d d k l Z n Xy d d k l Z Wn> e j
 o2 d e f d „  ƒ  YZ d d k Z e e _ n Xd d g Z d S(   s%  
Backwards compatibility with previous versions of Python.

This module provides backwards compatibility by defining
functions and classes that were not available in earlier versions of
Python.  Intented usage:

    >>> from nltk.compat import *

Currently, NLTK requires Python 2.4 or later.
iÿÿÿÿ(   t   ElementTree(   t   defaultdictR   c           B   sS   e  Z e d  „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(   c         O   sN   | d  j	 o! t | d ƒ o t d ƒ ‚ n t i |  | | Ž | |  _ d  S(   Nt   __call__s   first argument must be callable(   t   Nonet   hasattrt	   TypeErrort   dictt   __init__t   default_factory(   t   selfR   t   at   kw(    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pyR   (   s
    c         C   s;   y t  i |  | ƒ SWn  t j
 o |  i | ƒ Sn Xd  S(   N(   R   t   __getitem__t   KeyErrort   __missing__(   R	   t   key(    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pyR   .   s    c         C   s8   |  i  d  j o t | ƒ ‚ n |  i  ƒ  |  | <} | S(   N(   R   R   R   (   R	   R   t   value(    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pyR   3   s    c         C   sH   |  i  d  j o t ƒ  } n |  i  f } t |  ƒ | d  d  |  i ƒ  f S(   N(   R   R   t   tuplet   typet	   iteritems(   R	   t   args(    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pyt
   __reduce__8   s    c         C   s
   |  i  ƒ  S(   N(   t   __copy__(   R	   (    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pyt   copy>   s    c         C   s   t  |  ƒ |  i |  ƒ S(   N(   R   R   (   R	   (    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pyR   @   s    c         C   s1   d d  k  } t |  ƒ |  i | i |  i ƒ  ƒ ƒ S(   Niÿÿÿÿ(   R   R   R   t   deepcopyt   items(   R	   t   memoR   (    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pyt   __deepcopy__B   s    c         C   s   d |  i  t i |  ƒ f S(   Ns   defaultdict(%s, %s)(   R   R   t   __repr__(   R	   (    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pyR   F   s    	(   t   __name__t
   __module__R   R   R   R   R   R   R   R   R   (    (    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pyR   '   s   						NR    (	   t   __doc__t	   xml.etreeR    t   ImportErrort
   nltk.etreet   collectionsR   R   t   __all__(    (    (    s!   /p/zhu/06/nlp/nltk/nltk/compat.pys   <module>   s   $