Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/library/binascii.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ encodings of it in ASCII form (in both directions).

Functions
---------
.. function:: hexlify(data, [sep])

Convert the bytes in the *data* object to a hexadecimal representation.
Returns a bytes object.

If the additional argument *sep* is supplied it is used as a separator
between hexadecimal values.

.. function:: unhexlify(data)

Convert hexadecimal data to binary representation. Returns bytes string.
(i.e. inverse of hexlify)

.. function:: a2b_base64(data)

Expand Down
81 changes: 81 additions & 0 deletions docs/library/datetime.date.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
.. currentmodule:: datetime
.. _datetime.date:

class date -- Represent a date
===============================

:py:class:`~datetime.date` objects support equality and comparison operators.

.. class:: date(year, month, day)

All arguments are required. Arguments must be integers, in the following ranges:

- :py:class:`~datetime.MINYEAR` <= year <= :py:class:`~datetime.MAXYEAR`
- 1 <= month <= 12
- 1 <= day <= number of days in the given month and year

Other constructors:

.. classmethod:: today()

.. classmethod:: fromtimestamp(timestamp)

.. classmethod:: fromordinal(ordinal)

.. classmethod:: fromisoformate(date_string)

Class attributes:

.. attribute:: min

The earliest representable date, date(:py:attr:`~datetime.MINYEAR`, 1, 1).

.. attribute:: max

The latest representable date, date(:py:attr:`~datetime.MAXYEAR`, 12, 31).

.. attribute:: resolution

The smallest possible difference between non-equal date objects, ``timedelta(days=1)`` .

Instance attributes:

.. attribute:: year

.. attribute:: month

.. attribute:: day

Instance methods

.. method:: replace(year = self.year, month = self.month, day = self.day)

Return a new :py:class:`~datetime.date` object with the same values but the specified parameters updated.

.. method:: tuple()

Return the date as a tuple (year, month, day)

.. method:: timetuple()

Return the date as a 9-tuple

.. method:: toordinal()

Return an integer representing the ordinal of the date, where January 1st of year 1 has ordinal 1.

.. method:: isoformat()

Return a string representing the date in ISO 8601 format, YYYY-MM-DD::

from datetime import date
date(2002, 12, 4).isoformat()
# outputs '2002-12-04'

.. method:: isoweekday()

Return the day of the week as an integer, where Monday is 1 and Sunday is 7.

.. method:: weekday()

Return the day of the week as an integer, where Monday is 0 and Sunday is 6.
67 changes: 67 additions & 0 deletions docs/library/datetime.datetime.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.. currentmodule:: datetime
.. _datetime.datetime:

class datetime -- Information about a date and time
===================================================

.. class:: datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)

A datetime object is a single object containing all the information from a
:py:class:`~datetime.date` object and a :py:class:`~datetime.time` object.

Other constructors:

.. classmethod:: fromisoformat
.. classmethod:: fromordinal
.. classmethod:: fromtimestamp
.. classmethod:: now

NOT IMPLEMENTED

.. classmethod:: combine

.. classmethod:: strptime

*NOT IMPLEMENTED*

Class attributes:

.. attribute:: EPOCH

A :py:class:`~datetime.datetime` object representing the epoch.

Instance attributes:

.. attribute:: year
.. attribute:: month
.. attribute:: day
.. attribute:: hour
.. attribute:: minute
.. attribute:: second
.. attribute:: microsecond
.. attribute:: tzinfo
.. attribute:: fold

Instance methods:

.. method:: replace
.. method:: tuple
.. method:: time
.. method:: astimezone
.. method:: date
.. method:: dst
.. method:: isoformat

.. method:: isoweekday()

Return the day of the week as an integer, where Monday is 1 and Sunday is 7.

.. method:: weekday()

Return the day of the week as an integer, where Monday is 0 and Sunday is 6.

.. method:: timetuple()
.. method:: timetz()
.. method:: toordinal()
.. method:: tzname()
.. method:: utcoffset()
28 changes: 28 additions & 0 deletions docs/library/datetime.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

