chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2811c010-9bb8-4341-94c0-8297a5ff24db | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,644 | supabase-export-v2 | 9448eab58d3234f1 | .. method:: itermonthdays4(year, month)
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a year, a month, a day
of the month, and a day of the week numbers. | trusted_official_docs | CPython Docs | .. method:: itermonthdays4(year, month)
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a year, a month, a day
of the month, and a day of the week numbers. | .. method:: itermonthdays4(year, month)
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a year, a month, a day
of the month, and a day of the week numbers. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
283b293c-9360-4d92-ad7a-d837d9869367 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,812 | supabase-export-v2 | b8a24a45af1411e1 | 20 21 22 23 24 23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31 30 31
The following options are accepted: | trusted_official_docs | CPython Docs | 20 21 22 23 24 23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31 30 31
The following options are accepted: | 20 21 22 23 24 23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31 30 31
The following options are accepted: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2935bd88-0785-4f6e-9e47-71c3e366dd45 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,639 | supabase-export-v2 | 36d3d6883c6868ab | .. method:: itermonthdays2(year, month)
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a day of the month
number and a weekday number. | trusted_official_docs | CPython Docs | .. method:: itermonthdays2(year, month)
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a day of the month
number and a weekday number. | .. method:: itermonthdays2(year, month)
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a day of the month
number and a weekday number. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2e8bfc5c-5125-4c5c-a840-a6b99f31cc59 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,635 | supabase-export-v2 | 8fa93ef292c018f9 | .. method:: itermonthdates(year, month)
Return an iterator for the month *month* (1--12) in the year *year*. This
iterator will return all days (as :class:`datetime.date` objects) for the
month and all days before the start of the month or after the end of the
month that are required to get a complete week. | trusted_official_docs | CPython Docs | .. method:: itermonthdates(year, month)
Return an iterator for the month *month* (1--12) in the year *year*. This
iterator will return all days (as :class:`datetime.date` objects) for the
month and all days before the start of the month or after the end of the
month that are required to get a complete week. | .. method:: itermonthdates(year, month)
Return an iterator for the month *month* (1--12) in the year *year*. This
iterator will return all days (as :class:`datetime.date` objects) for the
month and all days before the start of the month or after the end of the
month that are required to get a complete week. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
392a2d2b-c719-42e2-ab12-3a54d00e820a | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,673 | supabase-export-v2 | e7c4e9111aa4ba7d | the number of lines that each week will use. Depends on the first weekday as specified in the constructor or set by the :meth:`setfirstweekday` method.
.. method:: formatmonthname(theyear, themonth, width=0, withyear=True) | trusted_official_docs | CPython Docs | the number of lines that each week will use. Depends on the first weekday as specified in the constructor or set by the :meth:`setfirstweekday` method.
.. method:: formatmonthname(theyear, themonth, width=0, withyear=True) | the number of lines that each week will use. Depends on the first weekday as specified in the constructor or set by the :meth:`setfirstweekday` method.
.. method:: formatmonthname(theyear, themonth, width=0, withyear=True) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
39e09dca-ece0-45e3-93be-951e03c6dc75 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,622 | supabase-export-v2 | 0478f079048672ce | methods that can be used for preparing the calendar data for formatting. This class doesn't do any formatting itself. This is the job of subclasses.
:class:`Calendar` instances have the following methods and attributes: | trusted_official_docs | CPython Docs | methods that can be used for preparing the calendar data for formatting. This class doesn't do any formatting itself. This is the job of subclasses.
:class:`Calendar` instances have the following methods and attributes: | methods that can be used for preparing the calendar data for formatting. This class doesn't do any formatting itself. This is the job of subclasses.
:class:`Calendar` instances have the following methods and attributes: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3a622562-e88f-4288-b4d5-9c31e85a2171 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,781 | supabase-export-v2 | 0e088a51ae5820bf | .. data:: standalone_month_abbr
A sequence that represents the abbreviated months of the year in the current
locale in the standalone form if the locale provides one. Else it is
equivalent to :data:`month_abbr`. | trusted_official_docs | CPython Docs | .. data:: standalone_month_abbr
A sequence that represents the abbreviated months of the year in the current
locale in the standalone form if the locale provides one. Else it is
equivalent to :data:`month_abbr`. | .. data:: standalone_month_abbr
A sequence that represents the abbreviated months of the year in the current
locale in the standalone form if the locale provides one. Else it is
equivalent to :data:`month_abbr`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
49aa5d81-0467-4089-8d59-38b10f3221dd | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,720 | supabase-export-v2 | 947836a249d0e700 | Here is an example how :class:`!HTMLCalendar` can be customized::
class CustomHTMLCal(calendar.HTMLCalendar):
cssclasses = [style + " text-nowrap" for style in
calendar.HTMLCalendar.cssclasses]
cssclass_month_head = "text-center month-head"
cssclass_month = "text-center month"
cssclass_year = "text-italic lead" | trusted_official_docs | CPython Docs | Here is an example how :class:`!HTMLCalendar` can be customized::
class CustomHTMLCal(calendar.HTMLCalendar):
cssclasses = [style + " text-nowrap" for style in
calendar.HTMLCalendar.cssclasses]
cssclass_month_head = "text-center month-head"
cssclass_month = "text-center month"
cssclass_year = "text-italic lead" | Here is an example how :class:`!HTMLCalendar` can be customized::
class CustomHTMLCal(calendar.HTMLCalendar):
cssclasses = [style + " text-nowrap" for style in
calendar.HTMLCalendar.cssclasses]
cssclass_month_head = "text-center month-head"
cssclass_month = "text-center month"
cssclass_year = "text-italic lead" | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4c56bcde-a0b8-4164-a242-76fe85a60280 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,810 | supabase-export-v2 | 148efb1b9ce8d37a | 26 27 28 19 20 21 22 23 24 25 24 25 26 27 28 29 30 29 30 31 26 27 28 29 30
July August September
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 1 2 3 4 5 6 1 2 3
3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10
10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17
17 18 19 20 21 22 23 21... | trusted_official_docs | CPython Docs | 26 27 28 19 20 21 22 23 24 25 24 25 26 27 28 29 30 29 30 31 26 27 28 29 30
July August September
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 1 2 3 4 5 6 1 2 3
3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10
10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17
17 18 19 20 21 22 23 21... | 26 27 28 19 20 21 22 23 24 25 24 25 26 27 28 29 30 29 30 31 26 27 28 29 30
July August September
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 1 2 3 4 5 6 1 2 3
3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10
10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17
17 18 19 20 21 22 23 21... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4cd3a521-c423-4d6b-87b0-ba588c65aa4a | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,675 | supabase-export-v2 | f63b06c5024c09e3 | is ``True``, include the year in the output. The *theyear* and *themonth* parameters specify the year and month for the name to be formatted respectively.
.. method:: prmonth(theyear, themonth, w=0, l=0) | trusted_official_docs | CPython Docs | is ``True``, include the year in the output. The *theyear* and *themonth* parameters specify the year and month for the name to be formatted respectively.
.. method:: prmonth(theyear, themonth, w=0, l=0) | is ``True``, include the year in the output. The *theyear* and *themonth* parameters specify the year and month for the name to be formatted respectively.
.. method:: prmonth(theyear, themonth, w=0, l=0) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4ef96618-3dfd-4571-b417-494dc78aeb6f | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,689 | supabase-export-v2 | 84da8a0f935cf9de | .. 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
cascading style sheet to be used. :const:`None` can be passed if no style
sheet should be used.... | trusted_official_docs | CPython Docs | .. 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
cascading style sheet to be used. :const:`None` can be passed if no style
sheet should be used.... | .. 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
cascading style sheet to be used. :const:`None` can be passed if no style
sheet should be used.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
534316a1-16af-4650-a730-213432557f03 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,672 | supabase-export-v2 | b602f2a40c4dffd8 | .. 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
given, it specifies the number of lines that each week will use. Depends
on the first weekday as specified in the constr... | trusted_official_docs | CPython Docs | .. 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
given, it specifies the number of lines that each week will use. Depends
on the first weekday as specified in the constr... | .. 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
given, it specifies the number of lines that each week will use. Depends
on the first weekday as specified in the constr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
59081c36-eee9-4874-b1e7-111e6eb1c9b0 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,657 | supabase-export-v2 | 19f3fd7c473684af | .. 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. | trusted_official_docs | CPython Docs | .. 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. | .. 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
59a00436-a0fd-4fb5-a0cc-31b9913d5ccf | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,811 | supabase-export-v2 | 650b27192cc224be | 18 19 20 21 22 23 24 24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30 31
October November December
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 1 2 3 4 5 1 2 3
2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10
9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
16 17 18 19 20 21 22 20 2... | trusted_official_docs | CPython Docs | 18 19 20 21 22 23 24 24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30 31
October November December
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 1 2 3 4 5 1 2 3
2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10
9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
16 17 18 19 20 21 22 20 2... | 18 19 20 21 22 23 24 24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30 31
October November December
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 1 2 3 4 5 1 2 3
2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10
9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
16 17 18 19 20 21 22 20 2... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
62c766a3-8574-4189-b38f-8f0b22a8ae2e | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,674 | supabase-export-v2 | 4a65babadf49fe62 | .. method:: formatmonthname(theyear, themonth, width=0, withyear=True)
Return a string representing the month's name centered within the
specified *width*. If *withyear* is ``True``, include the year in the
output. The *theyear* and *themonth* parameters specify the year
and month for the name to be formatted respec... | trusted_official_docs | CPython Docs | .. method:: formatmonthname(theyear, themonth, width=0, withyear=True)
Return a string representing the month's name centered within the
specified *width*. If *withyear* is ``True``, include the year in the
output. The *theyear* and *themonth* parameters specify the year
and month for the name to be formatted respec... | .. method:: formatmonthname(theyear, themonth, width=0, withyear=True)
Return a string representing the month's name centered within the
specified *width*. If *withyear* is ``True``, include the year in the
output. The *theyear* and *themonth* parameters specify the year
and month for the name to be formatted respec... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
643601b2-de41-4bd8-9157-e69b1499f070 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,692 | supabase-export-v2 | e5ab0fdd2efcf40e | as an HTML table row. If *withyear* is true the year will be included in the row, otherwise just the month name will be used.
:class:`!HTMLCalendar` has the following attributes you can override to
customize the CSS classes used by the calendar: | trusted_official_docs | CPython Docs | as an HTML table row. If *withyear* is true the year will be included in the row, otherwise just the month name will be used.
:class:`!HTMLCalendar` has the following attributes you can override to
customize the CSS classes used by the calendar: | as an HTML table row. If *withyear* is true the year will be included in the row, otherwise just the month name will be used.
:class:`!HTMLCalendar` has the following attributes you can override to
customize the CSS classes used by the calendar: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
674ebc10-d3bc-48e9-8345-b7840e84c5af | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,808 | supabase-export-v2 | 50e8a7a658881295 | $ python -m calendar 2000 2000
January February March
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 1 2 3 4 5 6 1 2 3 4 5
3 4 5 6 7 8 9 7 8 9 10 11 12 13 6 7 8 9 10 11 12
10 11 12 13 14 15 16 14 15 16 17 18 19 20 13 14 15 16 17 18 19
17 18 19 20 21 22 23 21 22 23 24 25 26 27 20 21 22 23 24 25 ... | trusted_official_docs | CPython Docs | $ python -m calendar 2000 2000
January February March
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 1 2 3 4 5 6 1 2 3 4 5
3 4 5 6 7 8 9 7 8 9 10 11 12 13 6 7 8 9 10 11 12
10 11 12 13 14 15 16 14 15 16 17 18 19 20 13 14 15 16 17 18 19
17 18 19 20 21 22 23 21 22 23 24 25 26 27 20 21 22 23 24 25 ... | $ python -m calendar 2000 2000
January February March
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 1 2 3 4 5 6 1 2 3 4 5
3 4 5 6 7 8 9 7 8 9 10 11 12 13 6 7 8 9 10 11 12
10 11 12 13 14 15 16 14 15 16 17 18 19 20 13 14 15 16 17 18 19
17 18 19 20 21 22 23 21 22 23 24 25 26 27 20 21 22 23 24 25 ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
68a02328-14d4-40e7-8bac-a963cea62c5d | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,678 | supabase-export-v2 | e4c5ebb376358b20 | .. method:: formatyear(theyear, 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
week, and number of spaces between month columns, respectively. Depends on
the first weekday as specified in the constr... | trusted_official_docs | CPython Docs | .. method:: formatyear(theyear, 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
week, and number of spaces between month columns, respectively. Depends on
the first weekday as specified in the constr... | .. method:: formatyear(theyear, 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
week, and number of spaces between month columns, respectively. Depends on
the first weekday as specified in the constr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6a014de1-6086-4894-8779-8b71293ead58 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,633 | supabase-export-v2 | 3ab0d3c8971e30e0 | .. method:: iterweekdays()
Return an iterator for the weekday numbers that will be used for one
week. The first value from the iterator will be the same as the value of
the :attr:`~Calendar.firstweekday` property. | trusted_official_docs | CPython Docs | .. method:: iterweekdays()
Return an iterator for the weekday numbers that will be used for one
week. The first value from the iterator will be the same as the value of
the :attr:`~Calendar.firstweekday` property. | .. method:: iterweekdays()
Return an iterator for the weekday numbers that will be used for one
week. The first value from the iterator will be the same as the value of
the :attr:`~Calendar.firstweekday` property. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
712d5a97-8b00-4118-9fd6-65cfa6635df4 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,717 | supabase-export-v2 | 23a7bb083aa0f33d | .. versionadded:: 3.7
Note that although the naming for the above described class attributes is
singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the
single CSS class with a space separated list of CSS classes, for example:: | trusted_official_docs | CPython Docs | .. versionadded:: 3.7
Note that although the naming for the above described class attributes is
singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the
single CSS class with a space separated list of CSS classes, for example:: | .. versionadded:: 3.7
Note that although the naming for the above described class attributes is
singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the
single CSS class with a space separated list of CSS classes, for example:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
726d99e8-dbda-48d5-8216-7ee6df82b366 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,666 | supabase-export-v2 | 723e7581efe7e1bf | .. method:: formatweek(theweek, w=0)
Return a single week in a string with no newline. If *w* is provided, it
specifies the width of the date columns, which are centered. Depends
on the first weekday as specified in the constructor or set by the
:meth:`setfirstweekday` method. | trusted_official_docs | CPython Docs | .. method:: formatweek(theweek, w=0)
Return a single week in a string with no newline. If *w* is provided, it
specifies the width of the date columns, which are centered. Depends
on the first weekday as specified in the constructor or set by the
:meth:`setfirstweekday` method. | .. method:: formatweek(theweek, w=0)
Return a single week in a string with no newline. If *w* is provided, it
specifies the width of the date columns, which are centered. Depends
on the first weekday as specified in the constructor or set by the
:meth:`setfirstweekday` method. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
78a59e32-2cc9-41ad-bf86-e9baae2af69e | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,671 | supabase-export-v2 | 3f53073bd685b032 | of weekday names, formatted with the given *width* for each column. The names depend on the locale settings and are padded to the specified width.
.. method:: formatmonth(theyear, themonth, w=0, l=0) | trusted_official_docs | CPython Docs | of weekday names, formatted with the given *width* for each column. The names depend on the locale settings and are padded to the specified width.
.. method:: formatmonth(theyear, themonth, w=0, l=0) | of weekday names, formatted with the given *width* for each column. The names depend on the locale settings and are padded to the specified width.
.. method:: formatmonth(theyear, themonth, w=0, l=0) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7d5ddeb5-1581-49ef-888a-43d89513551d | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,771 | supabase-export-v2 | c9fd738af5197d64 | .. caution::
In locales with alternative month names forms, the :data:`!month_name` sequence
may not be suitable when a month name stands by itself and not as part of a date. For instance, in Greek and in many Slavic and Baltic languages, :data:`!month_name`
will produce the month in genitive case. Use :data:`standal... | trusted_official_docs | CPython Docs | .. caution::
In locales with alternative month names forms, the :data:`!month_name` sequence
may not be suitable when a month name stands by itself and not as part of a date. For instance, in Greek and in many Slavic and Baltic languages, :data:`!month_name`
will produce the month in genitive case. Use :data:`standal... | .. caution::
In locales with alternative month names forms, the :data:`!month_name` sequence
may not be suitable when a month name stands by itself and not as part of a date. For instance, in Greek and in many Slavic and Baltic languages, :data:`!month_name`
will produce the month in genitive case. Use :data:`standal... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7d8bba08-bc28-42c6-8688-5b496abfe98c | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,745 | supabase-export-v2 | 2156be809e8e8385 | .. function:: monthcalendar(year, month)
Returns a matrix representing a month's calendar. Each row represents a week;
days outside of the month are represented by zeros. Each week begins with Monday
unless set by :func:`setfirstweekday`. | trusted_official_docs | CPython Docs | .. function:: monthcalendar(year, month)
Returns a matrix representing a month's calendar. Each row represents a week;
days outside of the month are represented by zeros. Each week begins with Monday
unless set by :func:`setfirstweekday`. | .. function:: monthcalendar(year, month)
Returns a matrix representing a month's calendar. Each row represents a week;
days outside of the month are represented by zeros. Each week begins with Monday
unless set by :func:`setfirstweekday`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8348d85a-42cb-4682-af9b-72bc42df03d5 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,664 | supabase-export-v2 | b1d4505c04cd6418 | .. method:: formatday(theday, weekday, width)
Return a string representing a single day formatted with the given *width*. If *theday* is ``0``, return a string of spaces of
the specified width, representing an empty day. The *weekday* parameter
is unused. | trusted_official_docs | CPython Docs | .. method:: formatday(theday, weekday, width)
Return a string representing a single day formatted with the given *width*. If *theday* is ``0``, return a string of spaces of
the specified width, representing an empty day. The *weekday* parameter
is unused. | .. method:: formatday(theday, weekday, width)
Return a string representing a single day formatted with the given *width*. If *theday* is ``0``, return a string of spaces of
the specified width, representing an empty day. The *weekday* parameter
is unused. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8589bc27-7480-4536-9939-0f4ba7550d42 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,830 | supabase-export-v2 | c559f82a3cf27855 | of the date column in terminal columns. The date is printed centred in the column. Any value lower than 2 is ignored. Defaults to 2.
.. option:: --lines LINES, -l LINES | trusted_official_docs | CPython Docs | of the date column in terminal columns. The date is printed centred in the column. Any value lower than 2 is ignored. Defaults to 2.
.. option:: --lines LINES, -l LINES | of the date column in terminal columns. The date is printed centred in the column. Any value lower than 2 is ignored. Defaults to 2.
.. option:: --lines LINES, -l LINES | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8bd34c30-ba13-43b0-ac87-0e1fe8af2d47 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,621 | supabase-export-v2 | 95ec4a9d9f566de7 | Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the first day of the week. :const:`MONDAY` is ``0`` (the default), :const:`SUNDAY` is ``6``.
A :class:`Calendar` object provides several methods that can be used for
preparing the calendar data for formatting. This class doesn't do any formatt... | trusted_official_docs | CPython Docs | Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the first day of the week. :const:`MONDAY` is ``0`` (the default), :const:`SUNDAY` is ``6``.
A :class:`Calendar` object provides several methods that can be used for
preparing the calendar data for formatting. This class doesn't do any formatt... | Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the first day of the week. :const:`MONDAY` is ``0`` (the default), :const:`SUNDAY` is ``6``.
A :class:`Calendar` object provides several methods that can be used for
preparing the calendar data for formatting. This class doesn't do any formatt... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8fd1dd4e-89d7-48ec-9141-d149e26cbdbc | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,759 | supabase-export-v2 | 2b2dd3d3bfc9ba86 | A sequence that represents the days of the week in the current locale, where Monday is day number 0.
>>> import calendar
>>> list(calendar.day_name)
['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] | trusted_official_docs | CPython Docs | A sequence that represents the days of the week in the current locale, where Monday is day number 0.
>>> import calendar
>>> list(calendar.day_name)
['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] | A sequence that represents the days of the week in the current locale, where Monday is day number 0.
>>> import calendar
>>> list(calendar.day_name)
['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
90c0f5a3-6cfe-4087-9704-4cb3ea178136 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,774 | supabase-export-v2 | cc18c925af65c1b6 | current locale. This follows normal convention of January being month number 1, so it has a length of 13 and ``month_abbr[0]`` is the empty string.
>>> import calendar
>>> list(calendar.month_abbr)
['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] | trusted_official_docs | CPython Docs | current locale. This follows normal convention of January being month number 1, so it has a length of 13 and ``month_abbr[0]`` is the empty string.
>>> import calendar
>>> list(calendar.month_abbr)
['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] | current locale. This follows normal convention of January being month number 1, so it has a length of 13 and ``month_abbr[0]`` is the empty string.
>>> import calendar
>>> list(calendar.month_abbr)
['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
97677dff-d199-4811-8932-2f9dda8d4c91 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,679 | supabase-export-v2 | 6842bb745e997f2a | first weekday as specified in the constructor or set by the :meth:`setfirstweekday` method. The earliest year for which a calendar can be generated is platform-dependent.
.. method:: pryear(theyear, w=2, l=1, c=6, m=3) | trusted_official_docs | CPython Docs | first weekday as specified in the constructor or set by the :meth:`setfirstweekday` method. The earliest year for which a calendar can be generated is platform-dependent.
.. method:: pryear(theyear, w=2, l=1, c=6, m=3) | first weekday as specified in the constructor or set by the :meth:`setfirstweekday` method. The earliest year for which a calendar can be generated is platform-dependent.
.. method:: pryear(theyear, w=2, l=1, c=6, m=3) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ef60531-29c0-4eea-a818-3b700a707450 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,726 | supabase-export-v2 | 42229c44828d45cd | .. note::
The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods
of these two classes temporarily change the ``LC_TIME`` locale to the given
*locale*. Because the current locale is a process-wide setting, they are
not thread-safe. | trusted_official_docs | CPython Docs | .. note::
The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods
of these two classes temporarily change the ``LC_TIME`` locale to the given
*locale*. Because the current locale is a process-wide setting, they are
not thread-safe. | .. note::
The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods
of these two classes temporarily change the ``LC_TIME`` locale to the given
*locale*. Because the current locale is a process-wide setting, they are
not thread-safe. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f907cbd-77c5-4778-84d0-6d8ad662f8f5 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,829 | supabase-export-v2 | f7e2e915d2cc8cff | .. option:: --width WIDTH, -w WIDTH
The width of the date column in terminal columns. The date is printed centred in the column. Any value lower than 2 is ignored. Defaults to 2. | trusted_official_docs | CPython Docs | .. option:: --width WIDTH, -w WIDTH
The width of the date column in terminal columns. The date is printed centred in the column. Any value lower than 2 is ignored. Defaults to 2. | .. option:: --width WIDTH, -w WIDTH
The width of the date column in terminal columns. The date is printed centred in the column. Any value lower than 2 is ignored. Defaults to 2. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a29373e6-a5d3-4eb6-84bc-1c795576d87e | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,778 | supabase-export-v2 | b1a18593dd25b376 | .. data:: standalone_month_name
A sequence that represents the months of the year in the current locale
in the standalone form if the locale provides one. Else it is equivalent
to :data:`month_name`. | trusted_official_docs | CPython Docs | .. data:: standalone_month_name
A sequence that represents the months of the year in the current locale
in the standalone form if the locale provides one. Else it is equivalent
to :data:`month_name`. | .. data:: standalone_month_name
A sequence that represents the months of the year in the current locale
in the standalone form if the locale provides one. Else it is equivalent
to :data:`month_name`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a3bb7120-6829-4edb-9871-1d24ebb51833 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,839 | supabase-export-v2 | b8ba0b7b21789a4f | .. option:: --css CSS, -c CSS
The path of a CSS stylesheet to use for the calendar. This must either be relative to the generated HTML,
or an absolute HTTP or ``file:///`` URL. | trusted_official_docs | CPython Docs | .. option:: --css CSS, -c CSS
The path of a CSS stylesheet to use for the calendar. This must either be relative to the generated HTML,
or an absolute HTTP or ``file:///`` URL. | .. option:: --css CSS, -c CSS
The path of a CSS stylesheet to use for the calendar. This must either be relative to the generated HTML,
or an absolute HTTP or ``file:///`` URL. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a498eabf-811d-4f88-a5cf-b2b9ca91c78a | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,618 | supabase-export-v2 | b0d1fc8fff4f7e66 | Sunday (6) or to any other weekday. Parameters that specify dates are given as integers. For related functionality, see also the :mod:`datetime` and :mod:`time` modules.
The functions and classes defined in this module
use an idealized calendar, the current Gregorian calendar extended indefinitely
in both directions. T... | trusted_official_docs | CPython Docs | Sunday (6) or to any other weekday. Parameters that specify dates are given as integers. For related functionality, see also the :mod:`datetime` and :mod:`time` modules.
The functions and classes defined in this module
use an idealized calendar, the current Gregorian calendar extended indefinitely
in both directions. T... | Sunday (6) or to any other weekday. Parameters that specify dates are given as integers. For related functionality, see also the :mod:`datetime` and :mod:`time` modules.
The functions and classes defined in this module
use an idealized calendar, the current Gregorian calendar extended indefinitely
in both directions. T... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a64c7b64-dffd-4811-87b8-50d1c8d05966 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,685 | supabase-export-v2 | ee3a6bd63ffdc00c | .. 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. | trusted_official_docs | CPython Docs | .. 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:: 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b0027405-7416-487c-83ac-eeb52a36d178 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,727 | supabase-export-v2 | df57d4fe3895cd6f | of these two classes temporarily change the ``LC_TIME`` locale to the given *locale*. Because the current locale is a process-wide setting, they are not thread-safe.
For simple text calendars this module provides the following functions. | trusted_official_docs | CPython Docs | of these two classes temporarily change the ``LC_TIME`` locale to the given *locale*. Because the current locale is a process-wide setting, they are not thread-safe.
For simple text calendars this module provides the following functions. | of these two classes temporarily change the ``LC_TIME`` locale to the given *locale*. Because the current locale is a process-wide setting, they are not thread-safe.
For simple text calendars this module provides the following functions. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b25ded7a-ea32-4363-bc55-c786434f3369 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,668 | supabase-export-v2 | 3792a5478907d378 | .. method:: formatweekday(weekday, width)
Return a string representing the name of a single weekday formatted to
the specified *width*. The *weekday* parameter is an integer representing
the day of the week, where ``0`` is Monday and ``6`` is Sunday. | trusted_official_docs | CPython Docs | .. method:: formatweekday(weekday, width)
Return a string representing the name of a single weekday formatted to
the specified *width*. The *weekday* parameter is an integer representing
the day of the week, where ``0`` is Monday and ``6`` is Sunday. | .. method:: formatweekday(weekday, width)
Return a string representing the name of a single weekday formatted to
the specified *width*. The *weekday* parameter is an integer representing
the day of the week, where ``0`` is Monday and ``6`` is Sunday. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b27b761b-12b4-42ce-b012-28eef284ab5a | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,755 | supabase-export-v2 | ac760ff797e8832c | .. function:: timegm(tuple)
An unrelated but handy function that takes a time tuple such as returned by
the :func:`~time.gmtime` function in the :mod:`time` module, and returns the
corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX
encoding. In fact, :func:`time.gmtime` and :func:`timegm` a... | trusted_official_docs | CPython Docs | .. function:: timegm(tuple)
An unrelated but handy function that takes a time tuple such as returned by
the :func:`~time.gmtime` function in the :mod:`time` module, and returns the
corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX
encoding. In fact, :func:`time.gmtime` and :func:`timegm` a... | .. function:: timegm(tuple)
An unrelated but handy function that takes a time tuple such as returned by
the :func:`~time.gmtime` function in the :mod:`time` module, and returns the
corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX
encoding. In fact, :func:`time.gmtime` and :func:`timegm` a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b4251489-26be-4b8c-ae58-d79854e324cb | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,617 | supabase-export-v2 | 4cc33f356092910f | --------------
This module allows you to output calendars like the Unix :program:`cal` program,
and provides additional useful functions related to the calendar. By default,
these calendars have Monday as the first day of the week, and Sunday as the last
(the European convention). Use :func:`setfirstweekday` to set the... | trusted_official_docs | CPython Docs | --------------
This module allows you to output calendars like the Unix :program:`cal` program,
and provides additional useful functions related to the calendar. By default,
these calendars have Monday as the first day of the week, and Sunday as the last
(the European convention). Use :func:`setfirstweekday` to set the... | --------------
This module allows you to output calendars like the Unix :program:`cal` program,
and provides additional useful functions related to the calendar. By default,
these calendars have Monday as the first day of the week, and Sunday as the last
(the European convention). Use :func:`setfirstweekday` to set the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b79967b4-0001-48dc-9ec7-bd144c2100fa | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,762 | supabase-export-v2 | b6ac71295ae45969 | A sequence that represents the abbreviated days of the week in the current locale, where Mon is day number 0.
>>> import calendar
>>> list(calendar.day_abbr)
['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] | trusted_official_docs | CPython Docs | A sequence that represents the abbreviated days of the week in the current locale, where Mon is day number 0.
>>> import calendar
>>> list(calendar.day_abbr)
['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] | A sequence that represents the abbreviated days of the week in the current locale, where Mon is day number 0.
>>> import calendar
>>> list(calendar.day_abbr)
['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bb08b8d8-7fbf-45ce-b499-4c87c895d567 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,690 | supabase-export-v2 | b3f271fe7f37e8c3 | used. :const:`None` can be passed if no style sheet should be used. *encoding* specifies the encoding to be used for the output (defaulting to ``'utf-8'``).
.. method:: formatmonthname(theyear, themonth, withyear=True) | trusted_official_docs | CPython Docs | used. :const:`None` can be passed if no style sheet should be used. *encoding* specifies the encoding to be used for the output (defaulting to ``'utf-8'``).
.. method:: formatmonthname(theyear, themonth, withyear=True) | used. :const:`None` can be passed if no style sheet should be used. *encoding* specifies the encoding to be used for the output (defaulting to ``'utf-8'``).
.. method:: formatmonthname(theyear, themonth, withyear=True) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c2cb193d-1cd1-4031-a3a9-e68e59874a20 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,769 | supabase-export-v2 | 12aba6ea7505a1ba | current locale. This follows normal convention of January being month number 1, so it has a length of 13 and ``month_name[0]`` is the empty string.
>>> import calendar
>>> list(calendar.month_name)
['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'Dece... | trusted_official_docs | CPython Docs | current locale. This follows normal convention of January being month number 1, so it has a length of 13 and ``month_name[0]`` is the empty string.
>>> import calendar
>>> list(calendar.month_name)
['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'Dece... | current locale. This follows normal convention of January being month number 1, so it has a length of 13 and ``month_name[0]`` is the empty string.
>>> import calendar
>>> list(calendar.month_name)
['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'Dece... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c6926ab6-381c-4ff3-a7b0-e2baa7590c67 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,791 | supabase-export-v2 | 52e77a6d442f15f0 | A subclass of :exc:`ValueError` and :exc:`IndexError`, raised when the given month number is outside of the range 1-12 (inclusive).
.. versionchanged:: 3.12
:exc:`IllegalMonthError` is now also a subclass of
:exc:`ValueError`. New code should avoid catching
:exc:`IndexError`. | trusted_official_docs | CPython Docs | A subclass of :exc:`ValueError` and :exc:`IndexError`, raised when the given month number is outside of the range 1-12 (inclusive).
.. versionchanged:: 3.12
:exc:`IllegalMonthError` is now also a subclass of
:exc:`ValueError`. New code should avoid catching
:exc:`IndexError`. | A subclass of :exc:`ValueError` and :exc:`IndexError`, raised when the given month number is outside of the range 1-12 (inclusive).
.. versionchanged:: 3.12
:exc:`IllegalMonthError` is now also a subclass of
:exc:`ValueError`. New code should avoid catching
:exc:`IndexError`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cd58046d-cd96-425c-91c6-906771f696ea | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,756 | supabase-export-v2 | 11fef5f623749b47 | and returns the corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each other's inverse.
The :mod:`!calendar` module exports the following data attributes: | trusted_official_docs | CPython Docs | and returns the corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each other's inverse.
The :mod:`!calendar` module exports the following data attributes: | and returns the corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each other's inverse.
The :mod:`!calendar` module exports the following data attributes: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cd6cab3d-7614-494d-bc3e-00ab6ddea5fb | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,805 | supabase-export-v2 | f951fff285a6d430 | python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}] [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS] [-f FIRST_WEEKDAY] [year] [month]
For example, to print a calendar for the year 2000: | trusted_official_docs | CPython Docs | python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}] [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS] [-f FIRST_WEEKDAY] [year] [month]
For example, to print a calendar for the year 2000: | python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}] [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS] [-f FIRST_WEEKDAY] [year] [month]
For example, to print a calendar for the year 2000: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dd04b382-4865-442d-868c-7b303d5e6c9e | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,670 | supabase-export-v2 | 03abe144cd8a9a84 | .. method:: formatweekheader(width)
Return a string containing the header row of weekday names, formatted
with the given *width* for each column. The names depend on the locale
settings and are padded to the specified width. | trusted_official_docs | CPython Docs | .. method:: formatweekheader(width)
Return a string containing the header row of weekday names, formatted
with the given *width* for each column. The names depend on the locale
settings and are padded to the specified width. | .. method:: formatweekheader(width)
Return a string containing the header row of weekday names, formatted
with the given *width* for each column. The names depend on the locale
settings and are padded to the specified width. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e02172e7-e3f7-4f0c-8666-5a86dd3b3090 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,831 | supabase-export-v2 | 9b7b991135d4f799 | .. option:: --lines LINES, -l LINES
The number of lines for each week in terminal rows. The date is printed top-aligned. Any value lower than 1 is ignored. Defaults to 1. | trusted_official_docs | CPython Docs | .. option:: --lines LINES, -l LINES
The number of lines for each week in terminal rows. The date is printed top-aligned. Any value lower than 1 is ignored. Defaults to 1. | .. option:: --lines LINES, -l LINES
The number of lines for each week in terminal rows. The date is printed top-aligned. Any value lower than 1 is ignored. Defaults to 1. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e5137130-81ae-4e61-8a2b-2ae6abb03943 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,729 | supabase-export-v2 | a5b3ffc55eb8437d | .. function:: setfirstweekday(weekday)
Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The
values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`,
:const:`FRIDAY`, :const:`SATURDAY`, and :const:`SUNDAY` are provided for
convenience. For example, to set the first weekd... | trusted_official_docs | CPython Docs | .. function:: setfirstweekday(weekday)
Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The
values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`,
:const:`FRIDAY`, :const:`SATURDAY`, and :const:`SUNDAY` are provided for
convenience. For example, to set the first weekd... | .. function:: setfirstweekday(weekday)
Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The
values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`,
:const:`FRIDAY`, :const:`SATURDAY`, and :const:`SUNDAY` are provided for
convenience. For example, to set the first weekd... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e817d21b-d9c6-4bea-ab57-4b92f1f6befc | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,768 | supabase-export-v2 | 76a6a7bdb2d0ff93 | .. data:: month_name
A sequence that represents the months of the year in the current locale. This
follows normal convention of January being month number 1, so it has a length of
13 and ``month_name[0]`` is the empty string. | trusted_official_docs | CPython Docs | .. data:: month_name
A sequence that represents the months of the year in the current locale. This
follows normal convention of January being month number 1, so it has a length of
13 and ``month_name[0]`` is the empty string. | .. data:: month_name
A sequence that represents the months of the year in the current locale. This
follows normal convention of January being month number 1, so it has a length of
13 and ``month_name[0]`` is the empty string. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f0bdbf57-11bc-42ae-9257-1e4d1ade0c51 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,746 | supabase-export-v2 | 0b2b8c887753b164 | month's calendar. Each row represents a week; days outside of the month are represented by zeros. Each week begins with Monday unless set by :func:`setfirstweekday`.
.. function:: prmonth(theyear, themonth, w=0, l=0) | trusted_official_docs | CPython Docs | month's calendar. Each row represents a week; days outside of the month are represented by zeros. Each week begins with Monday unless set by :func:`setfirstweekday`.
.. function:: prmonth(theyear, themonth, w=0, l=0) | month's calendar. Each row represents a week; days outside of the month are represented by zeros. Each week begins with Monday unless set by :func:`setfirstweekday`.
.. function:: prmonth(theyear, themonth, w=0, l=0) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f20ec37b-4563-49c9-9c06-5bf3a2bdfb91 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,641 | supabase-export-v2 | 47771be7a04f6cff | .. method:: itermonthdays3(year, month)
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a year, a month and a day
of the month numbers. | trusted_official_docs | CPython Docs | .. method:: itermonthdays3(year, month)
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a year, a month and a day
of the month numbers. | .. method:: itermonthdays3(year, month)
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a year, a month and a day
of the month numbers. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ff75b6d0-f126-4c4b-aaf5-7d43dd812125 | CPython Docs | file://datasets/cpython/Doc/library/calendar.rst | unknown | 1a655c14-ac94-44f1-af6a-407c4714cd86 | 13,655 | supabase-export-v2 | beeedca1490bbe7a | .. 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. | trusted_official_docs | CPython Docs | .. 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:: 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
001814c0-7b1c-4336-846e-4647b24722c5 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,914 | supabase-export-v2 | 8c82bec407db8837 | more rich comparison ordering methods, this class decorator supplies the rest. This simplifies the effort involved in specifying all of the possible rich comparison operations:
The class must define one of :meth:`~object.__lt__`, :meth:`~object.__le__`,
:meth:`~object.__gt__`, or :meth:`~object.__ge__`. In addition, t... | trusted_official_docs | CPython Docs | more rich comparison ordering methods, this class decorator supplies the rest. This simplifies the effort involved in specifying all of the possible rich comparison operations:
The class must define one of :meth:`~object.__lt__`, :meth:`~object.__le__`,
:meth:`~object.__gt__`, or :meth:`~object.__ge__`. In addition, t... | more rich comparison ordering methods, this class decorator supplies the rest. This simplifies the effort involved in specifying all of the possible rich comparison operations:
The class must define one of :meth:`~object.__lt__`, :meth:`~object.__le__`,
:meth:`~object.__gt__`, or :meth:`~object.__ge__`. In addition, t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
010069ae-3124-464e-bcc0-bdf0c219a06a | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,982 | supabase-export-v2 | 9965a9e311ed9cee | To check which implementation the generic function will choose for a given type, use the ``dispatch()`` attribute::
>>> fun.dispatch(float)
<function fun_num at 0x1035a2840>
>>> fun.dispatch(dict) # note: default implementation
<function fun at 0x103fe0000> | trusted_official_docs | CPython Docs | To check which implementation the generic function will choose for a given type, use the ``dispatch()`` attribute::
>>> fun.dispatch(float)
<function fun_num at 0x1035a2840>
>>> fun.dispatch(dict) # note: default implementation
<function fun at 0x103fe0000> | To check which implementation the generic function will choose for a given type, use the ``dispatch()`` attribute::
>>> fun.dispatch(float)
<function fun_num at 0x1035a2840>
>>> fun.dispatch(dict) # note: default implementation
<function fun at 0x103fe0000> | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
021070dd-556a-4d18-a538-d1f30e63a9ba | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,873 | supabase-export-v2 | a0689a30c8d2dea9 | .. function:: cmp_to_key(func)
Transform an old-style comparison function to a :term:`key function`. Used
with tools that accept key functions (such as :func:`sorted`, :func:`min`,
:func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`,
:func:`itertools.groupby`). This function is primarily used as a transitio... | trusted_official_docs | CPython Docs | .. function:: cmp_to_key(func)
Transform an old-style comparison function to a :term:`key function`. Used
with tools that accept key functions (such as :func:`sorted`, :func:`min`,
:func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`,
:func:`itertools.groupby`). This function is primarily used as a transitio... | .. function:: cmp_to_key(func)
Transform an old-style comparison function to a :term:`key function`. Used
with tools that accept key functions (such as :func:`sorted`, :func:`min`,
:func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`,
:func:`itertools.groupby`). This function is primarily used as a transitio... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
039e5ebe-a373-4d0e-bed1-348ca76e05b0 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,928 | supabase-export-v2 | ca6cca08498beb03 | arguments are supplied to the call, they are appended to *args*. If additional keyword arguments are supplied, they extend and override *keywords*. Roughly equivalent to::
def partial(func, /, *args, **keywords):
def newfunc(*more_args, **more_keywords):
return func(*args, *more_args, **(keywords | more_keywords))
n... | trusted_official_docs | CPython Docs | arguments are supplied to the call, they are appended to *args*. If additional keyword arguments are supplied, they extend and override *keywords*. Roughly equivalent to::
def partial(func, /, *args, **keywords):
def newfunc(*more_args, **more_keywords):
return func(*args, *more_args, **(keywords | more_keywords))
n... | arguments are supplied to the call, they are appended to *args*. If additional keyword arguments are supplied, they extend and override *keywords*. Roughly equivalent to::
def partial(func, /, *args, **keywords):
def newfunc(*more_args, **more_keywords):
return func(*args, *more_args, **(keywords | more_keywords))
n... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
09d5c2e9-86e2-4465-8fc5-ec0177e42be7 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,994 | supabase-export-v2 | 50349f58072924ef | @neg.register def _(self, arg: bool): return not arg
``@singledispatchmethod`` supports nesting with other decorators such as
:deco:`classmethod`. Note that to allow for
``dispatcher.register``, ``singledispatchmethod`` must be the *outer most*
decorator. Here is the ``Negator`` class with the ``neg`` methods bound ... | trusted_official_docs | CPython Docs | @neg.register def _(self, arg: bool): return not arg
``@singledispatchmethod`` supports nesting with other decorators such as
:deco:`classmethod`. Note that to allow for
``dispatcher.register``, ``singledispatchmethod`` must be the *outer most*
decorator. Here is the ``Negator`` class with the ``neg`` methods bound ... | @neg.register def _(self, arg: bool): return not arg
``@singledispatchmethod`` supports nesting with other decorators such as
:deco:`classmethod`. Note that to allow for
``dispatcher.register``, ``singledispatchmethod`` must be the *outer most*
decorator. Here is the ``Negator`` class with the ``neg`` methods bound ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0ba6e6d4-39e3-45bf-8d1b-ffdf188d7fdd | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,975 | supabase-export-v2 | 327c7ddb93ad0d8b | The :func:`~singledispatch.register` attribute returns the undecorated function. This enables decorator stacking, :mod:`pickling<pickle>`, and the creation of unit tests for each variant independently::
>>> @fun.register(float)
... @fun.register(Decimal)
... def fun_num(arg, verbose=False):
... if verbose:
... prin... | trusted_official_docs | CPython Docs | The :func:`~singledispatch.register` attribute returns the undecorated function. This enables decorator stacking, :mod:`pickling<pickle>`, and the creation of unit tests for each variant independently::
>>> @fun.register(float)
... @fun.register(Decimal)
... def fun_num(arg, verbose=False):
... if verbose:
... prin... | The :func:`~singledispatch.register` attribute returns the undecorated function. This enables decorator stacking, :mod:`pickling<pickle>`, and the creation of unit tests for each variant independently::
>>> @fun.register(float)
... @fun.register(Decimal)
... def fun_num(arg, verbose=False):
... if verbose:
... prin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0d0ee235-dc33-4930-9ddf-8a8b11c8ecea | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,866 | supabase-export-v2 | 84e09edf3d0cf0c4 | The cached value can be cleared by deleting the attribute. This allows the *cached_property* method to run again.
The *cached_property* does not prevent a possible race condition in
multi-threaded usage. The getter function could run more than once on the
same instance, with the latest run setting the cached value. I... | trusted_official_docs | CPython Docs | The cached value can be cleared by deleting the attribute. This allows the *cached_property* method to run again.
The *cached_property* does not prevent a possible race condition in
multi-threaded usage. The getter function could run more than once on the
same instance, with the latest run setting the cached value. I... | The cached value can be cleared by deleting the attribute. This allows the *cached_property* method to run again.
The *cached_property* does not prevent a possible race condition in
multi-threaded usage. The getter function could run more than once on the
same instance, with the latest run setting the cached value. I... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0d7de4a1-714a-43bb-a07e-5c8a880d2dbc | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,898 | supabase-export-v2 | 57f1b2407d6475cd | If a method is cached, the ``self`` instance argument is included in the cache. See :ref:`faq-cache-method-calls`
An `LRU (least recently used) cache
<https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_(LRU)>`_
works best when the most recent calls are the best predictors of upcoming
calls ... | trusted_official_docs | CPython Docs | If a method is cached, the ``self`` instance argument is included in the cache. See :ref:`faq-cache-method-calls`
An `LRU (least recently used) cache
<https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_(LRU)>`_
works best when the most recent calls are the best predictors of upcoming
calls ... | If a method is cached, the ``self`` instance argument is included in the cache. See :ref:`faq-cache-method-calls`
An `LRU (least recently used) cache
<https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_(LRU)>`_
works best when the most recent calls are the best predictors of upcoming
calls ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0fcce44d-a79a-4cce-8752-21e7c358a5ca | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,916 | supabase-export-v2 | 816a140e5d5be066 | For example::
@total_ordering
class Student:
def _is_valid_operand(self, other):
return (hasattr(other, "lastname") and
hasattr(other, "firstname"))
def __eq__(self, other):
if not self._is_valid_operand(other):
return NotImplemented
return ((self.lastname.lower(), self.firstname.lower()) ==
(other.lastname.lo... | trusted_official_docs | CPython Docs | For example::
@total_ordering
class Student:
def _is_valid_operand(self, other):
return (hasattr(other, "lastname") and
hasattr(other, "firstname"))
def __eq__(self, other):
if not self._is_valid_operand(other):
return NotImplemented
return ((self.lastname.lower(), self.firstname.lower()) ==
(other.lastname.lo... | For example::
@total_ordering
class Student:
def _is_valid_operand(self, other):
return (hasattr(other, "lastname") and
hasattr(other, "firstname"))
def __eq__(self, other):
if not self._is_valid_operand(other):
return NotImplemented
return ((self.lastname.lower(), self.firstname.lower()) ==
(other.lastname.lo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
122e941d-6ea9-4865-b4b6-68b1cbd181dd | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,929 | supabase-export-v2 | 85f4cf58dda41a8a | def partial(func, /, *args, **keywords): def newfunc(*more_args, **more_keywords): return func(*args, *more_args, **(keywords | more_keywords)) newfunc.func = func newfunc.args = args newfunc.keywords = keywords return newfunc
The :func:`!partial` function is used for partial function application which "freezes"
some ... | trusted_official_docs | CPython Docs | def partial(func, /, *args, **keywords): def newfunc(*more_args, **more_keywords): return func(*args, *more_args, **(keywords | more_keywords)) newfunc.func = func newfunc.args = args newfunc.keywords = keywords return newfunc
The :func:`!partial` function is used for partial function application which "freezes"
some ... | def partial(func, /, *args, **keywords): def newfunc(*more_args, **more_keywords): return func(*args, *more_args, **(keywords | more_keywords)) newfunc.func = func newfunc.args = args newfunc.keywords = keywords return newfunc
The :func:`!partial` function is used for partial function application which "freezes"
some ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13456345-82cc-481f-89cb-6d52f0b9b6fe | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,881 | supabase-export-v2 | bb077accdedf5291 | up to the *maxsize* most recent calls. It can save time when an expensive or I/O bound function is periodically called with the same arguments.
The cache is threadsafe so that the wrapped function can be used in
multiple threads. This means that the underlying data structure will
remain coherent during concurrent upd... | trusted_official_docs | CPython Docs | up to the *maxsize* most recent calls. It can save time when an expensive or I/O bound function is periodically called with the same arguments.
The cache is threadsafe so that the wrapped function can be used in
multiple threads. This means that the underlying data structure will
remain coherent during concurrent upd... | up to the *maxsize* most recent calls. It can save time when an expensive or I/O bound function is periodically called with the same arguments.
The cache is threadsafe so that the wrapped function can be used in
multiple threads. This means that the underlying data structure will
remain coherent during concurrent upd... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
15a4af52-0ca9-4e85-9621-86a7c39a8680 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,900 | supabase-export-v2 | 6c1d9a03510c2ff0 | functions that need to create distinct mutable objects on each call (such as generators and async functions), or impure functions such as time() or random().
Example of an LRU cache for static web content:: | trusted_official_docs | CPython Docs | functions that need to create distinct mutable objects on each call (such as generators and async functions), or impure functions such as time() or random().
Example of an LRU cache for static web content:: | functions that need to create distinct mutable objects on each call (such as generators and async functions), or impure functions such as time() or random().
Example of an LRU cache for static web content:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a93e871-4656-42a4-a8fd-4a973fcfca71 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,968 | supabase-export-v2 | a40abca970b28ad1 | >>> @fun.register(complex) ... def _(arg, verbose=False): ... if verbose: ... print("Better than complicated.", end=" ") ... print(arg.real, arg.imag) ...
For code that dispatches on a collections type (e.g., ``list``), but wants
to typehint the items of the collection (e.g., ``list[int]``), the
dispatch type should ... | trusted_official_docs | CPython Docs | >>> @fun.register(complex) ... def _(arg, verbose=False): ... if verbose: ... print("Better than complicated.", end=" ") ... print(arg.real, arg.imag) ...
For code that dispatches on a collections type (e.g., ``list``), but wants
to typehint the items of the collection (e.g., ``list[int]``), the
dispatch type should ... | >>> @fun.register(complex) ... def _(arg, verbose=False): ... if verbose: ... print("Better than complicated.", end=" ") ... print(arg.real, arg.imag) ...
For code that dispatches on a collections type (e.g., ``list``), but wants
to typehint the items of the collection (e.g., ``list[int]``), the
dispatch type should ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1edec477-b887-414d-a83d-0dc134d58c9f | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,902 | supabase-export-v2 | 0afee1d2e1814b71 | @lru_cache(maxsize=32) def get_pep(num): 'Retrieve text of a Python Enhancement Proposal' resource = f'https://peps.python.org/pep-{num:04d}' try: with urllib.request.urlopen(resource) as s: return s.read() except urllib.error.HTTPError: return 'Not Found'
>>> for n in 8, 290, 308, 320, 8, 218, 320, 279, 289, 320, 9991... | trusted_official_docs | CPython Docs | @lru_cache(maxsize=32) def get_pep(num): 'Retrieve text of a Python Enhancement Proposal' resource = f'https://peps.python.org/pep-{num:04d}' try: with urllib.request.urlopen(resource) as s: return s.read() except urllib.error.HTTPError: return 'Not Found'
>>> for n in 8, 290, 308, 320, 8, 218, 320, 279, 289, 320, 9991... | @lru_cache(maxsize=32) def get_pep(num): 'Retrieve text of a Python Enhancement Proposal' resource = f'https://peps.python.org/pep-{num:04d}' try: with urllib.request.urlopen(resource) as s: return s.read() except urllib.error.HTTPError: return 'Not Found'
>>> for n in 8, 290, 308, 320, 8, 218, 320, 279, 289, 320, 9991... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
232c9330-d1f9-47b7-af76-bd94c5d8188f | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,859 | supabase-export-v2 | 3583e402e766ad81 | .. decorator:: cached_property(func)
Transform a method of a class into a property whose value is computed once
and then cached as a normal attribute for the life of the instance. Similar
to :func:`property`, with the addition of caching. Useful for expensive
computed properties of instances that are otherwise effec... | trusted_official_docs | CPython Docs | .. decorator:: cached_property(func)
Transform a method of a class into a property whose value is computed once
and then cached as a normal attribute for the life of the instance. Similar
to :func:`property`, with the addition of caching. Useful for expensive
computed properties of instances that are otherwise effec... | .. decorator:: cached_property(func)
Transform a method of a class into a property whose value is computed once
and then cached as a normal attribute for the life of the instance. Similar
to :func:`property`, with the addition of caching. Useful for expensive
computed properties of instances that are otherwise effec... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24bacae6-2983-4b53-91d3-6b0189ad44ea | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,886 | supabase-export-v2 | a0e39ff7d1bb2645 | be a callable. This allows the *lru_cache* decorator to be applied directly to a user function, leaving the *maxsize* at its default value of 128::
@lru_cache
def count_vowels(word):
return sum(word.count(vowel) for vowel in 'AEIOUaeiou') | trusted_official_docs | CPython Docs | be a callable. This allows the *lru_cache* decorator to be applied directly to a user function, leaving the *maxsize* at its default value of 128::
@lru_cache
def count_vowels(word):
return sum(word.count(vowel) for vowel in 'AEIOUaeiou') | be a callable. This allows the *lru_cache* decorator to be applied directly to a user function, leaving the *maxsize* at its default value of 128::
@lru_cache
def count_vowels(word):
return sum(word.count(vowel) for vowel in 'AEIOUaeiou') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2baea59d-5830-44d7-824a-eda1eac99c8a | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,892 | supabase-export-v2 | 3e0b23dd0ca7c168 | .. method:: lru_cache.cache_info() :no-typesetting:
To help measure the effectiveness of the cache and tune the *maxsize*
parameter, the wrapped function is instrumented with a :func:`!cache_info`
function that returns a :term:`named tuple` showing *hits*, *misses*,
*maxsize* and *currsize*. | trusted_official_docs | CPython Docs | .. method:: lru_cache.cache_info() :no-typesetting:
To help measure the effectiveness of the cache and tune the *maxsize*
parameter, the wrapped function is instrumented with a :func:`!cache_info`
function that returns a :term:`named tuple` showing *hits*, *misses*,
*maxsize* and *currsize*. | .. method:: lru_cache.cache_info() :no-typesetting:
To help measure the effectiveness of the cache and tune the *maxsize*
parameter, the wrapped function is instrumented with a :func:`!cache_info`
function that returns a :term:`named tuple` showing *hits*, *misses*,
*maxsize* and *currsize*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2ee74f06-52a8-4312-a7f1-b30b69a17f51 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,855 | supabase-export-v2 | f4b2236955ab5ecc | threadsafe so that the wrapped function can be used in multiple threads. This means that the underlying data structure will remain coherent during concurrent updates.
It is possible for the wrapped function to be called more than once if
another thread makes an additional call before the initial call has been
complet... | trusted_official_docs | CPython Docs | threadsafe so that the wrapped function can be used in multiple threads. This means that the underlying data structure will remain coherent during concurrent updates.
It is possible for the wrapped function to be called more than once if
another thread makes an additional call before the initial call has been
complet... | threadsafe so that the wrapped function can be used in multiple threads. This means that the underlying data structure will remain coherent during concurrent updates.
It is possible for the wrapped function to be called more than once if
another thread makes an additional call before the initial call has been
complet... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
339b0047-421c-42d9-a424-3dd7ab6cab87 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,981 | supabase-export-v2 | 2897ea8b5b174b14 | verbose=False): ... if verbose: ... print("Keys & Values") ... for key, value in arg.items(): ... print(key, "=>", value) ... >>> fun({"a": "b"}) a => b
To check which implementation the generic function will choose for
a given type, use the ``dispatch()`` attribute:: | trusted_official_docs | CPython Docs | verbose=False): ... if verbose: ... print("Keys & Values") ... for key, value in arg.items(): ... print(key, "=>", value) ... >>> fun({"a": "b"}) a => b
To check which implementation the generic function will choose for
a given type, use the ``dispatch()`` attribute:: | verbose=False): ... if verbose: ... print("Keys & Values") ... for key, value in arg.items(): ... print(key, "=>", value) ... >>> fun({"a": "b"}) a => b
To check which implementation the generic function will choose for
a given type, use the ``dispatch()`` attribute:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
340f654f-90ac-4298-8662-26b61c15fc63 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,847 | supabase-export-v2 | 2ba0fb807da7a8b1 | functions that act on or return other functions. In general, any callable object can be treated as a function for the purposes of this module.
The :mod:`!functools` module defines the following functions: | trusted_official_docs | CPython Docs | functions that act on or return other functions. In general, any callable object can be treated as a function for the purposes of this module.
The :mod:`!functools` module defines the following functions: | functions that act on or return other functions. In general, any callable object can be treated as a function for the purposes of this module.
The :mod:`!functools` module defines the following functions: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35021c7f-2a5f-4101-9e7d-87ac450be0b9 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,906 | supabase-export-v2 | 425b2bb494eb6ea6 | @lru_cache(maxsize=None) def fib(n): if n < 2: return n return fib(n-1) + fib(n-2)
>>> [fib(n) for n in range(16)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610] | trusted_official_docs | CPython Docs | @lru_cache(maxsize=None) def fib(n): if n < 2: return n return fib(n-1) + fib(n-2)
>>> [fib(n) for n in range(16)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610] | @lru_cache(maxsize=None) def fib(n): if n < 2: return n return fib(n-1) + fib(n-2)
>>> [fib(n) for n in range(16)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3936dbc4-58cc-40b8-af3e-31d0b8413d65 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,959 | supabase-export-v2 | 0f78fb55c4c78e6e | Transform a function into a :term:`single-dispatch <single dispatch>` :term:`generic function`.
To define a generic function, decorate it with the ``@singledispatch``
decorator. When defining a function using ``@singledispatch``, note that the
dispatch happens on the type of the first argument:: | trusted_official_docs | CPython Docs | Transform a function into a :term:`single-dispatch <single dispatch>` :term:`generic function`.
To define a generic function, decorate it with the ``@singledispatch``
decorator. When defining a function using ``@singledispatch``, note that the
dispatch happens on the type of the first argument:: | Transform a function into a :term:`single-dispatch <single dispatch>` :term:`generic function`.
To define a generic function, decorate it with the ``@singledispatch``
decorator. When defining a function using ``@singledispatch``, note that the
dispatch happens on the type of the first argument:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3a2ffead-c5ff-4850-9a71-f85323ad920a | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,951 | supabase-export-v2 | 05fac2f3dd0b4841 | .. function:: reduce(function, iterable, /[, initial])
Apply *function* of two arguments cumulatively to the items of *iterable*, from
left to right, so as to reduce the iterable to a single value. For example,
``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` calculates ``((((1+2)+3)+4)+5)``. The left argument, *x*, is ... | trusted_official_docs | CPython Docs | .. function:: reduce(function, iterable, /[, initial])
Apply *function* of two arguments cumulatively to the items of *iterable*, from
left to right, so as to reduce the iterable to a single value. For example,
``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` calculates ``((((1+2)+3)+4)+5)``. The left argument, *x*, is ... | .. function:: reduce(function, iterable, /[, initial])
Apply *function* of two arguments cumulatively to the items of *iterable*, from
left to right, so as to reduce the iterable to a single value. For example,
``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` calculates ``((((1+2)+3)+4)+5)``. The left argument, *x*, is ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4078655b-677e-4574-b185-87d540729c24 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,002 | supabase-export-v2 | 278304442b2bcb61 | .. function:: update_wrapper(wrapper, wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)
Update a *wrapper* function to look like the *wrapped* function. The optional
arguments are tuples to specify which attributes of the original function are
assigned directly to the matching attributes on the wrapper ... | trusted_official_docs | CPython Docs | .. function:: update_wrapper(wrapper, wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)
Update a *wrapper* function to look like the *wrapped* function. The optional
arguments are tuples to specify which attributes of the original function are
assigned directly to the matching attributes on the wrapper ... | .. function:: update_wrapper(wrapper, wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES)
Update a *wrapper* function to look like the *wrapped* function. The optional
arguments are tuples to specify which attributes of the original function are
assigned directly to the matching attributes on the wrapper ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4383d637-040c-412a-b1fd-a982e544ab04 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,927 | supabase-export-v2 | 47ef89b97a3ab010 | .. function:: partial(func, /, *args, **keywords)
Return a new :ref:`partial object<partial-objects>` which when called
will behave like *func* called with the positional arguments *args*
and keyword arguments *keywords*. If more arguments are supplied to the
call, they are appended to *args*. If additional keyword ... | trusted_official_docs | CPython Docs | .. function:: partial(func, /, *args, **keywords)
Return a new :ref:`partial object<partial-objects>` which when called
will behave like *func* called with the positional arguments *args*
and keyword arguments *keywords*. If more arguments are supplied to the
call, they are appended to *args*. If additional keyword ... | .. function:: partial(func, /, *args, **keywords)
Return a new :ref:`partial object<partial-objects>` which when called
will behave like *func* called with the positional arguments *args*
and keyword arguments *keywords*. If more arguments are supplied to the
call, they are appended to *args*. If additional keyword ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4a68cc98-5b60-4d09-87d4-c8fe3e847207 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,871 | supabase-export-v2 | 9f11c580978dbb78 | .. versionadded:: 3.8
.. versionchanged:: 3.12
Prior to Python 3.12, ``cached_property`` included an undocumented lock to
ensure that in multi-threaded usage the getter function was guaranteed to
run only once per instance. However, the lock was per-property, not
per-instance, which could result in unacceptably hig... | trusted_official_docs | CPython Docs | .. versionadded:: 3.8
.. versionchanged:: 3.12
Prior to Python 3.12, ``cached_property`` included an undocumented lock to
ensure that in multi-threaded usage the getter function was guaranteed to
run only once per instance. However, the lock was per-property, not
per-instance, which could result in unacceptably hig... | .. versionadded:: 3.8
.. versionchanged:: 3.12
Prior to Python 3.12, ``cached_property`` included an undocumented lock to
ensure that in multi-threaded usage the getter function was guaranteed to
run only once per instance. However, the lock was per-property, not
per-instance, which could result in unacceptably hig... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4f4f24b4-2f67-4976-85bf-0804dd3d765d | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,899 | supabase-export-v2 | b8d7acb471d1cd30 | tend to change each day). The cache's size limit assures that the cache does not grow without bound on long-running processes such as web servers.
In general, the LRU cache should only be used when you want to reuse
previously computed values. Accordingly, it doesn't make sense to cache
functions with side-effects, f... | trusted_official_docs | CPython Docs | tend to change each day). The cache's size limit assures that the cache does not grow without bound on long-running processes such as web servers.
In general, the LRU cache should only be used when you want to reuse
previously computed values. Accordingly, it doesn't make sense to cache
functions with side-effects, f... | tend to change each day). The cache's size limit assures that the cache does not grow without bound on long-running processes such as web servers.
In general, the LRU cache should only be used when you want to reuse
previously computed values. Accordingly, it doesn't make sense to cache
functions with side-effects, f... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4ffb65a5-4da6-483b-aaf7-598b29079301 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,948 | supabase-export-v2 | c17c3d7792f293ac | Example::
>>> class Cell:
... def __init__(self):
... self._alive = False
... @property
... def alive(self):
... return self._alive
... def set_state(self, state):
... self._alive = bool(state)
... set_alive = partialmethod(set_state, True)
... set_dead = partialmethod(set_state, False)
... >>> c = Cell()
>>... | trusted_official_docs | CPython Docs | Example::
>>> class Cell:
... def __init__(self):
... self._alive = False
... @property
... def alive(self):
... return self._alive
... def set_state(self, state):
... self._alive = bool(state)
... set_alive = partialmethod(set_state, True)
... set_dead = partialmethod(set_state, False)
... >>> c = Cell()
>>... | Example::
>>> class Cell:
... def __init__(self):
... self._alive = False
... @property
... def alive(self):
... return self._alive
... def set_state(self, state):
... self._alive = bool(state)
... set_alive = partialmethod(set_state, True)
... set_dead = partialmethod(set_state, False)
... >>> c = Cell()
>>... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
516f08ca-c832-4ec7-86c0-8e5e085f465c | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,971 | supabase-export-v2 | f0dd4369cd35fc6c | .. note::
At runtime the function will dispatch on an instance of a list regardless
of the type contained within the list i.e. ``[1,2,3]`` will be
dispatched the same as ``["foo", "bar", "baz"]``. The annotation
provided in this example is for static type checkers only and has no
runtime impact. | trusted_official_docs | CPython Docs | .. note::
At runtime the function will dispatch on an instance of a list regardless
of the type contained within the list i.e. ``[1,2,3]`` will be
dispatched the same as ``["foo", "bar", "baz"]``. The annotation
provided in this example is for static type checkers only and has no
runtime impact. | .. note::
At runtime the function will dispatch on an instance of a list regardless
of the type contained within the list i.e. ``[1,2,3]`` will be
dispatched the same as ``["foo", "bar", "baz"]``. The annotation
provided in this example is for static type checkers only and has no
runtime impact. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
53c5b42b-2b85-46fa-bd51-d209bee76993 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,863 | supabase-export-v2 | 9fbe45cc05040f07 | @cached_property def stdev(self): return statistics.stdev(self._data)
The mechanics of :func:`cached_property` are somewhat different from
:func:`property`. A regular property blocks attribute writes unless a
setter is defined. In contrast, a *cached_property* allows writes. | trusted_official_docs | CPython Docs | @cached_property def stdev(self): return statistics.stdev(self._data)
The mechanics of :func:`cached_property` are somewhat different from
:func:`property`. A regular property blocks attribute writes unless a
setter is defined. In contrast, a *cached_property* allows writes. | @cached_property def stdev(self): return statistics.stdev(self._data)
The mechanics of :func:`cached_property` are somewhat different from
:func:`property`. A regular property blocks attribute writes unless a
setter is defined. In contrast, a *cached_property* allows writes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
54266ae0-2021-4a40-92f6-5106f773435f | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,867 | supabase-export-v2 | 2ba578754eb602d5 | on an instance, this is fine. If synchronization is needed, implement the necessary locking inside the decorated getter function or around the cached property access.
Note, this decorator interferes with the operation of :pep:`412`
key-sharing dictionaries. This means that instance dictionaries
can take more space th... | trusted_official_docs | CPython Docs | on an instance, this is fine. If synchronization is needed, implement the necessary locking inside the decorated getter function or around the cached property access.
Note, this decorator interferes with the operation of :pep:`412`
key-sharing dictionaries. This means that instance dictionaries
can take more space th... | on an instance, this is fine. If synchronization is needed, implement the necessary locking inside the decorated getter function or around the cached property access.
Note, this decorator interferes with the operation of :pep:`412`
key-sharing dictionaries. This means that instance dictionaries
can take more space th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
591d838d-06e1-4a54-a509-8feac7373bae | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,896 | supabase-export-v2 | f703afdacb019885 | function is accessible through the :attr:`__wrapped__` attribute. This is useful for introspection, for bypassing the cache, or for rewrapping the function with a different cache.
The cache keeps references to the arguments and return values until they age
out of the cache or until the cache is cleared. | trusted_official_docs | CPython Docs | function is accessible through the :attr:`__wrapped__` attribute. This is useful for introspection, for bypassing the cache, or for rewrapping the function with a different cache.
The cache keeps references to the arguments and return values until they age
out of the cache or until the cache is cleared. | function is accessible through the :attr:`__wrapped__` attribute. This is useful for introspection, for bypassing the cache, or for rewrapping the function with a different cache.
The cache keeps references to the arguments and return values until they age
out of the cache or until the cache is cleared. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5a5188ed-6321-469d-bf8c-9f0909c8e1de | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,890 | supabase-export-v2 | c9223caa553ccaca | ``Decimal(42)`` and ``Fraction(42)`` are treated as distinct calls with distinct results. In contrast, the tuple arguments ``('answer', Decimal(42))`` and ``('answer', Fraction(42))`` are treated as equivalent.
The wrapped function is instrumented with a :func:`!cache_parameters`
function that returns a new :class:`di... | trusted_official_docs | CPython Docs | ``Decimal(42)`` and ``Fraction(42)`` are treated as distinct calls with distinct results. In contrast, the tuple arguments ``('answer', Decimal(42))`` and ``('answer', Fraction(42))`` are treated as equivalent.
The wrapped function is instrumented with a :func:`!cache_parameters`
function that returns a new :class:`di... | ``Decimal(42)`` and ``Fraction(42)`` are treated as distinct calls with distinct results. In contrast, the tuple arguments ``('answer', Decimal(42))`` and ``('answer', Fraction(42))`` are treated as equivalent.
The wrapped function is instrumented with a :func:`!cache_parameters`
function that returns a new :class:`di... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5d218896-cca2-4ea3-a4c0-61ab4e60b8c6 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,885 | supabase-export-v2 | b23853ca519497a0 | calls with separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)`` differ in their keyword argument order and may have two separate cache entries.
If *user_function* is specified, it must be a callable. This allows the
*lru_cache* decorator to be applied directly to a user function, leaving
the *maxs... | trusted_official_docs | CPython Docs | calls with separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)`` differ in their keyword argument order and may have two separate cache entries.
If *user_function* is specified, it must be a callable. This allows the
*lru_cache* decorator to be applied directly to a user function, leaving
the *maxs... | calls with separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)`` differ in their keyword argument order and may have two separate cache entries.
If *user_function* is specified, it must be a callable. This allows the
*lru_cache* decorator to be applied directly to a user function, leaving
the *maxs... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6178e20d-49db-4fde-af80-8580e32983dd | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,965 | supabase-export-v2 | be3e1126406bf27f | :class:`typing.Union` can also be used::
>>> @fun.register
... def _(arg: int | float, verbose=False):
... if verbose:
... print("Strength in numbers, eh?", end=" ")
... print(arg)
... >>> from typing import Union
>>> @fun.register
... def _(arg: Union[list, set], verbose=False):
... if verbose:
... print("Enu... | trusted_official_docs | CPython Docs | :class:`typing.Union` can also be used::
>>> @fun.register
... def _(arg: int | float, verbose=False):
... if verbose:
... print("Strength in numbers, eh?", end=" ")
... print(arg)
... >>> from typing import Union
>>> @fun.register
... def _(arg: Union[list, set], verbose=False):
... if verbose:
... print("Enu... | :class:`typing.Union` can also be used::
>>> @fun.register
... def _(arg: int | float, verbose=False):
... if verbose:
... print("Strength in numbers, eh?", end=" ")
... print(arg)
... >>> from typing import Union
>>> @fun.register
... def _(arg: Union[list, set], verbose=False):
... if verbose:
... print("Enu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6a829529-11f7-48db-8ae0-849cebe216ca | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,954 | supabase-export-v2 | 90b17fdcbb66087b | initial_missing = sentinel('initial_missing')
def reduce(function, iterable, /, initial=initial_missing):
it = iter(iterable)
if initial is initial_missing:
value = next(it)
else:
value = initial
for element in it:
value = function(value, element)
return value | trusted_official_docs | CPython Docs | initial_missing = sentinel('initial_missing')
def reduce(function, iterable, /, initial=initial_missing):
it = iter(iterable)
if initial is initial_missing:
value = next(it)
else:
value = initial
for element in it:
value = function(value, element)
return value | initial_missing = sentinel('initial_missing')
def reduce(function, iterable, /, initial=initial_missing):
it = iter(iterable)
if initial is initial_missing:
value = next(it)
else:
value = initial
for element in it:
value = function(value, element)
return value | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6b0e3e47-3b2b-4c5a-a03d-4a4277d4e665 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,960 | supabase-export-v2 | 5e79a6c7e88d20c0 | function, decorate it with the ``@singledispatch`` decorator. When defining a function using ``@singledispatch``, note that the dispatch happens on the type of the first argument::
>>> from functools import singledispatch
>>> @singledispatch
... def fun(arg, verbose=False):
... if verbose:
... print("Let me just sa... | trusted_official_docs | CPython Docs | function, decorate it with the ``@singledispatch`` decorator. When defining a function using ``@singledispatch``, note that the dispatch happens on the type of the first argument::
>>> from functools import singledispatch
>>> @singledispatch
... def fun(arg, verbose=False):
... if verbose:
... print("Let me just sa... | function, decorate it with the ``@singledispatch`` decorator. When defining a function using ``@singledispatch``, note that the dispatch happens on the type of the first argument::
>>> from functools import singledispatch
>>> @singledispatch
... def fun(arg, verbose=False):
... if verbose:
... print("Let me just sa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6ff9a2ef-599b-4789-b797-c06d4d6cdde3 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,846 | supabase-export-v2 | 66f408725c60b5c4 | --------------
The :mod:`!functools` module is for higher-order functions: functions that act on
or return other functions. In general, any callable object can be treated as a
function for the purposes of this module. | trusted_official_docs | CPython Docs | --------------
The :mod:`!functools` module is for higher-order functions: functions that act on
or return other functions. In general, any callable object can be treated as a
function for the purposes of this module. | --------------
The :mod:`!functools` module is for higher-order functions: functions that act on
or return other functions. In general, any callable object can be treated as a
function for the purposes of this module. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
713452f9-922f-4581-9cd6-6fe922e0daef | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,976 | supabase-export-v2 | b449be76e243c8ea | @fun.register(Decimal) ... def fun_num(arg, verbose=False): ... if verbose: ... print("Half of your number:", end=" ") ... print(arg / 2) ... >>> fun_num is fun False
When called, the generic function dispatches on the type of the first
argument:: | trusted_official_docs | CPython Docs | @fun.register(Decimal) ... def fun_num(arg, verbose=False): ... if verbose: ... print("Half of your number:", end=" ") ... print(arg / 2) ... >>> fun_num is fun False
When called, the generic function dispatches on the type of the first
argument:: | @fun.register(Decimal) ... def fun_num(arg, verbose=False): ... if verbose: ... print("Half of your number:", end=" ") ... print(arg / 2) ... >>> fun_num is fun False
When called, the generic function dispatches on the type of the first
argument:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
723d3ada-eb8a-47d8-b2e4-bc6ddb7402d6 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 14,005 | supabase-export-v2 | d254ee3a0e3e187f | not updated, the metadata of the returned function will reflect the wrapper definition rather than the original function definition, which is typically less than helpful.
:func:`update_wrapper` may be used with callables other than functions. Any
attributes named in *assigned* or *updated* that are missing from the ob... | trusted_official_docs | CPython Docs | not updated, the metadata of the returned function will reflect the wrapper definition rather than the original function definition, which is typically less than helpful.
:func:`update_wrapper` may be used with callables other than functions. Any
attributes named in *assigned* or *updated* that are missing from the ob... | not updated, the metadata of the returned function will reflect the wrapper definition rather than the original function definition, which is typically less than helpful.
:func:`update_wrapper` may be used with callables other than functions. Any
attributes named in *assigned* or *updated* that are missing from the ob... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
75d462d7-0fdb-4b31-87e5-dc6e9703c9a5 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,854 | supabase-export-v2 | 3f1735ac700f62e6 | calls 3628800 >>> factorial(5) # no new calls, just returns the cached result 120 >>> factorial(12) # two new recursive calls, factorial(10) is cached 479001600
The cache is threadsafe so that the wrapped function can be used in
multiple threads. This means that the underlying data structure will
remain coherent duri... | trusted_official_docs | CPython Docs | calls 3628800 >>> factorial(5) # no new calls, just returns the cached result 120 >>> factorial(12) # two new recursive calls, factorial(10) is cached 479001600
The cache is threadsafe so that the wrapped function can be used in
multiple threads. This means that the underlying data structure will
remain coherent duri... | calls 3628800 >>> factorial(5) # no new calls, just returns the cached result 120 >>> factorial(12) # two new recursive calls, factorial(10) is cached 479001600
The cache is threadsafe so that the wrapped function can be used in
multiple threads. This means that the underlying data structure will
remain coherent duri... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7d045d40-67d7-4d38-95a4-9e746bb47ffc | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,979 | supabase-export-v2 | 26802c1a381b15d5 | implementation. The original function decorated with ``@singledispatch`` is registered for the base :class:`object` type, which means it is used if no better implementation is found.
If an implementation is registered to an :term:`abstract base class`,
virtual subclasses of the base class will be dispatched to that
i... | trusted_official_docs | CPython Docs | implementation. The original function decorated with ``@singledispatch`` is registered for the base :class:`object` type, which means it is used if no better implementation is found.
If an implementation is registered to an :term:`abstract base class`,
virtual subclasses of the base class will be dispatched to that
i... | implementation. The original function decorated with ``@singledispatch`` is registered for the base :class:`object` type, which means it is used if no better implementation is found.
If an implementation is registered to an :term:`abstract base class`,
virtual subclasses of the base class will be dispatched to that
i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7da8ff2b-10eb-465e-9773-0d4c300883c0 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,889 | supabase-export-v2 | 2ae8fdf1f2744b3b | as equivalent calls and only cache a single result. (Some types such as *str* and *int* may be cached separately even when *typed* is false.)
Note, type specificity applies only to the function's immediate arguments
rather than their contents. The scalar arguments, ``Decimal(42)`` and
``Fraction(42)`` are treated as ... | trusted_official_docs | CPython Docs | as equivalent calls and only cache a single result. (Some types such as *str* and *int* may be cached separately even when *typed* is false.)
Note, type specificity applies only to the function's immediate arguments
rather than their contents. The scalar arguments, ``Decimal(42)`` and
``Fraction(42)`` are treated as ... | as equivalent calls and only cache a single result. (Some types such as *str* and *int* may be cached separately even when *typed* is false.)
Note, type specificity applies only to the function's immediate arguments
rather than their contents. The scalar arguments, ``Decimal(42)`` and
``Fraction(42)`` are treated as ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7e25b80d-2f4e-45fc-af90-30e5e8e7583d | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,933 | supabase-export-v2 | f72fc3b68be4a63e | it possible to pre-fill any positional argument with a call to :func:`!partial`; without :data:`!Placeholder`, only the chosen number of leading positional arguments can be pre-filled.
If any :data:`!Placeholder` sentinels are present, all must be filled at call time: | trusted_official_docs | CPython Docs | it possible to pre-fill any positional argument with a call to :func:`!partial`; without :data:`!Placeholder`, only the chosen number of leading positional arguments can be pre-filled.
If any :data:`!Placeholder` sentinels are present, all must be filled at call time: | it possible to pre-fill any positional argument with a call to :func:`!partial`; without :data:`!Placeholder`, only the chosen number of leading positional arguments can be pre-filled.
If any :data:`!Placeholder` sentinels are present, all must be filled at call time: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80783486-1763-41c7-8230-1a5bfebd3f10 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,918 | supabase-export-v2 | 373c316ab4e63fbd | .. note::
While this decorator makes it easy to create well behaved totally
ordered types, it *does* come at the cost of slower execution and
more complex stack traces for the derived comparison methods. If
performance benchmarking indicates this is a bottleneck for a given
application, implementing all six rich co... | trusted_official_docs | CPython Docs | .. note::
While this decorator makes it easy to create well behaved totally
ordered types, it *does* come at the cost of slower execution and
more complex stack traces for the derived comparison methods. If
performance benchmarking indicates this is a bottleneck for a given
application, implementing all six rich co... | .. note::
While this decorator makes it easy to create well behaved totally
ordered types, it *does* come at the cost of slower execution and
more complex stack traces for the derived comparison methods. If
performance benchmarking indicates this is a bottleneck for a given
application, implementing all six rich co... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
83b3457e-3fbd-4bc3-8d3d-63f887430c19 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,888 | supabase-export-v2 | 858049e168ca7a79 | If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can grow without bound.
If *typed* is set to true, function arguments of different types will be
cached separately. If *typed* is false, the implementation will usually
regard them as equivalent calls and only cache a single result. (Some
typ... | trusted_official_docs | CPython Docs | If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can grow without bound.
If *typed* is set to true, function arguments of different types will be
cached separately. If *typed* is false, the implementation will usually
regard them as equivalent calls and only cache a single result. (Some
typ... | If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can grow without bound.
If *typed* is set to true, function arguments of different types will be
cached separately. If *typed* is false, the implementation will usually
regard them as equivalent calls and only cache a single result. (Some
typ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
83d51ff0-c993-45fc-8fb1-19e2f7101bd5 | CPython Docs | file://datasets/cpython/Doc/library/functools.rst | unknown | 16769ae6-b0f9-433b-a4e1-642e1ce3ad7a | 13,984 | supabase-export-v2 | 6b55580ce2082231 | To access all registered implementations, use the read-only ``registry`` attribute::
>>> fun.registry.keys()
dict_keys([<class 'NoneType'>, <class 'int'>, <class 'object'>,
<class 'decimal.Decimal'>, <class 'list'>,
<class 'float'>])
>>> fun.registry[float]
<function fun_num at 0x1035a2840>
>>> fun.registry[objec... | trusted_official_docs | CPython Docs | To access all registered implementations, use the read-only ``registry`` attribute::
>>> fun.registry.keys()
dict_keys([<class 'NoneType'>, <class 'int'>, <class 'object'>,
<class 'decimal.Decimal'>, <class 'list'>,
<class 'float'>])
>>> fun.registry[float]
<function fun_num at 0x1035a2840>
>>> fun.registry[objec... | To access all registered implementations, use the read-only ``registry`` attribute::
>>> fun.registry.keys()
dict_keys([<class 'NoneType'>, <class 'int'>, <class 'object'>,
<class 'decimal.Decimal'>, <class 'list'>,
<class 'float'>])
>>> fun.registry[float]
<function fun_num at 0x1035a2840>
>>> fun.registry[objec... | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.