diff options
author | Georg Brandl <georg@python.org> | 2009-04-05 22:20:44 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-05 22:20:44 (GMT) |
commit | 0d8f07305d7ddcf684c3db5680263c98cf70c067 (patch) | |
tree | 8862b638d9b3e98ce030044765e9231333821f94 /Doc/library/calendar.rst | |
parent | 889b0aa4506d5ea43985865a44562ebd39b3bf00 (diff) | |
download | cpython-0d8f07305d7ddcf684c3db5680263c98cf70c067.zip cpython-0d8f07305d7ddcf684c3db5680263c98cf70c067.tar.gz cpython-0d8f07305d7ddcf684c3db5680263c98cf70c067.tar.bz2 |
Update signature style of optional arguments, part two.
Diffstat (limited to 'Doc/library/calendar.rst')
-rw-r--r-- | Doc/library/calendar.rst | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/Doc/library/calendar.rst b/Doc/library/calendar.rst index d575228..1cf958c 100644 --- a/Doc/library/calendar.rst +++ b/Doc/library/calendar.rst @@ -1,10 +1,9 @@ - :mod:`calendar` --- General calendar-related functions ====================================================== .. module:: calendar - :synopsis: Functions for working with calendars, including some emulation of the Unix cal - program. + :synopsis: Functions for working with calendars, including some emulation + of the Unix cal program. .. sectionauthor:: Drew Csillag <drew_csillag@geocities.com> @@ -23,7 +22,7 @@ calendar in Dershowitz and Reingold's book "Calendrical Calculations", where it's the base calendar for all computations. -.. class:: Calendar([firstweekday]) +.. class:: Calendar(firstweekday=0) Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the first day of the week. ``0`` is Monday (the default), ``6`` is Sunday. @@ -82,7 +81,7 @@ it's the base calendar for all computations. weeks. Weeks are lists of seven day numbers. - .. method:: yeardatescalendar(year[, width]) + .. method:: yeardatescalendar(year, width=3) Return the data for the specified year ready for formatting. The return value is a list of month rows. Each month row contains up to *width* @@ -90,28 +89,27 @@ it's the base calendar for all computations. each week contains 1--7 days. Days are :class:`datetime.date` objects. - .. method:: yeardays2calendar(year[, width]) + .. method:: yeardays2calendar(year, width=3) Return the data for the specified year ready for formatting (similar to :meth:`yeardatescalendar`). Entries in the week lists are tuples of day numbers and weekday numbers. Day numbers outside this month are zero. - .. method:: yeardayscalendar(year[, width]) + .. method:: yeardayscalendar(year, width=3) Return the data for the specified year ready for formatting (similar to :meth:`yeardatescalendar`). Entries in the week lists are day numbers. Day numbers outside this month are zero. -.. class:: TextCalendar([firstweekday]) +.. class:: TextCalendar(firstweekday=0) This class can be used to generate plain text calendars. - :class:`TextCalendar` instances have the following methods: - .. method:: formatmonth(theyear, themonth[, w[, l]]) + .. method:: formatmonth(theyear, themonth, w=0, l=0) Return a month's calendar in a multi-line string. If *w* is provided, it specifies the width of the date columns, which are centered. If *l* is @@ -120,12 +118,12 @@ it's the base calendar for all computations. :meth:`setfirstweekday` method. - .. method:: prmonth(theyear, themonth[, w[, l]]) + .. method:: prmonth(theyear, themonth, w=0, l=0) Print a month's calendar as returned by :meth:`formatmonth`. - .. method:: formatyear(theyear, themonth[, w[, l[, c[, m]]]]) + .. method:: formatyear(theyear, themonth, w=2, l=1, c=6, m=3) Return a *m*-column calendar for an entire year as a multi-line string. Optional parameters *w*, *l*, and *c* are for date column width, lines per @@ -135,32 +133,32 @@ it's the base calendar for all computations. can be generated is platform-dependent. - .. method:: pryear(theyear[, w[, l[, c[, m]]]]) + .. method:: pryear(theyear, w=2, l=1, c=6, m=3) Print the calendar for an entire year as returned by :meth:`formatyear`. -.. class:: HTMLCalendar([firstweekday]) +.. class:: HTMLCalendar(firstweekday=0) This class can be used to generate HTML calendars. :class:`HTMLCalendar` instances have the following methods: - .. method:: formatmonth(theyear, themonth[, withyear]) + .. method:: formatmonth(theyear, themonth, withyear=True) Return a month's calendar as an HTML table. If *withyear* is true the year will be included in the header, otherwise just the month name will be used. - .. method:: formatyear(theyear, themonth[, width]) + .. method:: formatyear(theyear, themonth, width=3) Return a year's calendar as an HTML table. *width* (defaulting to 3) specifies the number of months per row. - .. method:: formatyearpage(theyear[, width[, css[, encoding]]]) + .. method:: formatyearpage(theyear, width=3, css='calendar.css', encoding=None) Return a year's calendar as a complete HTML page. *width* (defaulting to 3) specifies the number of months per row. *css* is the name for the @@ -169,7 +167,7 @@ it's the base calendar for all computations. output (defaulting to the system default encoding). -.. class:: LocaleTextCalendar([firstweekday[, locale]]) +.. class:: LocaleTextCalendar(firstweekday=0, locale=None) This subclass of :class:`TextCalendar` can be passed a locale name in the constructor and will return month and weekday names in the specified @@ -177,7 +175,7 @@ it's the base calendar for all computations. weekday names will be returned as unicode. -.. class:: LocaleHTMLCalendar([firstweekday[, locale]]) +.. class:: LocaleHTMLCalendar(firstweekday=0, locale=None) This subclass of :class:`HTMLCalendar` can be passed a locale name in the constructor and will return month and weekday names in the specified @@ -241,26 +239,26 @@ For simple text calendars this module provides the following functions. unless set by :func:`setfirstweekday`. -.. function:: prmonth(theyear, themonth[, w[, l]]) +.. function:: prmonth(theyear, themonth, w=0, l=0) Prints a month's calendar as returned by :func:`month`. -.. function:: month(theyear, themonth[, w[, l]]) +.. function:: month(theyear, themonth, w=0, l=0) Returns a month's calendar in a multi-line string using the :meth:`formatmonth` of the :class:`TextCalendar` class. -.. function:: prcal(year[, w[, l[c]]]) +.. function:: prcal(year, w=0, l=0, c=6, m=3) Prints the calendar for an entire year as returned by :func:`calendar`. -.. function:: calendar(year[, w[, l[c]]]) +.. function:: calendar(year, w=2, l=1, c=6, m=3) - Returns a 3-column calendar for an entire year as a multi-line string using the - :meth:`formatyear` of the :class:`TextCalendar` class. + Returns a 3-column calendar for an entire year as a multi-line string using + the :meth:`formatyear` of the :class:`TextCalendar` class. .. function:: timegm(tuple) |