ó
MšV]c           @   s1  d  Z  d d l Z d d l Z e e e j d ƒ e e j d ƒ ƒ Z y
 e Z Wn e k
 rk e Z n Xe j	 ƒ  d k Z
 d „  Z y% e j j Z e d k r« d Z n  Wn e k
 rÅ d Z n Xd	 „  Z y
 e Z Wn e k
 rò e Z n Xd
 „  Z y d d l m Z Wn e k
 r,d „  Z n Xd S(   sˆ   
To ensure compatibility from Python ``2.6`` - ``3.3``, a module has been
created. Clearly there is huge need to use conforming syntax.
iÿÿÿÿNi    i   t   PyPyc         G   s"   | s t  f } n  |  d | i  ƒ S(   s"    Create a class with a metaclass. t	   HackClass(   t   object(   t   metat   bases(    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyt   use_metaclass   s    s   utf-8t   asciic         C   s<   t  d k r t |  ƒ St |  t ƒ s8 t t |  ƒ d ƒ S|  S(   sí   Cast to unicode DAMMIT!
    Written because Python2 repr always implicitly casts to a string, so we
    have to cast back to a unicode (and we know that we always deal with valid
    unicode, because we check that in the beginning).
    i   s   UTF-8(   t
   py_versiont   strt
   isinstancet   unicode(   t   string(    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyt   u$   s
    
c            s'   ‡  f d †  } t  d k r ˆ  S| Sd S(   s   
    ``__repr__`` methods in Python 2 don't allow unicode objects to be
    returned. Therefore cast them to utf-8 bytes in this decorator.
    c            s0   ˆ  |  ƒ } t  | t ƒ r( | j d ƒ S| Sd  S(   Ns   utf-8(   R	   R
   t   encode(   t   selft   result(   t   func(    s3   lib/python2.7/site-packages/parso/_compatibility.pyt   wrapper=   s    i   N(   R   (   R   R   (    (   R   s3   lib/python2.7/site-packages/parso/_compatibility.pyt	   utf8_repr8   s    (   t   total_orderingc         C   sK  i d d „  f d d „  f d d „  f g d 6d d „  f d d	 „  f d d
 „  f g d 6d d „  f d d „  f d d „  f g d 6d d „  f d d „  f d d „  f g d 6} t  t |  ƒ ƒ t  | ƒ @} | sã t d ƒ ‚ n  t | ƒ } xU | | D]I \ } } | | k rú | | _ t t | ƒ j | _ t |  | | ƒ qú qú W|  S(   s6   Class decorator that fills in missing ordering methodst   __gt__c         S   s   |  | k  p |  | k S(   N(    (   R   t   other(    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyt   <lambda>Q   t    t   __le__c         S   s   |  | k  p |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   R   R   t   __ge__c         S   s   |  | k  S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   S   R   t   __lt__c         S   s   |  | k p |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   T   R   c         S   s   |  | k o |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   U   R   c         S   s   |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   V   R   c         S   s   |  | k p |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   W   R   c         S   s   |  | k p |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   X   R   c         S   s   |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   Y   R   c         S   s   |  | k p |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   Z   R   c         S   s   |  | k o |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   [   R   c         S   s   |  | k S(   N(    (   R   R   (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   \   R   s6   must define at least one ordering operation: < > <= >=(	   t   sett   dirt
   ValueErrort   maxt   __name__t   getattrt   intt   __doc__t   setattr(   t   clst   convertt   rootst   roott   opnamet   opfunc(    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyR   N   s.    	(   R"   t   syst   platformR!   R   t   version_infoR   R
   t	   NameErrort   python_implementationt   is_pypyR   t   stdoutt   encodingt   Nonet   AttributeErrorR   t   FileNotFoundErrort   IOErrorR   t	   functoolsR   t   ImportError(    (    (    s3   lib/python2.7/site-packages/parso/_compatibility.pyt   <module>   s2   *

	
	

	