ó
%_[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 j	 d 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
 rFd d l! Z  n Xy d d l" Z# Wn e k
 rv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 „  Z0 d „  Z1 d „  Z2 d d „ Z4 d d „ Z5 e r¶d d l6 Z6 d „  Z7 n	 d „  Z7 d „  Z8 d „  Z9 d „  Z: d „  Z; d „  Z< d „  Z= e r8e> Z? e j@ ZA eB ZB d d lC ZC eC jD ZE d d lF mG ZH n1 e? Z? e jA ZA d „  ZB e jD ZE d d lF mH ZH d „  ZI e rÌd  „  ZJ d! „  ZK d" „  ZL d# „  ZM e jN d$ ƒ ZO e jN d% ƒ ZP e jN d& ƒ ZQ nQ d' „  ZJ d( „  ZK d) „  ZL d* „  ZM e jN d+ ƒ ZO e jN d, ƒ ZP e jN d- ƒ ZQ 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   3i   i   (   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(    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyt   is_text_stringV   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   (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyt   is_binary_stringd   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   (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyt	   is_stringn   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   (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyt
   is_unicodex   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(    (    s@   lib/python2.7/site-packages/navigator_updater/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   (    (    s@   lib/python2.7/site-packages/navigator_updater/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   (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyt   u¦   s    c         C  s   |  S(   s   Return string as it is.(    (   R   (    (    s@   lib/python2.7/site-packages/navigator_updater/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(    (    s@   lib/python2.7/site-packages/navigator_updater/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   (    (    s@   lib/python2.7/site-packages/navigator_updater/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   (    (    s@   lib/python2.7/site-packages/navigator_updater/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   (    (    s@   lib/python2.7/site-packages/navigator_updater/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   (    (    s@   lib/python2.7/site-packages/navigator_updater/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   (    (    s@   lib/python2.7/site-packages/navigator_updater/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(    (    s@   lib/python2.7/site-packages/navigator_updater/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(    (    s@   lib/python2.7/site-packages/navigator_updater/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(    (    s@   lib/python2.7/site-packages/navigator_updater/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<   (    (    s@   lib/python2.7/site-packages/navigator_updater/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<   (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyt	   iteritems  s    c         K  s   t  |  j |   ƒ S(   s+   Return an iterator over a multi dictionary.(   R9   t   lists(   R;   R<   (    (    s@   lib/python2.7/site-packages/navigator_updater/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<   (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyR=   +  s    c         K  s   |  j  |   S(   s0   Return an iterator over the dictionary's values.(   R?   (   R;   R<   (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyR?   /  s    c         K  s   |  j  |   S(   s/   Return an iterator over the dictionary's items.(   RA   (   R;   R<   (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyRA   3  s    c         K  s   |  j  |   S(   s+   Return an iterator over a multi dictionary.(   RC   (   R;   R<   (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyRC   7  s    t   viewkeyst
   viewvaluest	   viewitems(   i   i   (R   t   __doc__t
   __future__R    t   operatort   ost   syst   versionR	   t   PY3t   version_infot   PY33R   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   (    (    (    s@   lib/python2.7/site-packages/navigator_updater/utils/py3compat.pyt   <module>   s¸   					
	
	
		
	
		
	
															