Your IP : 18.226.17.3
3
6�cY�. � @ s� d dl mZ d dlmZ d dlmZmZmZ ed �ZddgZdd� Z e
ed�rZdd d�ZnG d
d� de�Zddd�Zd
d� Z
G dd� de�ZG dd� de�Zdd� Zeede�ZdS )� )�PY3)�wraps)�datetime� timedelta�tzinfo�tzname_in_python2�enfoldc s � fdd�}|S )z�Change unicode output into bytestrings in Python 2
tzname() API changed in Python 3. It used to return bytes, but was changed
to unicode strings
c s$ � | |�}|d k r t r |j� }|S )N)r �encode)�args�kwargs�name)�namefunc� �/usr/lib/python3.6/_common.py�adjust_encoding s
z*tzname_in_python2.<locals>.adjust_encodingr )r
r r )r
r r
s �fold� c C s | j |d�S )a�
Provides a unified interface for assigning the ``fold`` attribute to
datetimes both before and after the implementation of PEP-495.
:param fold:
The value for the ``fold`` attribute in the returned datetime. This
should be either 0 or 1.
:return:
Returns an object for which ``getattr(dt, 'fold', 0)`` returns
``fold`` for all versions of Python. In versions prior to
Python 3.6, this is a ``_DatetimeWithFold`` object, which is a
subclass of :py:class:`datetime.datetime` with the ``fold``
attribute added, if ``fold`` is 1.
.. versionadded:: 2.6.0
)r )�replace)�dtr r r r r ! s c @ s e Zd ZdZf Zedd� �ZdS )�_DatetimeWithFoldz�
This is a class designed to provide a PEP 495-compliant interface for
Python versions before 3.6. It is used only for dates in a fold, so
the ``fold`` attribute is fixed at ``1``.
.. versionadded:: 2.6.0
c C s dS )Nr r )�selfr r r r @ s z_DatetimeWithFold.foldN)�__name__�
__module__�__qualname__�__doc__� __slots__�propertyr r r r r r 6 s r c C sL t | dd�|kr| S | j� dd� }|| j| jf7 }|r@t|� S t|� S dS )a�
Provides a unified interface for assigning the ``fold`` attribute to
datetimes both before and after the implementation of PEP-495.
:param fold:
The value for the ``fold`` attribute in the returned datetime. This
should be either 0 or 1.
:return:
Returns an object for which ``getattr(dt, 'fold', 0)`` returns
``fold`` for all versions of Python. In versions prior to
Python 3.6, this is a ``_DatetimeWithFold`` object, which is a
subclass of :py:class:`datetime.datetime` with the ``fold``
attribute added, if ``fold`` is 1.
.. versionadded:: 2.6.0
r r N� )�getattrZ timetupleZmicrosecondr r r )r r r
r r r r D s c s t � �� fdd��}|S )z�
The CPython version of ``fromutc`` checks that the input is a ``datetime``
object and that ``self`` is attached as its ``tzinfo``.
c s. t |t�std��|j| k r$td��� | |�S )Nz&fromutc() requires a datetime argumentzdt.tzinfo is not self)�
isinstancer � TypeErrorr �
ValueError)r r )�fr r �fromutcg s
z)_validate_fromutc_inputs.<locals>.fromutc)r )r"