ó
:>"^c           @   sÞ  d  Z  d d l Z e j d d k r=d d l m Z m Z m Z m Z m Z m	 Z	 d d l
 Z
 e Z e Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z e Z d „  Z d d l Z d d l Z d „  Z d Z d d l m Z d d l m Z m Z m Z m Z m Z d d l  m! Z! m" Z" d d l# m$ Z$ m% Z% d d UnLd d l& m Z m Z m Z d d l' m Z m Z m Z d d l& m( Z d d l& m) Z	 d „  Z d „  Z d „  Z d „  Z d „  Z e Z d „  Z d „  Z d Z y d d l* m Z Wn! e+ k
 rd d l m Z n Xd d l, m Z m Z d d  l- m Z m Z d d! l m Z d d l- m! Z! m" Z" d d l, m$ Z$ m% Z% d" „  Z. e j/ d# k r¤d$ „  Z0 n6 e j d d k rÊd d% l1 m0 Z0 n d d% l2 m0 Z0 d S(&   sH  Python 3 compatibility tools (PRIVATE).

We used to have lines like this under Python 2 in order to use
iterator based zip, map and filter (in Python 3 these functions
are all iterator based)::

    from future_builtins import zip

There is no similar option for range yet, other than::

    range = xrange
    input = raw_input

or:

    from __builtin__ import xrange as range
    from __builtin__ import raw_input as input

Under Python 3 these imports need to be removed. Also, deliberate
importing of built in functions like open changes from Python 2::

    from __builtin__ import open

To do this under Python 3:

    from builtins import open

Instead, we can do this under either Python 2 or 3:

    from Bio._py3k import open
    from Bio._py3k import zip

Once we drop support for Python 2, the whole of Bio._py3k will
go away.
iÿÿÿÿNi    i   (   t   opent   zipt   mapt   filtert   ranget   inputc         C   s
   |  j  ƒ  S(   N(   t   decode(   t   b(    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyt   <lambda>=   s    c         C   s
   |  j  ƒ  S(   N(   t   encode(   t   s(    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyR   >   s    c         C   s#   t  |  t t f ƒ r |  j ƒ  S|  S(   sB   If s is bytes or bytearray, convert to a unicode string (PRIVATE).(   t
   isinstancet   bytest	   bytearrayR   (   R
   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyt   _bytes_bytearray_to_str@   s    
c         C   s$   t  |  t ƒ r |  St j |  ƒ d S(   sC   Turn byte string or unicode string into a unicode string (PRIVATE).i    (   R   t   strt   codecst   latin_1_decode(   R
   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyt   _as_unicodeF   s    c         C   s$   t  |  t ƒ r |  St j |  ƒ d S(   s   Turn byte string or unicode string into a bytes string (PRIVATE).

        The Python 2 version returns a (byte) string.
        i    (   R   R   R   t   latin_1_encode(   R
   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyt	   _as_bytesN   s    c         C   s   t  |  t ƒ S(   sb   Check if the value is an integer (PRIVATE).

        Note there are no longs on Python 3.
        (   R   t   int(   t   i(    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyt   _is_int_or_long[   s    c         C   sˆ   y |  j  j ƒ  } Wn t k
 r, d } n X| d k rB d } n  t j t j |  ƒ d | ƒ} y |  j | _ Wn t k
 rƒ n X| S(   sE   Treat a binary (bytes) handle like a text (unicode) handle (PRIVATE).s   latin-1t   encodingN(   t   headerst   get_content_charsett   AttributeErrort   Nonet   iot   TextIOWrappert   BufferedReadert   url(   t   handleR   t   wrapped(    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyt   _binary_to_string_handlef   s    
	t   r(   t   StringIO(   t   urlopent   Requestt   urlretrievet   urlparset
   urlcleanup(   t	   urlencodet   quote(   t   URLErrort	   HTTPErrorsr   def raise_from(value, from_value):
    try:
        raise value from from_value
    finally:
        value = None
(   R    t
   basestringt   unicode(   R   R   R   (   t   xrange(   t	   raw_inputc         C   s   |  S(   N(    (   R   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyR   ›   s    c         C   s
   t  |  ƒ S(   N(   R   (   R
   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyR   œ   s    c         C   s#   t  |  t t f ƒ r t |  ƒ S|  S(   s:   If s is bytes or bytearray, convert to a string (PRIVATE).(   R   R   R   R   (   R
   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyR   ž   s    
c         C   s   t  |  t ƒ r |  S|  j ƒ  S(   s?   If s is a (byte) string, convert to a unicode string (PRIVATE).(   R   R0   R   (   R
   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyR   ¤   s    c         C   s
   t  |  ƒ S(   sH   Turn a (byte) string or a unicode string into a (byte) string (PRIVATE).(   R   (   R
   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyR   ª   s    c         C   s   t  |  t t f ƒ S(   s3   Check if the value is an integer or long (PRIVATE).(   R   R   t   long(   R   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyR   °   s    c         C   s   |  S(   s3   Treat a binary handle like a text handle (PRIVATE).(    (   R!   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyR#   ´   s    t   rU(   R&   R'   (   R(   R*   (   R)   c         C   s
   |  ‚ d  S(   N(    (   t   valuet
   from_value(    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyt
   raise_fromÏ   s    t   win32c         C   sa   d d  l  } | j |  d | j d | j d | j d t d t ƒ} | j ƒ  \ } } | j d ƒ S(   Niÿÿÿÿt   stdint   stdoutt   stderrt   universal_newlinest   shells   
(   t
   subprocesst   Popent   PIPEt   STDOUTt   Truet   Falset   communicatet   rstrip(   t   cmdR>   t   childR:   R;   (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyt	   getoutputØ   s    				(   RH   (3   t   __doc__t   syst   version_infot   builtinsR    R   R   R   R   R   R   R   R/   R0   t   _bytes_to_stringt   _string_to_bytesR   R   R   t
   _as_stringR   R   t   localeR#   t   _universal_read_modeR%   t   urllib.requestR&   R'   R(   R)   R*   t   urllib.parseR+   R,   t   urllib.errorR-   R.   t   __builtin__t   future_builtinsR1   R2   t	   cStringIOt   ImportErrort   urllib2t   urllibR7   t   platformRH   R>   t   commands(    (    (    sb   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.5/site-packages/Bio/_py3k/__init__.pyt   <module>)   sd   .							(								