:mod:`datetime` -- time manipulation functionality
==================================================

This module is a partial implementation of `datetime
<https://docs.python.org/3/library/datetime.html>`_ from standard CPython

.. module:: datetime
:synopsis: time manipulation functionality


Constants
---------

.. data:: datetime.MAXYEAR
.. data:: datetime.MINYEAR

Classes
-------
.. toctree::
:maxdepth: 1

datetime.date.rst
datetime.datetime.rst
datetime.time.rst
datetime.timedelta.rst
datetime.timezone.rst
datetime.tzinfo.rst
65 changes: 65 additions & 0 deletions docs/library/datetime.time.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.. currentmodule:: datetime
.. _datetime.time:

class time -- Idealised time
============================

An idealized time, independent of any particular day, assuming that every day
has exactly 24*60*60 seconds. (There is no notion of “leap seconds” here).

:py:class:`~datetime.time` objects support equality and comparison operators.

.. class:: time(hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)

Create a time object. All paramteters are optional.

- *hour*, *minute*, *second*, *microsecond*, integers.
- *tzinfo* an object of the :py:class`datetime.tzinfo` class. May be `None`.
- *fold* In [0, 1]. Used to disambiguate wall times during a repeated
interval. (A repeated interval occurs when clocks are rolled back at the end
of daylight saving time or when the UTC offset for the current zone is
decreased for political reasons.) The values 0 and 1 represent,
respectively, the earlier and later of the two moments with the same wall
time representation.

Other constructors:

.. classmethod:: fromisoformat(time_string)

Construct a :py:class:`~datetime.time` object from an ISO 8601 string::

from datetime import time
t = time.fromisoformat('04:23:01.000384')

Class attributes
.. attribute:: min

.. attribute:: max

.. attribute:: resolution

Instance attributes:

.. attribute:: hour
.. attribute:: minute
.. attribute:: second
.. attribute:: microsecond
.. attribute:: tzinfo
.. attribute:: fold

Instance methods:

.. method:: replace(hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond, tzinfo=self.tzinfo, *, fold=0)

Return a new :py:class:`~datetime.time` objects with the specified parameters updated.

.. method:: isoformat()

.. method:: strftime()

NOT IMPLEMENTED: use :py:meth:`time.strftime`

.. method:: tuple()
.. method:: dst()
.. method:: tzname()
.. method:: utcoffset()
25 changes: 25 additions & 0 deletions docs/library/datetime.timedelta.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. currentmodule:: datetime
.. _datetime.timedelta:

class timedelta -- Represents a duration
========================================

A timedelta object represents a duration, or the difference between two :py:class:`~datetime.datetime` or :py:class:`~datetime.date` instances.

.. class:: timedelta(...)

.. attribute:: days

.. attribute:: isoformat

.. attribute:: max

.. attribute:: min

.. attribute:: microseconds

.. attribute:: resolution

.. attribute:: seconds

.. attribute:: total_seconds
17 changes: 17 additions & 0 deletions docs/library/datetime.timezone.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. currentmodule:: timezone
.. _datetime.timezone:

class timezone -- Represents a time zone
========================================

The timezone class is a subclass of :py:class:`~datetime.tzinfo`, each instance
of which represents a time zone defined by a fixed offset from UTC.

.. class:: timezone(offset, name=None)

.. method:: dst
.. method:: fromutc
.. method:: isoformat
.. method:: tzname
.. method:: utc
.. method:: utcoffset
25 changes: 25 additions & 0 deletions docs/library/datetime.tzinfo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

.. currentmodule:: datetime
.. _datetime.tzinfo:

class tzinfo -- Timezone information
====================================

An abstract base class for time zone information objects. These are used by the
datetime and time classes to provide a customizable notion of time adjustment
(for example, to account for time zone and/or daylight saving time).

.. class:: tzinfo()

.. method:: dst()

Return the daylight saving time (DST) adjustment, as a `timedelta` object or
None if DST information isn’t known.

.. method:: fromutc()

.. method:: isoformat()

.. method:: tzname()

.. method:: utcoffset()
Loading