
ݲk^c        
   @   s{  d  Z  d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m Z m Z d   Z	 d   Z
 e j d  Z d   Z d e d	 d
  d f d
 e d	 d  d f d
 e d	 d  d f d
 e d d
  d f d
 e d d  d f d e d d  d f d
 e d d  d f g Z g  e D]) Z e d e d
 e d
 e d f ^ q"Z g  e D] Z e d ^ qXZ d Z e j d e  Z e g  e e d   D]# \ Z Z Z e d e d f ^ q Z d   Z e Z d   Z d d e d  Z d d d   Z d!   Z d
 e  d"  Z! e d  Z" e d# d
  Z# d$ e f d%     YZ$ e$ d&  Z% e j& d e%  Z' e j( d  Z) d' e f d(     YZ* e*   Z+ d)   Z, e d
 d* d+ d  Z- e d
 d, d
 d
  Z. e d
 d- d
 d  Z/ e d
 d. d/ d
  Z0 e d
 d- d0 d  Z1 e0 Z2 d1 e f d2     YZ3 e3 d3 d4 d5 d6  Z4 e3 d7 d8 d9 d:  Z5 e3 d; d< d= d>  Z6 e3 d? d@ dA dB  Z7 d S(C   s  Python's :mod:`datetime` module provides some of the most complex
and powerful primitives in the Python standard library. Time is
nontrivial, but thankfully its support is first-class in
Python. ``dateutils`` provides some additional tools for working with
time.

Additionally, timeutils provides a few basic utilities for working
with timezones in Python. The Python :mod:`datetime` module's
documentation describes how to create a
:class:`~datetime.datetime`-compatible :class:`~datetime.tzinfo`
subtype. It even provides a few examples.

The following module defines usable forms of the timezones in those
docs, as well as a couple other useful ones, :data:`UTC` (aka GMT) and
:data:`LocalTZ` (representing the local timezone as configured in the
operating system). For timezones beyond these, as well as a higher
degree of accuracy in corner cases, check out `pytz`_ and `dateutil`_.

.. _pytz: https://pypi.python.org/pypi/pytz
.. _dateutil: https://dateutil.readthedocs.io/en/stable/index.html
iN(   t   tzinfot	   timedeltat   datet   datetimec         C   s3   d } |  j  |  j d } |  j | | } | | S(   sa  For those with older versions of Python, a pure-Python
    implementation of Python 2.7's :meth:`~datetime.timedelta.total_seconds`.

    Args:
        td (datetime.timedelta): The timedelta to convert to seconds.
    Returns:
        float: total number of seconds

    >>> td = timedelta(days=4, seconds=33)
    >>> total_seconds(td)
    345633.0
    g    .AiQ (   t   secondst   dayst   microseconds(   t   tdt   a_millit   td_dst   td_micro(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   total_seconds"   s    c         C   s*   |  j  r |  t } n
 |  t } t |  S(   s_  Converts from a :class:`~datetime.datetime` object to an integer
    timestamp, suitable interoperation with :func:`time.time` and
    other `Epoch-based timestamps`.

    .. _Epoch-based timestamps: https://en.wikipedia.org/wiki/Unix_time

    >>> abs(round(time.time() - dt_to_timestamp(datetime.utcnow()), 2))
    0.0

    ``dt_to_timestamp`` supports both timezone-aware and naïve
    :class:`~datetime.datetime` objects. Note that it assumes naïve
    datetime objects are implied UTC, such as those generated with
    :meth:`datetime.datetime.utcnow`. If your datetime objects are
    local time, such as those generated with
    :meth:`datetime.datetime.now`, first convert it using the
    :meth:`datetime.datetime.replace` method with ``tzinfo=``
    :class:`LocalTZ` object in this module, then pass the result of
    that to ``dt_to_timestamp``.
    (   R    t   EPOCH_AWAREt   EPOCH_NAIVER   (   t   dtR   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   dt_to_timestamp5   s    	
s   \Dc         C   s2   g  t  j |   D] } t |  ^ q } t |   S(   s  Parses the limited subset of `ISO8601-formatted time`_ strings as
    returned by :meth:`datetime.datetime.isoformat`.

    >>> epoch_dt = datetime.utcfromtimestamp(0)
    >>> iso_str = epoch_dt.isoformat()
    >>> print(iso_str)
    1970-01-01T00:00:00
    >>> isoparse(iso_str)
    datetime.datetime(1970, 1, 1, 0, 0)

    >>> utcnow = datetime.utcnow()
    >>> utcnow == isoparse(utcnow.isoformat())
    True

    For further datetime parsing, see the `iso8601`_ package for strict
    ISO parsing and `dateutil`_ package for loose parsing and more.

    .. _ISO8601-formatted time: https://en.wikipedia.org/wiki/ISO_8601
    .. _iso8601: https://pypi.python.org/pypi/iso8601
    .. _dateutil: https://pypi.python.org/pypi/python-dateutil

    (   t   _NONDIGIT_REt   splitt   intR   (   t   iso_strt   pt   dt_args(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   isoparseS   s    (i    R   i   t   secondi<   t   minutei  t   hourR   t   dayi   t   weeki   i   t   monthim  t   years*   [+-]?\ *(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?s!   ((?P<value>%s)\s*(?P<unit>\w)\w*)it   sc         C   s   i  } x t  j |   D] } | j d  | j d  } } y t | } Wn- t k
 rx t d | t j   f   n Xy t |  } Wn' t k
 r t d | | f   n X| | | <q Wt |   S(   s  Robustly parses a short text description of a time period into a
    :class:`datetime.timedelta`. Supports weeks, days, hours, minutes,
    and seconds, with or without decimal points:

    Args:
        text (str): Text to parse.
    Returns:
        datetime.timedelta
    Raises:
        ValueError: on parse failure.

    >>> parse_td('1d 2h 3.5m 0s') == timedelta(days=1, seconds=7410)
    True

    Also supports full words and whitespace.

    >>> parse_td('2 weeks 1 day') == timedelta(days=15)
    True

    Negative times are supported, too:

    >>> parse_td('-1.5 weeks 3m 20s') == timedelta(days=-11, seconds=43400)
    True
    t   valuet   units(   invalid time unit %r, expected one of %rs"   invalid time value for unit %r: %r(	   t   _PARSE_TD_REt   finditert   groupt   _PARSE_TD_KW_MAPt   KeyErrort
   ValueErrort   keyst   floatR   (   t   textt	   td_kwargst   matchR   R    t   unit_key(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   parse_timedelta~   s    c         C   s   | d k r |  S|  d S(   Ni   R   (    (   R    R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   _cardinalize_time_unit   s    c         C   s   | d k r t j   } n  | |  } t |  } t |  } t j t |  d } t | \ } }	 }
 | t |	  } t | |  } | r | t	 |
 t |   f S| |
 f S(   s  Get a tuple representing the relative time difference between two
    :class:`~datetime.datetime` objects or one
    :class:`~datetime.datetime` and now.

    Args:
        d (datetime): The first datetime object.
        other (datetime): An optional second datetime object. If
            unset, defaults to the current time as determined
            :meth:`datetime.utcnow`.
        ndigits (int): The number of decimal digits to round to,
            defaults to ``0``.
        cardinalize (bool): Whether to pluralize the time unit if
            appropriate, defaults to ``True``.
    Returns:
        (float, str): A tuple of the :class:`float` difference and
           respective unit of time, pluralized if appropriate and
           *cardinalize* is set to ``True``.

    Unlike :func:`relative_time`, this method's return is amenable to
    localization into other languages and custom phrasing and
    formatting.

    >>> now = datetime.utcnow()
    >>> decimal_relative_time(now - timedelta(days=1, seconds=3600), now)
    (1.0, 'day')
    >>> decimal_relative_time(now - timedelta(seconds=0.002), now, ndigits=5)
    (0.002, 'seconds')
    >>> decimal_relative_time(now, now - timedelta(days=900), ndigits=1)
    (-2.5, 'years')

    i   N(
   t   NoneR   t   utcnowR   t   abst   bisectt   _BOUND_DELTASt   _BOUNDSt   roundR.   (   t   dt   othert   ndigitst   cardinalizet   difft   diff_secondst   abs_difft   b_idxt   bboundt   bunitt   bnamet   f_difft   rounded_diff(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   decimal_relative_time   s     
c         C   sP   t  |  | | d t \ } } d } | d k  r9 d } n  d t |  | | f S(   sI  Get a string representation of the difference between two
    :class:`~datetime.datetime` objects or one
    :class:`~datetime.datetime` and the current time. Handles past and
    future times.

    Args:
        d (datetime): The first datetime object.
        other (datetime): An optional second datetime object. If
            unset, defaults to the current time as determined
            :meth:`datetime.utcnow`.
        ndigits (int): The number of decimal digits to round to,
            defaults to ``0``.
    Returns:
        A short English-language string.

    >>> now = datetime.utcnow()
    >>> relative_time(now, ndigits=1)
    '0 seconds ago'
    >>> relative_time(now - timedelta(days=1, seconds=36000), ndigits=1)
    '1.4 days ago'
    >>> relative_time(now + timedelta(days=7), now, ndigits=1)
    '1 week from now'

    R9   t   agoi    s   from nows   %g %s %s(   RC   t   TrueR1   (   R6   R7   R8   t   drtR    t   phrase(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   relative_time   s
    	c         C   s   t  j |  |  } | j   S(   sq  Parse the date string according to the format in `format`.  Returns a
    :class:`date` object.  Internally, :meth:`datetime.strptime` is used to
    parse the string and thus conversion specifiers for time fields (e.g. `%H`)
    may be provided;  these will be parsed but ignored.

    Args:
        string (str): The date string to be parsed.
        format (str): The `strptime`_-style date format string.
    Returns:
        datetime.date

    .. _`strptime`: https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior

    >>> strpdate('2016-02-14', '%Y-%m-%d')
    datetime.date(2016, 2, 14)
    >>> strpdate('26/12 (2015)', '%d/%m (%Y)')
    datetime.date(2015, 12, 26)
    >>> strpdate('20151231 23:59:59', '%Y%m%d %H:%M:%S')
    datetime.date(2015, 12, 31)
    >>> strpdate('20160101 00:00:00.001', '%Y%m%d %H:%M:%S.%f')
    datetime.date(2016, 1, 1)
    (   R   t   strptimeR   (   t   stringt   formatt   whence(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   strpdate  s    c         c   s  t  |  t  s t d   n  | rC t  | t  rC t d   n  y | \ } } } Wn% t k
 r} d d | } } } n Xt |  t |  } } t  | t  r t d t |   } n" t  | t  r n t d |   | d
 k r d   } n? |  | k  r| rt j n t j	 } n | r.t j
 n t j } |  } xv | | |  s| V| s`| rt | j | d  \ }	 }
 | j d | j | |	 d	 |
 pd  } n  | | } q@Wd
 S(   s  In the spirit of :func:`range` and :func:`xrange`, the `daterange`
    generator that yields a sequence of :class:`~datetime.date`
    objects, starting at *start*, incrementing by *step*, until *stop*
    is reached.

    When *inclusive* is True, the final date may be *stop*, **if**
    *step* falls evenly on it. By default, *step* is one day. See
    details below for many more details.

    Args:
        start (datetime.date): The starting date The first value in
            the sequence.
        stop (datetime.date): The stopping date. By default not
            included in return. Can be `None` to yield an infinite
            sequence.
        step (int): The value to increment *start* by to reach
            *stop*. Can be an :class:`int` number of days, a
            :class:`datetime.timedelta`, or a :class:`tuple` of integers,
            `(year, month, day)`. Positive and negative *step* values
            are supported.
        inclusive (bool): Whether or not the *stop* date can be
            returned. *stop* is only returned when a *step* falls evenly
            on it.

    >>> christmas = date(year=2015, month=12, day=25)
    >>> boxing_day = date(year=2015, month=12, day=26)
    >>> new_year = date(year=2016, month=1,  day=1)
    >>> for day in daterange(christmas, new_year):
    ...     print(repr(day))
    datetime.date(2015, 12, 25)
    datetime.date(2015, 12, 26)
    datetime.date(2015, 12, 27)
    datetime.date(2015, 12, 28)
    datetime.date(2015, 12, 29)
    datetime.date(2015, 12, 30)
    datetime.date(2015, 12, 31)
    >>> for day in daterange(christmas, boxing_day):
    ...     print(repr(day))
    datetime.date(2015, 12, 25)
    >>> for day in daterange(date(2017, 5, 1), date(2017, 8, 1),
    ...                      step=(0, 1, 0), inclusive=True):
    ...     print(repr(day))
    datetime.date(2017, 5, 1)
    datetime.date(2017, 6, 1)
    datetime.date(2017, 7, 1)
    datetime.date(2017, 8, 1)

    *Be careful when using stop=None, as this will yield an infinite
    sequence of dates.*
    s%   start expected datetime.date instances,   stop expected datetime.date instance or Nonei    R   sB   step expected int, timedelta, or tuple (year, month, day), not: %rc         S   s   t  S(   N(   t   False(   t   t(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   <lambda>b  s    i   R   R   N(   t
   isinstanceR   t	   TypeErrorR   R   R&   R/   t   operatort   gtt   get   ltt   let   divmodR   t   replaceR   (   t   startt   stopt   stept	   inclusivet   y_stept   m_stept   d_stept   finishedt   nowt   m_y_stept	   cur_month(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt	   daterange  s:    3
t   hourst   ConstantTZInfoc           B   sP   e  Z d  Z d e d  Z e d    Z d   Z d   Z d   Z	 d   Z
 RS(   s   
    A :class:`~datetime.tzinfo` subtype whose *offset* remains constant
    (no daylight savings).

    Args:
        name (str): Name of the timezone.
        offset (datetime.timedelta): Offset of the timezone.
    t
   ConstantTZc         C   s   | |  _  | |  _ d  S(   N(   t   namet   offset(   t   selfRi   Rj   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   __init__  s    	c         C   s   t  |  j  d S(   Ni<   i  (   R   Rj   (   Rk   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   utcoffset_hours  s    c         C   s   |  j  S(   N(   Rj   (   Rk   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt	   utcoffset  s    c         C   s   |  j  S(   N(   Ri   (   Rk   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   tzname  s    c         C   s   t  S(   N(   t   ZERO(   Rk   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   dst  s    c         C   s#   |  j  j } d | |  j |  j f S(   Ns   %s(name=%r, offset=%r)(   t	   __class__t   __name__Ri   Rj   (   Rk   t   cn(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   __repr__  s    (   Rs   t
   __module__t   __doc__Rp   Rl   t   propertyRm   Rn   Ro   Rq   Ru   (    (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRg   z  s   			t   UTCt   LocalTZInfoc           B   ss   e  Z d  Z e d e j  Z e Z e j rD e d e j	  Z n  d   Z
 d   Z d   Z d   Z d   Z RS(   sK  The ``LocalTZInfo`` type takes data available in the time module
    about the local timezone and makes a practical
    :class:`datetime.tzinfo` to represent the timezone settings of the
    operating system.

    For a more in-depth integration with the operating system, check
    out `tzlocal`_. It builds on `pytz`_ and implements heuristics for
    many versions of major operating systems to provide the official
    ``pytz`` tzinfo, instead of the LocalTZ generalization.

    .. _tzlocal: https://pypi.python.org/pypi/tzlocal
    .. _pytz: https://pypi.python.org/pypi/pytz

    R   c      	   C   s^   | j  | j | j | j | j | j | j   d d f	 } t j t j	 |   } | j
 d k S(   Ni    i(   R   R   R   R   R   R   t   weekdayt   timet	   localtimet   mktimet   tm_isdst(   Rk   R   t   dt_tt   local_t(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   is_dst  s    c         C   s   |  j  |  r |  j S|  j S(   N(   R   t   _dst_offsett   _std_offset(   Rk   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRn     s    c         C   s!   |  j  |  r |  j |  j St S(   N(   R   R   R   Rp   (   Rk   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRq     s    c         C   s   t  j |  j |  S(   N(   R|   Ro   R   (   Rk   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRo     s    c         C   s   d |  j  j S(   Ns   %s()(   Rr   Rs   (   Rk   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRu     s    (   Rs   Rv   Rw   R   R|   t   timezoneR   R   t   daylightt   altzoneR   Rn   Rq   Ro   Ru   (    (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRz     s   					c         C   s-   d |  j    } | r) |  t |  7}  n  |  S(   Ni   (   R{   R   (   R   t
   days_to_go(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   _first_sunday_on_or_after  s    i   i   i   i   i
   i   i   t
   USTimeZonec           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s   Copied directly from the Python docs, the ``USTimeZone`` is a
    :class:`datetime.tzinfo` subtype used to create the
    :data:`Eastern`, :data:`Central`, :data:`Mountain`, and
    :data:`Pacific` tzinfo types.
    c         C   s1   t  d |  |  _ | |  _ | |  _ | |  _ d  S(   NRf   (   R   t	   stdoffsett   reprnamet   stdnamet   dstname(   Rk   Rf   R   R   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRl     s    		c         C   s   |  j  S(   N(   R   (   Rk   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRu     s    c         C   s!   |  j  |  r |  j S|  j Sd  S(   N(   Rq   R   R   (   Rk   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRo     s    c         C   s   |  j  |  j |  S(   N(   R   Rq   (   Rk   R   (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRn     s    c         C   s  | d  k s | j d  k r t S| j |  k s4 t  d | j k  rS t t } } nb d | j k  om d k  n r t t } } n3 d | j k  o d k  n r t	 t
 } } n t St | j d | j   } t | j d | j   } | | j d d   k o| k  n rt St Sd  S(   Ni  i  i  i  i  R   R    (   R/   R    Rp   t   AssertionErrorR   t   DSTSTART_2007t   DSTEND_2007t   DSTSTART_1987_2006t   DSTEND_1987_2006t   DSTSTART_1967_1986t   DSTEND_1967_1986R   RY   t   HOUR(   Rk   R   t   dststartt   dstendRZ   t   end(    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyRq     s    ((   Rs   Rv   Rw   Rl   Ru   Ro   Rn   Rq   (    (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyR     s   				it   Easternt   ESTt   EDTit   Centralt   CSTt   CDTit   Mountaint   MSTt   MDTit   Pacifict   PSTt   PDT(8   Rw   t   reR|   R2   RS   R   R    R   R   R   R   t   compileR   R   R4   t   bR3   t   _FLOAT_PATTERNR!   t   dictt   reversedt   _R    R$   R-   t   parse_tdR.   R/   RE   RC   RH   RM   RN   Re   Rp   R   Rg   Ry   t   fromtimestampR   t   utcfromtimestampR   Rz   t   LocalTZR   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s>   lib/python2.7/site-packages/conda/_vendor/boltons/timeutils.pyt   <module>   sb   "			6:	*	. 	Z+		7