mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
General style conformance. Markup some unmarked constructs.
This commit is contained in:
parent
2cb540253b
commit
436eadd455
1 changed files with 471 additions and 442 deletions
|
|
@ -219,7 +219,8 @@ Supported operations:
|
|||
{(1)}
|
||||
\lineiii{\var{t1} = \var{t2} * \var{i} or \var{t1} = \var{i} * \var{t2}}
|
||||
{Delta multiplied by an integer or long.
|
||||
Afterwards \var{t1} // i == \var{t2} is true, provided \code{i != 0}.
|
||||
Afterwards \var{t1} // i == \var{t2} is true,
|
||||
provided \code{i != 0}.
|
||||
In general, \var{t1} * i == \var{t1} * (i-1) + \var{t1} is true.}
|
||||
{(1)}
|
||||
\lineiii{\var{t1} = \var{t2} // \var{i}}
|
||||
|
|
@ -233,11 +234,9 @@ Supported operations:
|
|||
-\var{t1.microseconds}),and to \var{t1}* -1.}
|
||||
{(1)(3)}
|
||||
\lineiii{abs(\var{t})}
|
||||
{equivalent to +\var{t} when \code{t.days >= 0}, and to -\var{t} when
|
||||
\code{t.days < 0}.}
|
||||
{equivalent to +\var{t} when \code{t.days >= 0}, and to
|
||||
-\var{t} when \code{t.days < 0}.}
|
||||
{(1)}
|
||||
|
||||
|
||||
\end{tableiii}
|
||||
\noindent
|
||||
Notes:
|
||||
|
|
@ -251,7 +250,6 @@ Division by 0 raises \exception{ZeroDivisionError}.
|
|||
|
||||
\item[(3)]
|
||||
-\var{timedelta.max} is not representable as a \class{timedelta} object.
|
||||
|
||||
\end{description}
|
||||
|
||||
In addition to the operations listed above \class{timedelta} objects
|
||||
|
|
@ -280,7 +278,6 @@ computations. See the book for algorithms for converting between
|
|||
proleptic Gregorian ordinals and many other calendar systems.
|
||||
|
||||
\begin{funcdesc}{date}{year, month, day}
|
||||
|
||||
All arguments are required. Arguments may be ints or longs, in the
|
||||
following ranges:
|
||||
|
||||
|
|
@ -312,9 +309,10 @@ Other constructors, all class methods:
|
|||
|
||||
\begin{methoddesc}{fromordinal}{ordinal}
|
||||
Return the date corresponding to the proleptic Gregorian ordinal,
|
||||
where January 1 of year 1 has ordinal 1. \exception{ValueError}
|
||||
is raised unless \code{1 <= \var{ordinal} <= date.max.toordinal()}. For any
|
||||
date \var{d}, \code{date.fromordinal(\var{d}.toordinal()) == \var{d}}.
|
||||
where January 1 of year 1 has ordinal 1. \exception{ValueError} is
|
||||
raised unless \code{1 <= \var{ordinal} <= date.max.toordinal()}.
|
||||
For any date \var{d}, \code{date.fromordinal(\var{d}.toordinal()) ==
|
||||
\var{d}}.
|
||||
\end{methoddesc}
|
||||
|
||||
Class attributes:
|
||||
|
|
@ -343,8 +341,8 @@ Between 1 and 12 inclusive.
|
|||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{day}
|
||||
Between 1 and the number of days in the given month
|
||||
of the given year.
|
||||
Between 1 and the number of days in the given month of the given
|
||||
year.
|
||||
\end{memberdesc}
|
||||
|
||||
Supported operations:
|
||||
|
|
@ -409,23 +407,27 @@ Instance methods:
|
|||
\# day of year
|
||||
-1)}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{toordinal}{}
|
||||
Return the proleptic Gregorian ordinal of the date, where January 1
|
||||
of year 1 has ordinal 1. For any \class{date} object \var{d},
|
||||
\code{date.fromordinal(\var{d}.toordinal()) == \var{d}}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{weekday}{}
|
||||
Return the day of the week as an integer, where Monday is 0 and
|
||||
Sunday is 6. For example, date(2002, 12, 4).weekday() == 2, a
|
||||
Wednesday.
|
||||
See also \method{isoweekday()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{isoweekday}{}
|
||||
Return the day of the week as an integer, where Monday is 1 and
|
||||
Sunday is 7. For example, date(2002, 12, 4).isoweekday() == 3, a
|
||||
Wednesday.
|
||||
See also \method{weekday()}, \method{isocalendar()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{isocalendar}{}
|
||||
Return a 3-tuple, (ISO year, ISO week number, ISO weekday).
|
||||
|
||||
|
|
@ -446,15 +448,18 @@ Instance methods:
|
|||
date(2003, 12, 29).isocalendar() == (2004, 1, 1)
|
||||
date(2004, 1, 4).isocalendar() == (2004, 1, 7)
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{isoformat}{}
|
||||
Return a string representing the date in ISO 8601 format,
|
||||
'YYYY-MM-DD'. For example,
|
||||
date(2002, 12, 4).isoformat() == '2002-12-04'.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{__str__}{}
|
||||
For a date \var{d}, \code{str(\var{d})} is equivalent to
|
||||
\code{\var{d}.isoformat()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{ctime}{}
|
||||
Return a string representing the date, for example
|
||||
date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'.
|
||||
|
|
@ -464,6 +469,7 @@ Instance methods:
|
|||
(which \function{time.ctime()} invokes, but which
|
||||
\method{date.ctime()} does not invoke) conforms to the C standard.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{strftime}{format}
|
||||
Return a string representing the date, controlled by an explicit
|
||||
format string. Format codes referring to hours, minutes or seconds
|
||||
|
|
@ -483,8 +489,8 @@ day.
|
|||
|
||||
\begin{funcdesc}{datetime}{year, month, day,
|
||||
hour=0, minute=0, second=0, microsecond=0}
|
||||
The year, month and day arguments are required. Arguments may be ints
|
||||
or longs, in the following ranges:
|
||||
The year, month and day arguments are required. Arguments may be
|
||||
ints or longs, in the following ranges:
|
||||
|
||||
\begin{itemize}
|
||||
\item \code{\member{MINYEAR} <= \var{year} <= \member{MAXYEAR}}
|
||||
|
|
@ -496,8 +502,8 @@ or longs, in the following ranges:
|
|||
\item \code{0 <= \var{microsecond} < 1000000}
|
||||
\end{itemize}
|
||||
|
||||
If an argument outside those ranges is given,
|
||||
\exception{ValueError} is raised.
|
||||
If an argument outside those ranges is given, \exception{ValueError}
|
||||
is raised.
|
||||
\end{funcdesc}
|
||||
|
||||
Other constructors, all class methods:
|
||||
|
|
@ -590,7 +596,8 @@ Between 1 and 12 inclusive
|
|||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{day}
|
||||
Between 1 and the number of days in the given month of the given year.
|
||||
Between 1 and the number of days in the given month of the given
|
||||
year.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{hour}
|
||||
|
|
@ -659,7 +666,8 @@ Instance methods:
|
|||
Return time object with same hour, minute, second and microsecond.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{replace}{year=, month=, day=, hour=, minute=, second=, microsecond=}
|
||||
\begin{methoddesc}{replace}{year=, month=, day=, hour=, minute=,
|
||||
second=, microsecond=}
|
||||
Return a datetime with the same value, except for those fields given
|
||||
new values by whichever keyword arguments are specified.
|
||||
\end{methoddesc}
|
||||
|
|
@ -744,8 +752,7 @@ Instance methods:
|
|||
A \class{time} object represents an idealized time of day, independent
|
||||
of day and timezone.
|
||||
|
||||
\begin{funcdesc}{hour=0, minute=0, second=0, microsecond=0}
|
||||
|
||||
\begin{funcdesc}{time}{hour=0, minute=0, second=0, microsecond=0}
|
||||
All arguments are optional. They may be ints or longs, in the
|
||||
following ranges:
|
||||
|
||||
|
|
@ -781,12 +788,15 @@ Instance attributes (read-only):
|
|||
\begin{memberdesc}{hour}
|
||||
In \code{range(24)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{minute}
|
||||
In \code{range(60)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{second}
|
||||
In \code{range(60)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{microsecond}
|
||||
In \code{range(1000000)}.
|
||||
\end{memberdesc}
|
||||
|
|
@ -872,6 +882,7 @@ implement all of them.
|
|||
\class{timedelta} object representing a whole number of minutes
|
||||
in the same range. Most implementations of \method{utcoffset()}
|
||||
will probably look like:
|
||||
|
||||
\begin{verbatim}
|
||||
return CONSTANT # fixed-offset class
|
||||
return CONSTANT + self.dst(dt) # daylight-aware class
|
||||
|
|
@ -880,19 +891,20 @@ implement all of them.
|
|||
|
||||
\begin{methoddesc}{tzname}{self, dt}
|
||||
Return the timezone name corresponding to the \class{datetime} represented
|
||||
by dt, as a string. Nothing about string names is defined by the
|
||||
by \var{dt}, as a string. Nothing about string names is defined by the
|
||||
\module{datetime} module, and there's no requirement that it mean anything
|
||||
in particular. For example, "GMT", "UTC", "-500", "-5:00", "EDT",
|
||||
"US/Eastern", "America/New York" are all valid replies. Return
|
||||
\code{None} if a string name isn't known. Note that this is a method
|
||||
rather than a fixed string primarily because some \class{tzinfo} objects
|
||||
will wish to return different names depending on the specific value
|
||||
of dt passed, especially if the \class{tzinfo} class is accounting for DST.
|
||||
of \var{dt} passed, especially if the \class{tzinfo} class is
|
||||
accounting for DST.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{dst}{self, dt}
|
||||
Return the DST offset, in minutes east of UTC, or \code{None} if
|
||||
DST information isn't known. Return 0 if DST is not in effect.
|
||||
DST information isn't known. Return \code{0} if DST is not in effect.
|
||||
If DST is in effect, return the offset as an integer or
|
||||
\class{timedelta} object (see \method{utcoffset()} for details).
|
||||
Note that DST offset, if applicable, has
|
||||
|
|
@ -937,7 +949,6 @@ particular day, and subject to adjustment via a \class{tzinfo} object.
|
|||
Constructor:
|
||||
|
||||
\begin{funcdesc}{time}{hour=0, minute=0, second=0, microsecond=0, tzinfo=None}
|
||||
|
||||
All arguments are optional. \var{tzinfo} may be \code{None}, or
|
||||
an instance of a \class{tzinfo} subclass. The remaining arguments
|
||||
may be ints or longs, in the following ranges:
|
||||
|
|
@ -971,13 +982,26 @@ Class attributes:
|
|||
|
||||
Instance attributes (read-only):
|
||||
|
||||
.hour in range(24)
|
||||
.minute in range(60)
|
||||
.second in range(60)
|
||||
.microsecond in range(1000000)
|
||||
.tzinfo the object passed as the tzinfo argument to the
|
||||
\class{timetz} constructor, or \code{None} if none
|
||||
was passed.
|
||||
\begin{memberdesc}{hour}
|
||||
In \code{range(24)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{minute}
|
||||
In \code{range(60)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{second}
|
||||
In \code{range(60)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{microsecond}
|
||||
In \code{range(1000000)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{tzinfo}
|
||||
The object passed as the tzinfo argument to the \class{timetz}
|
||||
constructor, or \code{None} if none was passed.
|
||||
\end{memberdesc}
|
||||
|
||||
Supported operations:
|
||||
|
||||
|
|
@ -1069,8 +1093,8 @@ from a \class{date} object and a \class{timetz} object.
|
|||
Constructor:
|
||||
|
||||
\begin{funcdesc}{datetimetz}{year, month, day,
|
||||
hour=0, minute=0, second=0, microsecond=0, tzinfo=None}
|
||||
|
||||
hour=0, minute=0, second=0, microsecond=0,
|
||||
tzinfo=None}
|
||||
The year, month and day arguments are required. \var{tzinfo} may
|
||||
be \code{None}, or an instance of a \class{tzinfo} subclass. The
|
||||
remaining arguments may be ints or longs, in the following ranges:
|
||||
|
|
@ -1095,7 +1119,6 @@ Other constructors (class methods):
|
|||
\methodline{utcnow}{}
|
||||
\methodline{utcfromtimestamp}{timestamp}
|
||||
\methodline{fromordinal}{ordinal}
|
||||
|
||||
These are the same as the \class{datetime} class methods of the
|
||||
same names, except that they construct a \class{datetimetz}
|
||||
object, with tzinfo \code{None}.
|
||||
|
|
@ -1103,16 +1126,17 @@ Other constructors (class methods):
|
|||
|
||||
\begin{funcdesc}{now}{\optional{tzinfo=None}}
|
||||
\methodline{fromtimestamp}{timestamp\optional{, tzinfo=None}}
|
||||
|
||||
These are the same as the \class{datetime} class methods of the same names,
|
||||
except that they accept an additional, optional tzinfo argument, and
|
||||
construct a \class{datetimetz} object with that \class{tzinfo} object attached.
|
||||
These are the same as the \class{datetime} class methods of the
|
||||
same names, except that they accept an additional, optional tzinfo
|
||||
argument, and construct a \class{datetimetz} object with that
|
||||
\class{tzinfo} object attached.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{combine}{date, time}
|
||||
This is the same as \method{datetime.combine()}, except that it constructs
|
||||
a \class{datetimetz} object, and, if the time object is of type timetz,
|
||||
the \class{datetimetz} object has the same \class{tzinfo} object as the time object.
|
||||
This is the same as \method{datetime.combine()}, except that it
|
||||
constructs a \class{datetimetz} object, and, if the time object is
|
||||
of type timetz, the \class{datetimetz} object has the same
|
||||
\class{tzinfo} object as the time object.
|
||||
\end{funcdesc}
|
||||
|
||||
Class attributes:
|
||||
|
|
@ -1135,31 +1159,37 @@ Class attributes:
|
|||
Instance attributes, all read-only:
|
||||
|
||||
\begin{memberdesc}{year}
|
||||
Between MINYEAR and MAXYEAR inclusive
|
||||
Between \constant{MINYEAR} and \constant{MAXYEAR}, inclusive.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{month}
|
||||
Between 1 and 12 inclusive
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{day}
|
||||
Between 1 and the number of days in the given month
|
||||
of the given year
|
||||
Between 1 and the number of days in the given month of the given
|
||||
year.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{hour}
|
||||
In \code{range(24)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{minute}
|
||||
In \code{range(60)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{second}
|
||||
In \code{range(60)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{microsecond}
|
||||
In \code{range(1000000)}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{tzinfo}
|
||||
The object passed as the \var{tzinfo} argument to
|
||||
the \class{datetimetz} constructor, or \code{None}
|
||||
if none was passed.
|
||||
The object passed as the \var{tzinfo} argument to the
|
||||
\class{datetimetz} constructor, or \code{None} if none was passed.
|
||||
\end{memberdesc}
|
||||
|
||||
Supported operations:
|
||||
|
|
@ -1232,7 +1262,6 @@ Instance methods:
|
|||
\methodline{ctime}{}
|
||||
\methodline{__str__}{}
|
||||
\methodline{strftime}{format}
|
||||
|
||||
These are the same as the \class{datetime} methods of the same names.
|
||||
\end{methoddesc}
|
||||
|
||||
|
|
@ -1241,8 +1270,8 @@ These are the same as the \class{datetime} methods of the same names.
|
|||
and tzinfo.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{replace}{year=, month=, day=, hour=, minute=, second=, microsecond=,
|
||||
tzinfo=}
|
||||
\begin{methoddesc}{replace}{year=, month=, day=, hour=, minute=, second=,
|
||||
microsecond=, tzinfo=}
|
||||
Return a datetimetz with the same value, except for those fields given
|
||||
new values by whichever keyword arguments are specified. Note that
|
||||
\code{tzinfo=None} can be specified to create a naive datetimetz from
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue