ó
Ħt\c           @  sN   d  Z  d d l m Z d d l m Z m Z d d  Z d   Z d   Z d S(   us   
This module offers general convenience and utility functions for dealing with
datetimes.

.. versionadded:: 2.7.0
i˙˙˙˙(   t   unicode_literals(   t   datetimet   timec         C  s1   t  j |   } t  j | j   t d d |   S(   u  
    Returns a :py:class:`datetime` representing the current day at midnight

    :param tzinfo:
        The time zone to attach (also used to determine the current day).

    :return:
        A :py:class:`datetime.datetime` object representing the current day
        at midnight.
    i    t   tzinfo(   R   t   nowt   combinet   dateR   (   R   t   dt(    (    s-   lib/python2.7/site-packages/dateutil/utils.pyt   today   s    c         C  s'   |  j  d k	 r |  S|  j d |  Sd S(   u¨  
    Sets the the ``tzinfo`` parameter on naive datetimes only

    This is useful for example when you are provided a datetime that may have
    either an implicit or explicit time zone, such as when parsing a time zone
    string.

    .. doctest::

        >>> from dateutil.tz import tzoffset
        >>> from dateutil.parser import parse
        >>> from dateutil.utils import default_tzinfo
        >>> dflt_tz = tzoffset("EST", -18000)
        >>> print(default_tzinfo(parse('2014-01-01 12:30 UTC'), dflt_tz))
        2014-01-01 12:30:00+00:00
        >>> print(default_tzinfo(parse('2014-01-01 12:30'), dflt_tz))
        2014-01-01 12:30:00-05:00

    :param dt:
        The datetime on which to replace the time zone

    :param tzinfo:
        The :py:class:`datetime.tzinfo` subclass instance to assign to
        ``dt`` if (and only if) it is naive.

    :return:
        Returns an aware :py:class:`datetime.datetime`.
    R   N(   R   t   Nonet   replace(   R   R   (    (    s-   lib/python2.7/site-packages/dateutil/utils.pyt   default_tzinfo   s    c         C  s/   t  |  } |  | } | | k o, | k SS(   uh   
    Useful for comparing two datetimes that may a negilible difference
    to be considered equal.
    (   t   abs(   t   dt1t   dt2t   deltat
   difference(    (    s-   lib/python2.7/site-packages/dateutil/utils.pyt   within_delta@   s    
N(	   t   __doc__t
   __future__R    R   R   R	   R   R   R   (    (    (    s-   lib/python2.7/site-packages/dateutil/utils.pyt   <module>   s
   	#