lots of markup adjustments

This commit is contained in:
Fred Drake 2003-12-30 20:36:20 +00:00
parent 7c67cb8fba
commit b0e8f5d0fe

View file

@ -106,7 +106,7 @@ naive or aware. \var{d} is aware if \code{\var{d}.tzinfo} is not
is naive. is naive.
The distinction between naive and aware doesn't apply to The distinction between naive and aware doesn't apply to
\code{timedelta} objects. \class{timedelta} objects.
Subclass relationships: Subclass relationships:
@ -124,11 +124,11 @@ object
A \class{timedelta} object represents a duration, the difference A \class{timedelta} object represents a duration, the difference
between two dates or times. between two dates or times.
\begin{classdesc}{timedelta}{days=0, seconds=0, microseconds=0, \begin{classdesc}{timedelta}{\optional{days\optional{, seconds\optional{,
milliseconds=0, minutes=0, hours=0, weeks=0} microseconds\optional{, milliseconds\optional{,
minutes\optional{, hours\optional{, weeks}}}}}}}}
All arguments are optional. Arguments may be ints, longs, or floats, All arguments are optional and default to \code{0}. Arguments may
and may be positive or negative. be ints, longs, or floats, and may be positive or negative.
Only \var{days}, \var{seconds} and \var{microseconds} are stored Only \var{days}, \var{seconds} and \var{microseconds} are stored
internally. Arguments are converted to those units: internally. Arguments are converted to those units:
@ -209,8 +209,8 @@ Supported operations:
(1)} (1)}
\lineii{\var{t1} = \var{t2} - \var{t3}} \lineii{\var{t1} = \var{t2} - \var{t3}}
{Difference of \var{t2} and \var{t3}. {Difference of \var{t2} and \var{t3}.
Afterwards \var{t1} == \var{t2} - \var{t3} and \var{t2} == \var{t1} + \var{t3} are Afterwards \var{t1} == \var{t2} - \var{t3} and
true. \var{t2} == \var{t1} + \var{t3} are true.
(1)} (1)}
\lineii{\var{t1} = \var{t2} * \var{i} or \var{t1} = \var{i} * \var{t2}} \lineii{\var{t1} = \var{t2} * \var{i} or \var{t1} = \var{i} * \var{t2}}
{Delta multiplied by an integer or long. {Delta multiplied by an integer or long.
@ -352,7 +352,6 @@ Instance attributes (read-only):
Supported operations: Supported operations:
% XXX rewrite to be a table
\begin{tableii}{c|l}{code}{Operation}{Result} \begin{tableii}{c|l}{code}{Operation}{Result}
\lineii{\var{date2} = \var{date1} + \var{timedelta}} \lineii{\var{date2} = \var{date1} + \var{timedelta}}
{\var{date2} is \code{\var{timedelta}.days} days removed from {\var{date2} is \code{\var{timedelta}.days} days removed from
@ -520,9 +519,10 @@ day.
Constructor: Constructor:
\begin{classdesc}{datetime}{year, month, day, \begin{classdesc}{datetime}{year, month, day\optional{,
hour=0, minute=0, second=0, microsecond=0, hour\optional{, minute\optional{,
tzinfo=None} second\optional{, microsecond\optional{,
tzinfo}}}}}}
The year, month and day arguments are required. \var{tzinfo} may The year, month and day arguments are required. \var{tzinfo} may
be \code{None}, or an instance of a \class{tzinfo} subclass. The be \code{None}, or an instance of a \class{tzinfo} subclass. The
remaining arguments may be ints or longs, in the following ranges: remaining arguments may be ints or longs, in the following ranges:
@ -550,7 +550,7 @@ Other constructors, all class methods:
See also \method{now()}, \method{fromtimestamp()}. See also \method{now()}, \method{fromtimestamp()}.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{now(tz=None)}{} \begin{methoddesc}{now}{\optional{tz}}
Return the current local date and time. If optional argument Return the current local date and time. If optional argument
\var{tz} is \code{None} or not specified, this is like \var{tz} is \code{None} or not specified, this is like
\method{today()}, but, if possible, supplies more precision than can \method{today()}, but, if possible, supplies more precision than can
@ -572,7 +572,7 @@ Other constructors, all class methods:
See also \method{now()}. See also \method{now()}.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{fromtimestamp}{timestamp, tz=None} \begin{methoddesc}{fromtimestamp}{timestamp\optional{, tz}}
Return the local date and time corresponding to the \POSIX{} Return the local date and time corresponding to the \POSIX{}
timestamp, such as is returned by \function{time.time()}. timestamp, such as is returned by \function{time.time()}.
If optional argument \var{tz} is \code{None} or not specified, the If optional argument \var{tz} is \code{None} or not specified, the
@ -780,8 +780,10 @@ Instance methods:
and tzinfo members. See also method \method{time()}. and tzinfo members. See also method \method{time()}.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{replace}{year=, month=, day=, hour=, minute=, second=, \begin{methoddesc}{replace}{\optional{year\optional{, month\optional{,
microsecond=, tzinfo=} day\optional{, hour\optional{, minute\optional{,
second\optional{, microsecond\optional{,
tzinfo}}}}}}}}}
Return a datetime with the same members, except for those members given Return a datetime with the same members, except for those members given
new values by whichever keyword arguments are specified. Note that new values by whichever keyword arguments are specified. Note that
\code{tzinfo=None} can be specified to create a naive datetime from \code{tzinfo=None} can be specified to create a naive datetime from
@ -911,7 +913,7 @@ Instance methods:
same as \code{self.date().isocalendar()}. same as \code{self.date().isocalendar()}.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{isoformat}{sep='T'} \begin{methoddesc}{isoformat}{\optional{sep}}
Return a string representing the date and time in ISO 8601 format, Return a string representing the date and time in ISO 8601 format,
YYYY-MM-DDTHH:MM:SS.mmmmmm YYYY-MM-DDTHH:MM:SS.mmmmmm
or, if \member{microsecond} is 0, or, if \member{microsecond} is 0,
@ -967,8 +969,8 @@ Instance methods:
A time object represents a (local) time of day, independent of any A time object represents a (local) time of day, independent of any
particular day, and subject to adjustment via a \class{tzinfo} object. particular day, and subject to adjustment via a \class{tzinfo} object.
\begin{classdesc}{time}{hour=0, minute=0, second=0, microsecond=0, \begin{classdesc}{time}{hour\optional{, minute\optional{, second\optional{,
tzinfo=None} microsecond\optional{, tzinfo}}}}}
All arguments are optional. \var{tzinfo} may be \code{None}, or All arguments are optional. \var{tzinfo} may be \code{None}, or
an instance of a \class{tzinfo} subclass. The remaining arguments an instance of a \class{tzinfo} subclass. The remaining arguments
may be ints or longs, in the following ranges: may be ints or longs, in the following ranges:
@ -981,7 +983,8 @@ particular day, and subject to adjustment via a \class{tzinfo} object.
\end{itemize} \end{itemize}
If an argument outside those ranges is given, If an argument outside those ranges is given,
\exception{ValueError} is raised. \exception{ValueError} is raised. All default to \code{0} except
\var{tzinfo}, which defaults to \constant{None}.
\end{classdesc} \end{classdesc}
Class attributes: Class attributes:
@ -1057,7 +1060,9 @@ Supported operations:
Instance methods: Instance methods:
\begin{methoddesc}{replace}(hour=, minute=, second=, microsecond=, tzinfo=) \begin{methoddesc}{replace}{\optional{hour\optional{, minute\optional{,
second\optional{, microsecond\optional{,
tzinfo}}}}}}
Return a \class{time} with the same value, except for those members given Return a \class{time} with the same value, except for those members given
new values by whichever keyword arguments are specified. Note that new values by whichever keyword arguments are specified. Note that
\code{tzinfo=None} can be specified to create a naive \class{time} from \code{tzinfo=None} can be specified to create a naive \class{time} from
@ -1197,13 +1202,18 @@ implement all of them.
of these two: of these two:
\begin{verbatim} \begin{verbatim}
return timedelta(0) # a fixed-offset class: doesn't account for DST def dst(self):
# a fixed-offset class: doesn't account for DST
return timedelta(0)
\end{verbatim}
or or
# Code to set dston and dstoff to the time zone's DST transition \begin{verbatim}
# times based on the input dt.year, and expressed in standard local def dst(self):
# time. Then # Code to set dston and dstoff to the time zone's DST
# transition times based on the input dt.year, and expressed
# in standard local time. Then
if dston <= dt.replace(tzinfo=None) < dstoff: if dston <= dt.replace(tzinfo=None) < dstoff:
return timedelta(hours=1) return timedelta(hours=1)
@ -1398,4 +1408,3 @@ C standard added additional format codes.
The exact range of years for which \method{strftime()} works also The exact range of years for which \method{strftime()} works also
varies across platforms. Regardless of platform, years before 1900 varies across platforms. Regardless of platform, years before 1900
cannot be used. cannot be used.