ó
Ò:\c           @  s  d  Z  d d l m Z d d l Z d d l Z d d l Z e j d d k Z e j d d k Z e r e	 e
 f Z e e f Z n e	 f Z e f Z e e e ƒ e e g ƒ Z e r¤d d l Z d d l Z y d d l Z Wn e k
 rð n Xd d l m Z y d d l Z Wn e k
 r0d d l Z n Xy d d l  Z! Wn e k
 r`d d l! Z! n Xd d l" m# Z$ d d l% Z& d d l' Z( d d l) Z) e) Z* e) Z+ n¢ d d l Z d d l Z y d d l Z Wn e k
 rßn Xd d	 l m Z d d l Z d d l! Z! d d
 l, m$ Z$ d d l& Z& d d l( Z( d d l) m* Z* m+ Z+ d „  Z- d „  Z. d „  Z/ d „  Z0 d d „ Z2 d d „ Z3 e r d d l4 Z4 d „  Z5 n	 d „  Z5 d „  Z6 d „  Z7 d „  Z8 d „  Z9 d „  Z: d „  Z; e r"e< Z= e j> Z? e@ Z@ d d lA ZA eA jB ZC d d lD mE ZF n1 e= Z= e j? Z? d „  Z@ e	 jB ZC d d lD mF ZF d „  ZG e r¶d „  ZH d „  ZI d  „  ZJ d! „  ZK e jL d" ƒ ZM e jL d# ƒ ZN e jL d$ ƒ ZO nQ d% „  ZH d& „  ZI d' „  ZJ d( „  ZK e jL d) ƒ ZM e jL d* ƒ ZN e jL d+ ƒ ZO d S(,   s    
Transitional module providing compatibility functions between python 2 and 3.

This module should be fully compatible with:
    * Python >=v2.7
    * Python 3
iÿÿÿÿ(   t   print_functionNi    t   2t   3(   t   maxint(   t	   DictMixin(   t   maxsize(   t   MutableMapping(   t   requestt   parsec         C  s$   t  r t |  t ƒ St |  t ƒ Sd S(   sŽ   
    Return True if `obj` is a text string, False if it is anything else.

    Binary data (Python 3) or QString (Python 2, PyQt API #1).
    N(   t   PY2t
   isinstancet
   basestringt   str(   t   obj(    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   is_text_stringZ   s    c         C  s$   t  r t |  t ƒ St |  t ƒ Sd S(   sD   Return True if obj is a binary string, False if it is anything else.N(   R	   R
   R   t   bytes(   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   is_binary_stringh   s    c         C  s   t  |  ƒ p t |  ƒ S(   s³   
    Check if object is a string.

    Return True if `obj` is a text or binary Python string object False if it
    is anything else, like a QString (Python 2, PyQt API #1).
    (   R   R   (   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt	   is_stringr   s    c         C  s$   t  r t |  t ƒ St |  t ƒ Sd S(   s    Return True if `obj` is unicode.N(   R	   R
   t   unicodeR   (   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt
   is_unicode|   s    c         C  sf   t  r, | d k r t |  ƒ St |  | ƒ Sn6 | d k rB t |  ƒ St |  t ƒ rU |  St |  | ƒ Sd S(   s'   Convert `obj` to (unicode) text string.N(   R	   t   NoneR   R   R
   (   R   t   encoding(    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   to_text_string†   s    

c         C  sO   t  r, | d k r t |  ƒ S|  j | ƒ Sn t |  | d k rD d n | ƒ Sd S(   sD   Convert `obj` to binary string (bytes in Python 3, str in Python 2).s   utf-8N(   R	   R   R   t   encodeR   (   R   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   to_binary_string™   s
    
c         C  s   t  j |  ƒ d S(   s   Make unicode object.i    (   t   codecst   unicode_escape_decode(   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   uª   s    c         C  s   |  S(   s   Return string as it is.(    (   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyR   ¯   s    c         C  s   t  r |  j S|  j Sd S(   s   Return function code object.N(   R	   t	   func_codet   __code__(   t   func(    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   get_func_code·   s    c         C  s   t  r |  j S|  j Sd S(   s   Return function name.N(   R	   t	   func_namet   __name__(   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   get_func_nameÁ   s    c         C  s   t  r |  j S|  j Sd S(   s(   Return function default argument values.N(   R	   t   func_defaultst   __defaults__(   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   get_func_defaultsË   s    c         C  s   t  r |  j S|  j Sd S(   s   Return method function object.N(   R	   t   im_funct   __func__(   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   get_meth_funcØ   s    c         C  s   t  r |  j S|  j Sd S(   s   Return method class instance.N(   R	   t   im_selft   __self__(   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   get_meth_class_instâ   s    c         C  s   t  r |  j S|  j j Sd S(   s   Return method class.N(   R	   t   im_classR*   t	   __class__(   R   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   get_meth_classì   s    (   t   izip_longestc         C  s   |  | k |  | k  S(   s6   Return negative if a<b, zero if a==b, positive if a>b.(    (   t   at   b(    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   cmp  s    (   t   zip_longestc         C  s"   t  t |  j ƒ  j ƒ  ƒ j ƒ  ƒ S(   sE   Convert QByteArray object to str in a way compatible with Python 2/3.(   R   R   t   toHext   datat   decode(   t   qba(    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   qbytearray_to_str  s    c         K  s   t  |  j |   ƒ S(   s.   Return an iterator over the dictionary's keys.(   t   itert   keys(   t   dt   kw(    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   iterkeys  s    c         K  s   t  |  j |   ƒ S(   s0   Return an iterator over the dictionary's values.(   R9   t   values(   R;   R<   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt
   itervalues  s    c         K  s   t  |  j |   ƒ S(   s/   Return an iterator over the dictionary's items.(   R9   t   items(   R;   R<   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt	   iteritems   s    c         K  s   t  |  j |   ƒ S(   s+   Return an iterator over a multi dictionary.(   R9   t   lists(   R;   R<   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt	   iterlists$  s    R:   R>   R@   c         K  s   |  j  |   S(   s.   Return an iterator over the dictionary's keys.(   R=   (   R;   R<   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyR=   /  s    c         K  s   |  j  |   S(   s0   Return an iterator over the dictionary's values.(   R?   (   R;   R<   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyR?   3  s    c         K  s   |  j  |   S(   s/   Return an iterator over the dictionary's items.(   RA   (   R;   R<   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyRA   7  s    c         K  s   |  j  |   S(   s+   Return an iterator over a multi dictionary.(   RC   (   R;   R<   (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyRC   ;  s    t   viewkeyst
   viewvaluest	   viewitems(P   t   __doc__t
   __future__R    t   operatort   ost   syst   versionR	   t   PY3R   R   t
   TEXT_TYPESt   intt   longt	   INT_TYPESt   tuplet   listt   floatt   complext   NUMERIC_TYPESt   __builtin__t   builtinst   ConfigParsert   configparsert   _winregt   winregt   ImportErrorR   R   t	   CStringIOt   iot   StringIOt   cPicklet   picklet   UserDictR   R   t   threadt   _threadt   reprt   reprlibt   urllibR   R   t   collectionsR   R   R   R   R   R   R   R   R   R   R"   R%   R(   R+   R.   t	   raw_inputt   inputt   getcwdut   getcwdR2   t   stringt   lowert	   str_lowert	   itertoolsR/   R3   R8   R=   R?   RA   RC   t   methodcallerRD   RE   RF   (    (    (    sA   lib/python2.7/site-packages/anaconda_navigator/utils/py3compat.pyt   <module>   s¶   					
	
	
		
	
		
	
															