| 
									
										
										
										
											2008-04-10 03:06:53 +00:00
										 |  |  | # -*- coding: utf-8 -*- | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  |     pyspecific.py | 
					
						
							|  |  |  |     ~~~~~~~~~~~~~ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Sphinx extension with Python doc-specific markup. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-21 19:20:31 +01:00
										 |  |  |     :copyright: 2008-2014 by Georg Brandl. | 
					
						
							| 
									
										
										
										
											2008-04-10 03:06:53 +00:00
										 |  |  |     :license: Python license. | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | import re | 
					
						
							| 
									
										
										
										
											2017-06-16 08:59:01 +02:00
										 |  |  | import io | 
					
						
							| 
									
										
										
										
											2018-12-19 18:20:06 -08:00
										 |  |  | from os import getenv, path | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | from time import asctime | 
					
						
							|  |  |  | from pprint import pformat | 
					
						
							| 
									
										
										
										
											2023-06-23 08:58:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | from docutils import nodes, utils | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | from docutils.io import StringOutput | 
					
						
							| 
									
										
										
										
											2017-07-15 15:28:02 -04:00
										 |  |  | from docutils.parsers.rst import Directive | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | from docutils.utils import new_document | 
					
						
							|  |  |  | from sphinx import addnodes | 
					
						
							|  |  |  | from sphinx.builders import Builder | 
					
						
							| 
									
										
										
										
											2023-06-23 08:58:45 +01:00
										 |  |  | from sphinx.domains.python import PyFunction, PyMethod | 
					
						
							|  |  |  | from sphinx.errors import NoUri | 
					
						
							| 
									
										
										
										
											2022-11-11 09:18:11 +08:00
										 |  |  | from sphinx.locale import _ as sphinx_gettext | 
					
						
							| 
									
										
										
										
											2023-06-23 08:58:45 +01:00
										 |  |  | from sphinx.util import logging | 
					
						
							| 
									
										
										
										
											2023-02-12 15:20:11 +01:00
										 |  |  | from sphinx.util.docutils import SphinxDirective | 
					
						
							| 
									
										
										
										
											2018-04-16 22:56:46 -07:00
										 |  |  | from sphinx.writers.text import TextWriter, TextTranslator | 
					
						
							| 
									
										
										
										
											2024-04-26 13:10:16 +03:00
										 |  |  | from sphinx.util.display import status_iterator | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-11 17:59:35 +02:00
										 |  |  | ISSUE_URI = 'https://bugs.python.org/issue?@action=redirect&bpo=%s' | 
					
						
							| 
									
										
										
										
											2022-04-25 12:05:54 +02:00
										 |  |  | GH_ISSUE_URI = 'https://github.com/python/cpython/issues/%s' | 
					
						
							| 
									
										
										
										
											2024-04-15 21:22:00 +03:00
										 |  |  | # Used in conf.py and updated here by python/release-tools/run_release.py | 
					
						
							| 
									
										
										
										
											2024-05-08 11:10:41 +02:00
										 |  |  | SOURCE_URI = 'https://github.com/python/cpython/tree/3.13/%s' | 
					
						
							| 
									
										
										
										
											2008-04-10 03:06:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 69129-69131,69139-69140,69143,69154-69159,69169,69288-69289,69293,69297-69301,69348 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r69129 | benjamin.peterson | 2009-01-30 19:42:55 -0600 (Fri, 30 Jan 2009) | 1 line
  check the errno in bad fd cases
........
  r69130 | andrew.kuchling | 2009-01-30 20:50:09 -0600 (Fri, 30 Jan 2009) | 1 line
  Add a section
........
  r69131 | andrew.kuchling | 2009-01-30 21:26:02 -0600 (Fri, 30 Jan 2009) | 1 line
  Text edits and markup fixes
........
  r69139 | mark.dickinson | 2009-01-31 10:44:04 -0600 (Sat, 31 Jan 2009) | 2 lines
  Add an extra test for long <-> float hash equivalence.
........
  r69140 | benjamin.peterson | 2009-01-31 10:52:03 -0600 (Sat, 31 Jan 2009) | 1 line
  PyErr_BadInternalCall() raises a SystemError, not TypeError #5112
........
  r69143 | benjamin.peterson | 2009-01-31 15:00:10 -0600 (Sat, 31 Jan 2009) | 1 line
  I believe the intention here was to avoid a global lookup
........
  r69154 | benjamin.peterson | 2009-01-31 16:33:02 -0600 (Sat, 31 Jan 2009) | 1 line
  fix indentation in comment
........
  r69155 | david.goodger | 2009-01-31 16:53:46 -0600 (Sat, 31 Jan 2009) | 1 line
  markup fix
........
  r69156 | gregory.p.smith | 2009-01-31 16:57:30 -0600 (Sat, 31 Jan 2009) | 4 lines
  - Issue #5104: The socket module now raises OverflowError when 16-bit port and
    protocol numbers are supplied outside the allowed 0-65536 range on bind()
    and getservbyport().
........
  r69157 | benjamin.peterson | 2009-01-31 17:43:25 -0600 (Sat, 31 Jan 2009) | 1 line
  add explanatory comment
........
  r69158 | benjamin.peterson | 2009-01-31 17:54:38 -0600 (Sat, 31 Jan 2009) | 1 line
  more flags which only work for function blocks
........
  r69159 | gregory.p.smith | 2009-01-31 18:16:01 -0600 (Sat, 31 Jan 2009) | 2 lines
  Update doc wording as suggested in issue4903.
........
  r69169 | guilherme.polo | 2009-01-31 20:56:16 -0600 (Sat, 31 Jan 2009) | 3 lines
  Restore Tkinter.Tk._loadtk so this test doesn't fail for problems
  related to ttk.
........
  r69288 | georg.brandl | 2009-02-05 04:30:57 -0600 (Thu, 05 Feb 2009) | 1 line
  #5153: fix typo in example.
........
  r69289 | georg.brandl | 2009-02-05 04:37:07 -0600 (Thu, 05 Feb 2009) | 1 line
  #5144: document that PySys_SetArgv prepends the script directory (or the empty string) to sys.path.
........
  r69293 | georg.brandl | 2009-02-05 04:59:28 -0600 (Thu, 05 Feb 2009) | 1 line
  #5059: fix example.
........
  r69297 | georg.brandl | 2009-02-05 05:32:18 -0600 (Thu, 05 Feb 2009) | 1 line
  #5015: document PythonHome API functions.
........
  r69298 | georg.brandl | 2009-02-05 05:33:21 -0600 (Thu, 05 Feb 2009) | 1 line
  #4827: fix callback example.
........
  r69299 | georg.brandl | 2009-02-05 05:35:28 -0600 (Thu, 05 Feb 2009) | 1 line
  #4820: use correct module for ctypes.util.
........
  r69300 | georg.brandl | 2009-02-05 05:38:23 -0600 (Thu, 05 Feb 2009) | 1 line
  #4563: disable alpha and roman lists, fixes wrong formatting of contributor list.
........
  r69301 | georg.brandl | 2009-02-05 05:40:35 -0600 (Thu, 05 Feb 2009) | 1 line
  #5031: fix Thread.daemon property docs.
........
  r69348 | benjamin.peterson | 2009-02-05 19:47:31 -0600 (Thu, 05 Feb 2009) | 1 line
  fix download link
........
											
										 
											2009-02-06 02:40:07 +00:00
										 |  |  | # monkey-patch reST parser to disable alphabetic and roman enumerated lists | 
					
						
							|  |  |  | from docutils.parsers.rst.states import Body | 
					
						
							|  |  |  | Body.enum.converters['loweralpha'] = \ | 
					
						
							|  |  |  |     Body.enum.converters['upperalpha'] = \ | 
					
						
							|  |  |  |     Body.enum.converters['lowerroman'] = \ | 
					
						
							|  |  |  |     Body.enum.converters['upperroman'] = lambda x: None | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-08 21:47:59 -05:00
										 |  |  | # monkey-patch the productionlist directive to allow hyphens in group names | 
					
						
							|  |  |  | # https://github.com/sphinx-doc/sphinx/issues/11854 | 
					
						
							|  |  |  | from sphinx.domains import std | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | std.token_re = re.compile(r'`((~?[\w-]*:)?\w+)`') | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-15 21:22:00 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
  Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
........
  r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
  Fix markup.
........
  r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
  #7125: fix typo.
........
  r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
  #7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
  r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
  #7116: str.join() takes an iterable.
........
  r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
  Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
  r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
  Fix missing word.
........
  r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
  Fix punctuation.
........
  r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
  Revert unintended change.
........
  r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
  Fix markup.
........
  r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
  Fix duplicate target.
........
  r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
  Add a new directive marking up implementation details and start using it.
........
  r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
  Make it more robust.
........
  r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
  Document new directive.
........
  r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
  Allow short form with text as argument.
........
  r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
  Fix stylesheet for multi-paragraph impl-details.
........
  r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
  Use "impl-detail" directive where applicable.
........
  r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
  #6324: membership test tries iteration via __iter__.
........
  r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
  #7088: document new functions in signal as Unix-only.
........
  r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
  Reorder __slots__ fine print and add a clarification.
........
  r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
  #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
  r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
  #7156: document curses as Unix-only.
........
  r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
  #6977: getopt does not support optional option arguments.
........
  r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
  Add proper references.
........
  r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
  Make printout margin important.
........
  r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
  #7188: fix optionxform() docs.
........
  r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
  add further note about what's passed to optionxform
........
  r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
  Improve some docstrings in the 'warnings' module.
........
  r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
  Fix markup.
........
  r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
  Fix a demo.
........
  r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
  Fix a strange mis-edit.
........
											
										 
											2009-10-27 15:28:25 +00:00
										 |  |  | # Support for marking up and linking to bugs.python.org issues | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-10 03:06:53 +00:00
										 |  |  | def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): | 
					
						
							|  |  |  |     issue = utils.unescape(text) | 
					
						
							| 
									
										
										
										
											2022-04-25 12:05:54 +02:00
										 |  |  |     # sanity check: there are no bpo issues within these two values | 
					
						
							|  |  |  |     if 47261 < int(issue) < 400000: | 
					
						
							|  |  |  |         msg = inliner.reporter.error(f'The BPO ID {text!r} seems too high -- ' | 
					
						
							|  |  |  |                                      'use :gh:`...` for GitHub IDs', line=lineno) | 
					
						
							|  |  |  |         prb = inliner.problematic(rawtext, rawtext, msg) | 
					
						
							|  |  |  |         return [prb], [msg] | 
					
						
							| 
									
										
										
										
											2017-02-10 15:10:13 -08:00
										 |  |  |     text = 'bpo-' + issue | 
					
						
							| 
									
										
										
										
											2008-04-10 03:06:53 +00:00
										 |  |  |     refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue) | 
					
						
							|  |  |  |     return [refnode], [] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-25 12:05:54 +02:00
										 |  |  | # Support for marking up and linking to GitHub issues | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def gh_issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): | 
					
						
							|  |  |  |     issue = utils.unescape(text) | 
					
						
							|  |  |  |     # sanity check: all GitHub issues have ID >= 32426 | 
					
						
							|  |  |  |     # even though some of them are also valid BPO IDs | 
					
						
							|  |  |  |     if int(issue) < 32426: | 
					
						
							|  |  |  |         msg = inliner.reporter.error(f'The GitHub ID {text!r} seems too low -- ' | 
					
						
							|  |  |  |                                      'use :issue:`...` for BPO IDs', line=lineno) | 
					
						
							|  |  |  |         prb = inliner.problematic(rawtext, rawtext, msg) | 
					
						
							|  |  |  |         return [prb], [msg] | 
					
						
							|  |  |  |     text = 'gh-' + issue | 
					
						
							|  |  |  |     refnode = nodes.reference(text, text, refuri=GH_ISSUE_URI % issue) | 
					
						
							|  |  |  |     return [refnode], [] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
  Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
........
  r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
  Fix markup.
........
  r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
  #7125: fix typo.
........
  r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
  #7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
  r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
  #7116: str.join() takes an iterable.
........
  r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
  Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
  r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
  Fix missing word.
........
  r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
  Fix punctuation.
........
  r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
  Revert unintended change.
........
  r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
  Fix markup.
........
  r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
  Fix duplicate target.
........
  r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
  Add a new directive marking up implementation details and start using it.
........
  r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
  Make it more robust.
........
  r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
  Document new directive.
........
  r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
  Allow short form with text as argument.
........
  r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
  Fix stylesheet for multi-paragraph impl-details.
........
  r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
  Use "impl-detail" directive where applicable.
........
  r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
  #6324: membership test tries iteration via __iter__.
........
  r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
  #7088: document new functions in signal as Unix-only.
........
  r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
  Reorder __slots__ fine print and add a clarification.
........
  r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
  #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
  r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
  #7156: document curses as Unix-only.
........
  r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
  #6977: getopt does not support optional option arguments.
........
  r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
  Add proper references.
........
  r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
  Make printout margin important.
........
  r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
  #7188: fix optionxform() docs.
........
  r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
  add further note about what's passed to optionxform
........
  r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
  Improve some docstrings in the 'warnings' module.
........
  r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
  Fix markup.
........
  r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
  Fix a demo.
........
  r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
  Fix a strange mis-edit.
........
											
										 
											2009-10-27 15:28:25 +00:00
										 |  |  | # Support for marking up implementation details | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ImplementationDetail(Directive): | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     has_content = True | 
					
						
							|  |  |  |     final_argument_whitespace = True | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-08 19:07:13 +09:00
										 |  |  |     # This text is copied to templates/dummy.html | 
					
						
							| 
									
										
										
										
											2023-08-06 14:10:50 +09:00
										 |  |  |     label_text = sphinx_gettext('CPython implementation detail:') | 
					
						
							| 
									
										
										
										
											2017-03-08 19:07:13 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
  Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
........
  r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
  Fix markup.
........
  r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
  #7125: fix typo.
........
  r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
  #7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
  r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
  #7116: str.join() takes an iterable.
........
  r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
  Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
  r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
  Fix missing word.
........
  r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
  Fix punctuation.
........
  r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
  Revert unintended change.
........
  r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
  Fix markup.
........
  r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
  Fix duplicate target.
........
  r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
  Add a new directive marking up implementation details and start using it.
........
  r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
  Make it more robust.
........
  r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
  Document new directive.
........
  r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
  Allow short form with text as argument.
........
  r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
  Fix stylesheet for multi-paragraph impl-details.
........
  r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
  Use "impl-detail" directive where applicable.
........
  r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
  #6324: membership test tries iteration via __iter__.
........
  r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
  #7088: document new functions in signal as Unix-only.
........
  r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
  Reorder __slots__ fine print and add a clarification.
........
  r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
  #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
  r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
  #7156: document curses as Unix-only.
........
  r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
  #6977: getopt does not support optional option arguments.
........
  r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
  Add proper references.
........
  r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
  Make printout margin important.
........
  r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
  #7188: fix optionxform() docs.
........
  r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
  add further note about what's passed to optionxform
........
  r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
  Improve some docstrings in the 'warnings' module.
........
  r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
  Fix markup.
........
  r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
  Fix a demo.
........
  r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
  Fix a strange mis-edit.
........
											
										 
											2009-10-27 15:28:25 +00:00
										 |  |  |     def run(self): | 
					
						
							| 
									
										
										
										
											2022-10-02 00:20:17 -05:00
										 |  |  |         self.assert_has_content() | 
					
						
							| 
									
										
											  
											
												Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
  Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
........
  r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
  Fix markup.
........
  r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
  #7125: fix typo.
........
  r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
  #7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
  r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
  #7116: str.join() takes an iterable.
........
  r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
  Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
  r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
  Fix missing word.
........
  r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
  Fix punctuation.
........
  r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
  Revert unintended change.
........
  r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
  Fix markup.
........
  r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
  Fix duplicate target.
........
  r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
  Add a new directive marking up implementation details and start using it.
........
  r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
  Make it more robust.
........
  r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
  Document new directive.
........
  r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
  Allow short form with text as argument.
........
  r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
  Fix stylesheet for multi-paragraph impl-details.
........
  r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
  Use "impl-detail" directive where applicable.
........
  r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
  #6324: membership test tries iteration via __iter__.
........
  r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
  #7088: document new functions in signal as Unix-only.
........
  r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
  Reorder __slots__ fine print and add a clarification.
........
  r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
  #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
  r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
  #7156: document curses as Unix-only.
........
  r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
  #6977: getopt does not support optional option arguments.
........
  r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
  Add proper references.
........
  r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
  Make printout margin important.
........
  r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
  #7188: fix optionxform() docs.
........
  r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
  add further note about what's passed to optionxform
........
  r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
  Improve some docstrings in the 'warnings' module.
........
  r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
  Fix markup.
........
  r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
  Fix a demo.
........
  r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
  Fix a strange mis-edit.
........
											
										 
											2009-10-27 15:28:25 +00:00
										 |  |  |         pnode = nodes.compound(classes=['impl-detail']) | 
					
						
							|  |  |  |         content = self.content | 
					
						
							| 
									
										
										
										
											2023-08-06 14:10:50 +09:00
										 |  |  |         add_text = nodes.strong(self.label_text, self.label_text) | 
					
						
							| 
									
										
											  
											
												Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
  Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
........
  r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
  Fix markup.
........
  r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
  #7125: fix typo.
........
  r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
  #7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
  r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
  #7116: str.join() takes an iterable.
........
  r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
  Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
  r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
  Fix missing word.
........
  r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
  Fix punctuation.
........
  r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
  Revert unintended change.
........
  r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
  Fix markup.
........
  r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
  Fix duplicate target.
........
  r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
  Add a new directive marking up implementation details and start using it.
........
  r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
  Make it more robust.
........
  r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
  Document new directive.
........
  r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
  Allow short form with text as argument.
........
  r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
  Fix stylesheet for multi-paragraph impl-details.
........
  r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
  Use "impl-detail" directive where applicable.
........
  r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
  #6324: membership test tries iteration via __iter__.
........
  r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
  #7088: document new functions in signal as Unix-only.
........
  r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
  Reorder __slots__ fine print and add a clarification.
........
  r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
  #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
  r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
  #7156: document curses as Unix-only.
........
  r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
  #6977: getopt does not support optional option arguments.
........
  r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
  Add proper references.
........
  r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
  Make printout margin important.
........
  r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
  #7188: fix optionxform() docs.
........
  r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
  add further note about what's passed to optionxform
........
  r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
  Improve some docstrings in the 'warnings' module.
........
  r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
  Fix markup.
........
  r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
  Fix a demo.
........
  r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
  Fix a strange mis-edit.
........
											
										 
											2009-10-27 15:28:25 +00:00
										 |  |  |         self.state.nested_parse(content, self.content_offset, pnode) | 
					
						
							| 
									
										
										
										
											2022-10-02 00:20:17 -05:00
										 |  |  |         content = nodes.inline(pnode[0].rawsource, translatable=True) | 
					
						
							|  |  |  |         content.source = pnode[0].source | 
					
						
							|  |  |  |         content.line = pnode[0].line | 
					
						
							|  |  |  |         content += pnode[0].children | 
					
						
							|  |  |  |         pnode[0].replace_self(nodes.paragraph( | 
					
						
							|  |  |  |             '', '', add_text, nodes.Text(' '), content, translatable=False)) | 
					
						
							| 
									
										
											  
											
												Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
  Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
........
  r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
  Fix markup.
........
  r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
  #7125: fix typo.
........
  r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
  #7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
  r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
  #7116: str.join() takes an iterable.
........
  r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
  Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
  r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
  Fix missing word.
........
  r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
  Fix punctuation.
........
  r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
  Revert unintended change.
........
  r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
  Fix markup.
........
  r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
  Fix duplicate target.
........
  r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
  Add a new directive marking up implementation details and start using it.
........
  r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
  Make it more robust.
........
  r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
  Document new directive.
........
  r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
  Allow short form with text as argument.
........
  r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
  Fix stylesheet for multi-paragraph impl-details.
........
  r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
  Use "impl-detail" directive where applicable.
........
  r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
  #6324: membership test tries iteration via __iter__.
........
  r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
  #7088: document new functions in signal as Unix-only.
........
  r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
  Reorder __slots__ fine print and add a clarification.
........
  r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
  #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
  r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
  #7156: document curses as Unix-only.
........
  r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
  #6977: getopt does not support optional option arguments.
........
  r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
  Add proper references.
........
  r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
  Make printout margin important.
........
  r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
  #7188: fix optionxform() docs.
........
  r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
  add further note about what's passed to optionxform
........
  r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
  Improve some docstrings in the 'warnings' module.
........
  r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
  Fix markup.
........
  r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
  Fix a demo.
........
  r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
  Fix a strange mis-edit.
........
											
										 
											2009-10-27 15:28:25 +00:00
										 |  |  |         return [pnode] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-12 10:55:20 -04:00
										 |  |  | # Support for documenting platform availability | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-12 15:20:11 +01:00
										 |  |  | class Availability(SphinxDirective): | 
					
						
							| 
									
										
										
										
											2018-10-12 10:55:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-29 16:42:09 +02:00
										 |  |  |     has_content = True | 
					
						
							| 
									
										
										
										
											2018-10-12 10:55:20 -04:00
										 |  |  |     required_arguments = 1 | 
					
						
							|  |  |  |     optional_arguments = 0 | 
					
						
							|  |  |  |     final_argument_whitespace = True | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-29 16:42:09 +02:00
										 |  |  |     # known platform, libc, and threading implementations | 
					
						
							|  |  |  |     known_platforms = frozenset({ | 
					
						
							|  |  |  |         "AIX", "Android", "BSD", "DragonFlyBSD", "Emscripten", "FreeBSD", | 
					
						
							| 
									
										
										
										
											2023-11-09 21:02:30 +01:00
										 |  |  |         "GNU/kFreeBSD", "Linux", "NetBSD", "OpenBSD", "POSIX", "Solaris", | 
					
						
							| 
									
										
										
										
											2024-03-19 20:36:19 +08:00
										 |  |  |         "Unix", "VxWorks", "WASI", "Windows", "macOS", "iOS", | 
					
						
							| 
									
										
										
										
											2022-08-02 21:00:41 +02:00
										 |  |  |         # libc | 
					
						
							|  |  |  |         "BSD libc", "glibc", "musl", | 
					
						
							|  |  |  |         # POSIX platforms with pthreads | 
					
						
							|  |  |  |         "pthreads", | 
					
						
							| 
									
										
										
										
											2022-07-29 16:42:09 +02:00
										 |  |  |     }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-12 10:55:20 -04:00
										 |  |  |     def run(self): | 
					
						
							| 
									
										
										
										
											2018-11-07 22:42:40 +01:00
										 |  |  |         availability_ref = ':ref:`Availability <availability>`: ' | 
					
						
							| 
									
										
										
										
											2023-02-12 15:20:11 +01:00
										 |  |  |         avail_nodes, avail_msgs = self.state.inline_text( | 
					
						
							|  |  |  |             availability_ref + self.arguments[0], | 
					
						
							|  |  |  |             self.lineno) | 
					
						
							| 
									
										
										
										
											2018-11-07 22:42:40 +01:00
										 |  |  |         pnode = nodes.paragraph(availability_ref + self.arguments[0], | 
					
						
							| 
									
										
										
										
											2023-02-12 15:20:11 +01:00
										 |  |  |                                 '', *avail_nodes, *avail_msgs) | 
					
						
							|  |  |  |         self.set_source_info(pnode) | 
					
						
							|  |  |  |         cnode = nodes.container("", pnode, classes=["availability"]) | 
					
						
							|  |  |  |         self.set_source_info(cnode) | 
					
						
							| 
									
										
										
										
											2022-07-29 16:42:09 +02:00
										 |  |  |         if self.content: | 
					
						
							| 
									
										
										
										
											2023-02-12 15:20:11 +01:00
										 |  |  |             self.state.nested_parse(self.content, self.content_offset, cnode) | 
					
						
							| 
									
										
										
										
											2022-07-29 16:42:09 +02:00
										 |  |  |         self.parse_platforms() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-12 15:20:11 +01:00
										 |  |  |         return [cnode] | 
					
						
							| 
									
										
										
										
											2018-10-12 10:55:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-29 16:42:09 +02:00
										 |  |  |     def parse_platforms(self): | 
					
						
							|  |  |  |         """Parse platform information from arguments
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Arguments is a comma-separated string of platforms. A platform may | 
					
						
							|  |  |  |         be prefixed with "not " to indicate that a feature is not available. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Example:: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-28 16:13:13 +08:00
										 |  |  |            .. availability:: Windows, Linux >= 4.2, not WASI | 
					
						
							| 
									
										
										
										
											2022-07-29 16:42:09 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         Arguments like "Linux >= 3.17 with glibc >= 2.27" are currently not | 
					
						
							|  |  |  |         parsed into separate tokens. | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         platforms = {} | 
					
						
							|  |  |  |         for arg in self.arguments[0].rstrip(".").split(","): | 
					
						
							|  |  |  |             arg = arg.strip() | 
					
						
							|  |  |  |             platform, _, version = arg.partition(" >= ") | 
					
						
							|  |  |  |             if platform.startswith("not "): | 
					
						
							|  |  |  |                 version = False | 
					
						
							|  |  |  |                 platform = platform[4:] | 
					
						
							|  |  |  |             elif not version: | 
					
						
							|  |  |  |                 version = True | 
					
						
							|  |  |  |             platforms[platform] = version | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         unknown = set(platforms).difference(self.known_platforms) | 
					
						
							|  |  |  |         if unknown: | 
					
						
							|  |  |  |             cls = type(self) | 
					
						
							|  |  |  |             logger = logging.getLogger(cls.__qualname__) | 
					
						
							| 
									
										
										
										
											2023-08-06 14:58:00 +01:00
										 |  |  |             logger.warning( | 
					
						
							| 
									
										
										
										
											2022-07-29 16:42:09 +02:00
										 |  |  |                 f"Unknown platform(s) or syntax '{' '.join(sorted(unknown))}' " | 
					
						
							|  |  |  |                 f"in '.. availability:: {self.arguments[0]}', see " | 
					
						
							|  |  |  |                 f"{__file__}:{cls.__qualname__}.known_platforms for a set " | 
					
						
							|  |  |  |                 "known platforms." | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return platforms | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  | # Support for documenting audit event | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-06 22:28:15 +02:00
										 |  |  | def audit_events_purge(app, env, docname): | 
					
						
							|  |  |  |     """This is to remove from env.all_audit_events old traces of removed
 | 
					
						
							|  |  |  |     documents. | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     if not hasattr(env, 'all_audit_events'): | 
					
						
							|  |  |  |         return | 
					
						
							|  |  |  |     fresh_all_audit_events = {} | 
					
						
							|  |  |  |     for name, event in env.all_audit_events.items(): | 
					
						
							|  |  |  |         event["source"] = [(d, t) for d, t in event["source"] if d != docname] | 
					
						
							|  |  |  |         if event["source"]: | 
					
						
							|  |  |  |             # Only keep audit_events that have at least one source. | 
					
						
							|  |  |  |             fresh_all_audit_events[name] = event | 
					
						
							|  |  |  |     env.all_audit_events = fresh_all_audit_events | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def audit_events_merge(app, env, docnames, other): | 
					
						
							|  |  |  |     """In Sphinx parallel builds, this merges env.all_audit_events from
 | 
					
						
							|  |  |  |     subprocesses. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     all_audit_events is a dict of names, with values like: | 
					
						
							|  |  |  |     {'source': [(docname, target), ...], 'args': args} | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     if not hasattr(other, 'all_audit_events'): | 
					
						
							|  |  |  |         return | 
					
						
							|  |  |  |     if not hasattr(env, 'all_audit_events'): | 
					
						
							|  |  |  |         env.all_audit_events = {} | 
					
						
							|  |  |  |     for name, value in other.all_audit_events.items(): | 
					
						
							|  |  |  |         if name in env.all_audit_events: | 
					
						
							|  |  |  |             env.all_audit_events[name]["source"].extend(value["source"]) | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             env.all_audit_events[name] = value | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  | class AuditEvent(Directive): | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     has_content = True | 
					
						
							|  |  |  |     required_arguments = 1 | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |     optional_arguments = 2 | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  |     final_argument_whitespace = True | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     _label = [ | 
					
						
							| 
									
										
										
										
											2023-08-06 14:10:50 +09:00
										 |  |  |         sphinx_gettext("Raises an :ref:`auditing event <auditing>` {name} with no arguments."), | 
					
						
							|  |  |  |         sphinx_gettext("Raises an :ref:`auditing event <auditing>` {name} with argument {args}."), | 
					
						
							|  |  |  |         sphinx_gettext("Raises an :ref:`auditing event <auditing>` {name} with arguments {args}."), | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |     @property | 
					
						
							|  |  |  |     def logger(self): | 
					
						
							|  |  |  |         cls = type(self) | 
					
						
							|  |  |  |         return logging.getLogger(cls.__module__ + "." + cls.__name__) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  |     def run(self): | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |         name = self.arguments[0] | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  |         if len(self.arguments) >= 2 and self.arguments[1]: | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |             args = (a.strip() for a in self.arguments[1].strip("'\"").split(",")) | 
					
						
							|  |  |  |             args = [a for a in args if a] | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  |         else: | 
					
						
							|  |  |  |             args = [] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-06 14:10:50 +09:00
										 |  |  |         label = self._label[min(2, len(args))] | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |         text = label.format(name="``{}``".format(name), | 
					
						
							|  |  |  |                             args=", ".join("``{}``".format(a) for a in args if a)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         env = self.state.document.settings.env | 
					
						
							|  |  |  |         if not hasattr(env, 'all_audit_events'): | 
					
						
							|  |  |  |             env.all_audit_events = {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         new_info = { | 
					
						
							|  |  |  |             'source': [], | 
					
						
							|  |  |  |             'args': args | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         info = env.all_audit_events.setdefault(name, new_info) | 
					
						
							|  |  |  |         if info is not new_info: | 
					
						
							|  |  |  |             if not self._do_args_match(info['args'], new_info['args']): | 
					
						
							| 
									
										
										
										
											2023-08-06 14:58:00 +01:00
										 |  |  |                 self.logger.warning( | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |                     "Mismatched arguments for audit-event {}: {!r} != {!r}" | 
					
						
							|  |  |  |                     .format(name, info['args'], new_info['args']) | 
					
						
							|  |  |  |                 ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-01 16:03:53 -07:00
										 |  |  |         ids = [] | 
					
						
							|  |  |  |         try: | 
					
						
							|  |  |  |             target = self.arguments[2].strip("\"'") | 
					
						
							|  |  |  |         except (IndexError, TypeError): | 
					
						
							|  |  |  |             target = None | 
					
						
							|  |  |  |         if not target: | 
					
						
							|  |  |  |             target = "audit_event_{}_{}".format( | 
					
						
							|  |  |  |                 re.sub(r'\W', '_', name), | 
					
						
							|  |  |  |                 len(info['source']), | 
					
						
							|  |  |  |             ) | 
					
						
							|  |  |  |             ids.append(target) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |         info['source'].append((env.docname, target)) | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |         pnode = nodes.paragraph(text, classes=["audit-hook"], ids=ids) | 
					
						
							| 
									
										
										
										
											2021-03-01 22:59:58 +01:00
										 |  |  |         pnode.line = self.lineno | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  |         if self.content: | 
					
						
							|  |  |  |             self.state.nested_parse(self.content, self.content_offset, pnode) | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             n, m = self.state.inline_text(text, self.lineno) | 
					
						
							|  |  |  |             pnode.extend(n + m) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return [pnode] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |     # This list of sets are allowable synonyms for event argument names. | 
					
						
							|  |  |  |     # If two names are in the same set, they are treated as equal for the | 
					
						
							|  |  |  |     # purposes of warning. This won't help if number of arguments is | 
					
						
							|  |  |  |     # different! | 
					
						
							|  |  |  |     _SYNONYMS = [ | 
					
						
							|  |  |  |         {"file", "path", "fd"}, | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _do_args_match(self, args1, args2): | 
					
						
							|  |  |  |         if args1 == args2: | 
					
						
							|  |  |  |             return True | 
					
						
							|  |  |  |         if len(args1) != len(args2): | 
					
						
							|  |  |  |             return False | 
					
						
							|  |  |  |         for a1, a2 in zip(args1, args2): | 
					
						
							|  |  |  |             if a1 == a2: | 
					
						
							|  |  |  |                 continue | 
					
						
							|  |  |  |             if any(a1 in s and a2 in s for s in self._SYNONYMS): | 
					
						
							|  |  |  |                 continue | 
					
						
							|  |  |  |             return False | 
					
						
							|  |  |  |         return True | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class audit_event_list(nodes.General, nodes.Element): | 
					
						
							|  |  |  |     pass | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class AuditEventListDirective(Directive): | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def run(self): | 
					
						
							|  |  |  |         return [audit_event_list('')] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-29 16:01:11 +00:00
										 |  |  | # Support for documenting decorators | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PyDecoratorMixin(object): | 
					
						
							|  |  |  |     def handle_signature(self, sig, signode): | 
					
						
							|  |  |  |         ret = super(PyDecoratorMixin, self).handle_signature(sig, signode) | 
					
						
							|  |  |  |         signode.insert(0, addnodes.desc_addname('@', '@')) | 
					
						
							|  |  |  |         return ret | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def needs_arglist(self): | 
					
						
							|  |  |  |         return False | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  | class PyDecoratorFunction(PyDecoratorMixin, PyFunction): | 
					
						
							| 
									
										
										
										
											2010-07-29 16:01:11 +00:00
										 |  |  |     def run(self): | 
					
						
							|  |  |  |         # a decorator function is a function after all | 
					
						
							|  |  |  |         self.name = 'py:function' | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  |         return PyFunction.run(self) | 
					
						
							| 
									
										
										
										
											2010-07-29 16:01:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  | # TODO: Use sphinx.domains.python.PyDecoratorMethod when possible | 
					
						
							|  |  |  | class PyDecoratorMethod(PyDecoratorMixin, PyMethod): | 
					
						
							| 
									
										
										
										
											2010-07-29 16:01:11 +00:00
										 |  |  |     def run(self): | 
					
						
							|  |  |  |         self.name = 'py:method' | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  |         return PyMethod.run(self) | 
					
						
							| 
									
										
										
										
											2010-07-29 16:01:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 22:49:18 +01:00
										 |  |  | class PyCoroutineMixin(object): | 
					
						
							|  |  |  |     def handle_signature(self, sig, signode): | 
					
						
							|  |  |  |         ret = super(PyCoroutineMixin, self).handle_signature(sig, signode) | 
					
						
							|  |  |  |         signode.insert(0, addnodes.desc_annotation('coroutine ', 'coroutine ')) | 
					
						
							|  |  |  |         return ret | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-18 17:55:44 -04:00
										 |  |  | class PyAwaitableMixin(object): | 
					
						
							|  |  |  |     def handle_signature(self, sig, signode): | 
					
						
							|  |  |  |         ret = super(PyAwaitableMixin, self).handle_signature(sig, signode) | 
					
						
							|  |  |  |         signode.insert(0, addnodes.desc_annotation('awaitable ', 'awaitable ')) | 
					
						
							|  |  |  |         return ret | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  | class PyCoroutineFunction(PyCoroutineMixin, PyFunction): | 
					
						
							| 
									
										
										
										
											2015-02-12 22:49:18 +01:00
										 |  |  |     def run(self): | 
					
						
							|  |  |  |         self.name = 'py:function' | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  |         return PyFunction.run(self) | 
					
						
							| 
									
										
										
										
											2015-02-12 22:49:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  | class PyCoroutineMethod(PyCoroutineMixin, PyMethod): | 
					
						
							| 
									
										
										
										
											2015-02-12 22:49:18 +01:00
										 |  |  |     def run(self): | 
					
						
							|  |  |  |         self.name = 'py:method' | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  |         return PyMethod.run(self) | 
					
						
							| 
									
										
										
										
											2015-02-12 22:49:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  | class PyAwaitableFunction(PyAwaitableMixin, PyFunction): | 
					
						
							| 
									
										
										
										
											2018-09-18 17:55:44 -04:00
										 |  |  |     def run(self): | 
					
						
							|  |  |  |         self.name = 'py:function' | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  |         return PyFunction.run(self) | 
					
						
							| 
									
										
										
										
											2018-09-18 17:55:44 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  | class PyAwaitableMethod(PyAwaitableMixin, PyMethod): | 
					
						
							| 
									
										
										
										
											2018-09-18 17:55:44 -04:00
										 |  |  |     def run(self): | 
					
						
							|  |  |  |         self.name = 'py:method' | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  |         return PyMethod.run(self) | 
					
						
							| 
									
										
										
										
											2018-09-18 17:55:44 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  | class PyAbstractMethod(PyMethod): | 
					
						
							| 
									
										
										
										
											2015-12-08 12:14:50 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def handle_signature(self, sig, signode): | 
					
						
							|  |  |  |         ret = super(PyAbstractMethod, self).handle_signature(sig, signode) | 
					
						
							|  |  |  |         signode.insert(0, addnodes.desc_annotation('abstractmethod ', | 
					
						
							|  |  |  |                                                    'abstractmethod ')) | 
					
						
							|  |  |  |         return ret | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def run(self): | 
					
						
							|  |  |  |         self.name = 'py:method' | 
					
						
							| 
									
										
										
										
											2020-09-18 18:22:36 +09:00
										 |  |  |         return PyMethod.run(self) | 
					
						
							| 
									
										
										
										
											2015-12-08 12:14:50 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-12 08:57:12 +00:00
										 |  |  | # Support for documenting version of removal in deprecations | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DeprecatedRemoved(Directive): | 
					
						
							|  |  |  |     has_content = True | 
					
						
							|  |  |  |     required_arguments = 2 | 
					
						
							|  |  |  |     optional_arguments = 1 | 
					
						
							|  |  |  |     final_argument_whitespace = True | 
					
						
							|  |  |  |     option_spec = {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-06 14:10:50 +09:00
										 |  |  |     _deprecated_label = sphinx_gettext('Deprecated since version {deprecated}, will be removed in version {removed}') | 
					
						
							|  |  |  |     _removed_label = sphinx_gettext('Deprecated since version {deprecated}, removed in version {removed}') | 
					
						
							| 
									
										
										
										
											2014-01-21 19:20:31 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-12 08:57:12 +00:00
										 |  |  |     def run(self): | 
					
						
							|  |  |  |         node = addnodes.versionmodified() | 
					
						
							|  |  |  |         node.document = self.state.document | 
					
						
							|  |  |  |         node['type'] = 'deprecated-removed' | 
					
						
							|  |  |  |         version = (self.arguments[0], self.arguments[1]) | 
					
						
							|  |  |  |         node['version'] = version | 
					
						
							| 
									
										
										
										
											2020-05-30 09:47:32 +02:00
										 |  |  |         env = self.state.document.settings.env | 
					
						
							|  |  |  |         current_version = tuple(int(e) for e in env.config.version.split('.')) | 
					
						
							|  |  |  |         removed_version = tuple(int(e) for e in self.arguments[1].split('.')) | 
					
						
							|  |  |  |         if current_version < removed_version: | 
					
						
							|  |  |  |             label = self._deprecated_label | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             label = self._removed_label | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-23 20:47:19 +09:00
										 |  |  |         text = label.format(deprecated=self.arguments[0], removed=self.arguments[1]) | 
					
						
							| 
									
										
										
										
											2010-11-12 08:57:12 +00:00
										 |  |  |         if len(self.arguments) == 3: | 
					
						
							|  |  |  |             inodes, messages = self.state.inline_text(self.arguments[2], | 
					
						
							|  |  |  |                                                       self.lineno+1) | 
					
						
							| 
									
										
										
										
											2018-02-23 20:47:19 +09:00
										 |  |  |             para = nodes.paragraph(self.arguments[2], '', *inodes, translatable=False) | 
					
						
							| 
									
										
										
										
											2014-01-21 19:20:31 +01:00
										 |  |  |             node.append(para) | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             messages = [] | 
					
						
							|  |  |  |         if self.content: | 
					
						
							|  |  |  |             self.state.nested_parse(self.content, self.content_offset, node) | 
					
						
							| 
									
										
										
										
											2014-11-08 22:40:22 +02:00
										 |  |  |         if len(node): | 
					
						
							| 
									
										
										
										
											2014-01-21 19:20:31 +01:00
										 |  |  |             if isinstance(node[0], nodes.paragraph) and node[0].rawsource: | 
					
						
							|  |  |  |                 content = nodes.inline(node[0].rawsource, translatable=True) | 
					
						
							|  |  |  |                 content.source = node[0].source | 
					
						
							|  |  |  |                 content.line = node[0].line | 
					
						
							|  |  |  |                 content += node[0].children | 
					
						
							| 
									
										
										
										
											2018-02-23 20:47:19 +09:00
										 |  |  |                 node[0].replace_self(nodes.paragraph('', '', content, translatable=False)) | 
					
						
							| 
									
										
										
										
											2014-11-08 22:40:22 +02:00
										 |  |  |             node[0].insert(0, nodes.inline('', '%s: ' % text, | 
					
						
							|  |  |  |                                            classes=['versionmodified'])) | 
					
						
							| 
									
										
										
										
											2014-09-22 14:44:22 -07:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2014-01-21 19:20:31 +01:00
										 |  |  |             para = nodes.paragraph('', '', | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  |                                    nodes.inline('', '%s.' % text, | 
					
						
							| 
									
										
										
										
											2018-02-23 20:47:19 +09:00
										 |  |  |                                                 classes=['versionmodified']), | 
					
						
							|  |  |  |                                    translatable=False) | 
					
						
							| 
									
										
										
										
											2014-11-08 22:40:22 +02:00
										 |  |  |             node.append(para) | 
					
						
							| 
									
										
										
										
											2010-11-12 08:57:12 +00:00
										 |  |  |         env = self.state.document.settings.env | 
					
						
							| 
									
										
										
										
											2022-06-21 16:04:46 +01:00
										 |  |  |         env.get_domain('changeset').note_changeset(node) | 
					
						
							| 
									
										
										
										
											2014-01-21 19:20:31 +01:00
										 |  |  |         return [node] + messages | 
					
						
							| 
									
										
										
										
											2010-11-12 08:57:12 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-30 15:10:06 +02:00
										 |  |  | # Support for including Misc/NEWS | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-08 21:50:40 +09:00
										 |  |  | issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)', re.I) | 
					
						
							|  |  |  | gh_issue_re = re.compile('(?:gh-issue-|gh-)([0-9]+)', re.I) | 
					
						
							| 
									
										
										
										
											2012-10-01 19:08:50 +02:00
										 |  |  | whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$") | 
					
						
							| 
									
										
										
										
											2012-09-30 15:10:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-30 15:10:06 +02:00
										 |  |  | class MiscNews(Directive): | 
					
						
							|  |  |  |     has_content = False | 
					
						
							|  |  |  |     required_arguments = 1 | 
					
						
							|  |  |  |     optional_arguments = 0 | 
					
						
							|  |  |  |     final_argument_whitespace = False | 
					
						
							|  |  |  |     option_spec = {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def run(self): | 
					
						
							|  |  |  |         fname = self.arguments[0] | 
					
						
							|  |  |  |         source = self.state_machine.input_lines.source( | 
					
						
							|  |  |  |             self.lineno - self.state_machine.input_offset - 1) | 
					
						
							| 
									
										
										
										
											2018-12-19 18:20:06 -08:00
										 |  |  |         source_dir = getenv('PY_MISC_NEWS_DIR') | 
					
						
							|  |  |  |         if not source_dir: | 
					
						
							|  |  |  |             source_dir = path.dirname(path.abspath(source)) | 
					
						
							| 
									
										
										
										
											2012-10-01 19:08:50 +02:00
										 |  |  |         fpath = path.join(source_dir, fname) | 
					
						
							|  |  |  |         self.state.document.settings.record_dependencies.add(fpath) | 
					
						
							| 
									
										
										
										
											2012-09-30 15:10:06 +02:00
										 |  |  |         try: | 
					
						
							| 
									
										
										
										
											2017-06-16 08:59:01 +02:00
										 |  |  |             with io.open(fpath, encoding='utf-8') as fp: | 
					
						
							| 
									
										
										
										
											2012-09-30 15:10:06 +02:00
										 |  |  |                 content = fp.read() | 
					
						
							|  |  |  |         except Exception: | 
					
						
							|  |  |  |             text = 'The NEWS file is not available.' | 
					
						
							|  |  |  |             node = nodes.strong(text, text) | 
					
						
							|  |  |  |             return [node] | 
					
						
							| 
									
										
										
										
											2022-05-08 21:50:40 +09:00
										 |  |  |         content = issue_re.sub(r':issue:`\1`', content) | 
					
						
							|  |  |  |         # Fallback handling for the GitHub issue | 
					
						
							|  |  |  |         content = gh_issue_re.sub(r':gh:`\1`', content) | 
					
						
							| 
									
										
										
										
											2012-10-01 19:08:50 +02:00
										 |  |  |         content = whatsnew_re.sub(r'\1', content) | 
					
						
							| 
									
										
										
										
											2012-09-30 15:10:06 +02:00
										 |  |  |         # remove first 3 lines as they are the main heading | 
					
						
							| 
									
										
										
										
											2012-10-01 19:27:05 +02:00
										 |  |  |         lines = ['.. default-role:: obj', ''] + content.splitlines()[3:] | 
					
						
							| 
									
										
										
										
											2012-09-30 15:10:06 +02:00
										 |  |  |         self.state_machine.insert_input(lines, fname) | 
					
						
							|  |  |  |         return [] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  | # Support for building "topic help" for pydoc | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | pydoc_topic_labels = [ | 
					
						
							| 
									
										
										
										
											2017-10-05 20:24:46 -07:00
										 |  |  |     'assert', 'assignment', 'async', 'atom-identifiers', 'atom-literals', | 
					
						
							|  |  |  |     'attribute-access', 'attribute-references', 'augassign', 'await', | 
					
						
							|  |  |  |     'binary', 'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object', | 
					
						
							| 
									
										
										
										
											2010-06-06 02:44:41 +00:00
										 |  |  |     'bltin-null-object', 'bltin-type-objects', 'booleans', | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  |     'break', 'callable-types', 'calls', 'class', 'comparisons', 'compound', | 
					
						
							|  |  |  |     'context-managers', 'continue', 'conversions', 'customization', 'debugger', | 
					
						
							|  |  |  |     'del', 'dict', 'dynamic-features', 'else', 'exceptions', 'execmodel', | 
					
						
							|  |  |  |     'exprlists', 'floating', 'for', 'formatstrings', 'function', 'global', | 
					
						
							|  |  |  |     'id-classes', 'identifiers', 'if', 'imaginary', 'import', 'in', 'integers', | 
					
						
							| 
									
										
										
										
											2010-08-31 14:31:01 +00:00
										 |  |  |     'lambda', 'lists', 'naming', 'nonlocal', 'numbers', 'numeric-types', | 
					
						
							|  |  |  |     'objects', 'operator-summary', 'pass', 'power', 'raise', 'return', | 
					
						
							|  |  |  |     'sequence-types', 'shifting', 'slicings', 'specialattrs', 'specialnames', | 
					
						
							|  |  |  |     'string-methods', 'strings', 'subscriptions', 'truth', 'try', 'types', | 
					
						
							|  |  |  |     'typesfunctions', 'typesmapping', 'typesmethods', 'typesmodules', | 
					
						
							|  |  |  |     'typesseq', 'typesseq-mutable', 'unary', 'while', 'with', 'yield' | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  | ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PydocTopicsBuilder(Builder): | 
					
						
							|  |  |  |     name = 'pydoc-topics' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-16 22:56:46 -07:00
										 |  |  |     default_translator_class = TextTranslator | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  |     def init(self): | 
					
						
							|  |  |  |         self.topics = {} | 
					
						
							| 
									
										
										
										
											2018-04-16 22:56:46 -07:00
										 |  |  |         self.secnumbers = {} | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def get_outdated_docs(self): | 
					
						
							|  |  |  |         return 'all pydoc topics' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def get_target_uri(self, docname, typ=None): | 
					
						
							|  |  |  |         return ''  # no URIs | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def write(self, *ignored): | 
					
						
							|  |  |  |         writer = TextWriter(self) | 
					
						
							| 
									
										
										
										
											2018-04-16 22:56:46 -07:00
										 |  |  |         for label in status_iterator(pydoc_topic_labels, | 
					
						
							|  |  |  |                                      'building topics... ', | 
					
						
							|  |  |  |                                      length=len(pydoc_topic_labels)): | 
					
						
							| 
									
										
										
										
											2010-07-31 08:27:46 +00:00
										 |  |  |             if label not in self.env.domaindata['std']['labels']: | 
					
						
							| 
									
										
										
										
											2023-08-06 14:58:00 +01:00
										 |  |  |                 self.env.logger.warning(f'label {label!r} not in documentation') | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  |                 continue | 
					
						
							| 
									
										
										
										
											2010-07-31 08:27:46 +00:00
										 |  |  |             docname, labelid, sectname = self.env.domaindata['std']['labels'][label] | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  |             doctree = self.env.get_and_resolve_doctree(docname, self) | 
					
						
							|  |  |  |             document = new_document('<section node>') | 
					
						
							|  |  |  |             document.append(doctree.ids[labelid]) | 
					
						
							|  |  |  |             destination = StringOutput(encoding='utf-8') | 
					
						
							|  |  |  |             writer.write(document, destination) | 
					
						
							| 
									
										
										
										
											2014-09-22 14:44:22 -07:00
										 |  |  |             self.topics[label] = writer.output | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def finish(self): | 
					
						
							| 
									
										
										
										
											2014-09-22 14:44:22 -07:00
										 |  |  |         f = open(path.join(self.outdir, 'topics.py'), 'wb') | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  |         try: | 
					
						
							| 
									
										
										
										
											2014-09-22 14:44:22 -07:00
										 |  |  |             f.write('# -*- coding: utf-8 -*-\n'.encode('utf-8')) | 
					
						
							|  |  |  |             f.write(('# Autogenerated by Sphinx on %s\n' % asctime()).encode('utf-8')) | 
					
						
							| 
									
										
										
										
											2023-07-09 20:41:31 -07:00
										 |  |  |             f.write('# as part of the release process.\n'.encode('utf-8')) | 
					
						
							| 
									
										
										
										
											2014-09-22 14:44:22 -07:00
										 |  |  |             f.write(('topics = ' + pformat(self.topics) + '\n').encode('utf-8')) | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  |         finally: | 
					
						
							|  |  |  |             f.close() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
  Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
........
  r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
  Fix markup.
........
  r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
  #7125: fix typo.
........
  r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
  #7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
  r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
  #7116: str.join() takes an iterable.
........
  r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
  Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
  r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
  Fix missing word.
........
  r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
  Fix punctuation.
........
  r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
  Revert unintended change.
........
  r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
  Fix markup.
........
  r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
  Fix duplicate target.
........
  r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
  Add a new directive marking up implementation details and start using it.
........
  r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
  Make it more robust.
........
  r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
  Document new directive.
........
  r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
  Allow short form with text as argument.
........
  r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
  Fix stylesheet for multi-paragraph impl-details.
........
  r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
  Use "impl-detail" directive where applicable.
........
  r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
  #6324: membership test tries iteration via __iter__.
........
  r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
  #7088: document new functions in signal as Unix-only.
........
  r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
  Reorder __slots__ fine print and add a clarification.
........
  r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
  #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
  r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
  #7156: document curses as Unix-only.
........
  r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
  #6977: getopt does not support optional option arguments.
........
  r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
  Add proper references.
........
  r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
  Make printout margin important.
........
  r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
  #7188: fix optionxform() docs.
........
  r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
  add further note about what's passed to optionxform
........
  r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
  Improve some docstrings in the 'warnings' module.
........
  r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
  Fix markup.
........
  r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
  Fix a demo.
........
  r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
  Fix a strange mis-edit.
........
											
										 
											2009-10-27 15:28:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-23 15:19:11 +00:00
										 |  |  | # Support for documenting Opcodes | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-03 10:41:33 +00:00
										 |  |  | opcode_sig_re = re.compile(r'(\w+(?:\+\d)?)(?:\s*\((.*)\))?') | 
					
						
							| 
									
										
										
										
											2008-07-23 15:19:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-23 15:19:11 +00:00
										 |  |  | def parse_opcode_signature(env, sig, signode): | 
					
						
							|  |  |  |     """Transform an opcode signature into RST nodes.""" | 
					
						
							|  |  |  |     m = opcode_sig_re.match(sig) | 
					
						
							|  |  |  |     if m is None: | 
					
						
							|  |  |  |         raise ValueError | 
					
						
							|  |  |  |     opname, arglist = m.groups() | 
					
						
							|  |  |  |     signode += addnodes.desc_name(opname, opname) | 
					
						
							| 
									
										
										
										
											2010-07-03 10:41:33 +00:00
										 |  |  |     if arglist is not None: | 
					
						
							|  |  |  |         paramlist = addnodes.desc_parameterlist() | 
					
						
							|  |  |  |         signode += paramlist | 
					
						
							|  |  |  |         paramlist += addnodes.desc_parameter(arglist, arglist) | 
					
						
							| 
									
										
										
										
											2008-07-23 15:19:11 +00:00
										 |  |  |     return opname.strip() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-12 08:57:12 +00:00
										 |  |  | # Support for documenting pdb commands | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-18 10:11:03 +00:00
										 |  |  | pdbcmd_sig_re = re.compile(r'([a-z()!]+)\s*(.*)') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # later... | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | # pdbargs_tokens_re = re.compile(r'''[a-zA-Z]+  |  # identifiers | 
					
						
							| 
									
										
										
										
											2010-07-18 10:11:03 +00:00
										 |  |  | #                                   [.,:]+     |  # punctuation | 
					
						
							|  |  |  | #                                   [\[\]()]   |  # parens | 
					
						
							|  |  |  | #                                   \s+           # whitespace | 
					
						
							|  |  |  | #                                   ''', re.X) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 22:55:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-18 10:11:03 +00:00
										 |  |  | def parse_pdb_command(env, sig, signode): | 
					
						
							|  |  |  |     """Transform a pdb command signature into RST nodes.""" | 
					
						
							|  |  |  |     m = pdbcmd_sig_re.match(sig) | 
					
						
							|  |  |  |     if m is None: | 
					
						
							|  |  |  |         raise ValueError | 
					
						
							|  |  |  |     name, args = m.groups() | 
					
						
							|  |  |  |     fullname = name.replace('(', '').replace(')', '') | 
					
						
							|  |  |  |     signode += addnodes.desc_name(name, name) | 
					
						
							|  |  |  |     if args: | 
					
						
							|  |  |  |         signode += addnodes.desc_addname(' '+args, ' '+args) | 
					
						
							|  |  |  |     return fullname | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-18 16:15:42 -07:00
										 |  |  | def parse_monitoring_event(env, sig, signode): | 
					
						
							|  |  |  |     """Transform a monitoring event signature into RST nodes.""" | 
					
						
							|  |  |  |     signode += addnodes.desc_addname('sys.monitoring.events.', 'sys.monitoring.events.') | 
					
						
							|  |  |  |     signode += addnodes.desc_name(sig, sig) | 
					
						
							|  |  |  |     return sig | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  | def process_audit_events(app, doctree, fromdocname): | 
					
						
							|  |  |  |     for node in doctree.traverse(audit_event_list): | 
					
						
							|  |  |  |         break | 
					
						
							|  |  |  |     else: | 
					
						
							|  |  |  |         return | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     env = app.builder.env | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     table = nodes.table(cols=3) | 
					
						
							|  |  |  |     group = nodes.tgroup( | 
					
						
							|  |  |  |         '', | 
					
						
							|  |  |  |         nodes.colspec(colwidth=30), | 
					
						
							|  |  |  |         nodes.colspec(colwidth=55), | 
					
						
							|  |  |  |         nodes.colspec(colwidth=15), | 
					
						
							| 
									
										
										
										
											2019-09-10 17:40:50 +03:00
										 |  |  |         cols=3, | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |     ) | 
					
						
							|  |  |  |     head = nodes.thead() | 
					
						
							|  |  |  |     body = nodes.tbody() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     table += group | 
					
						
							|  |  |  |     group += head | 
					
						
							|  |  |  |     group += body | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     row = nodes.row() | 
					
						
							|  |  |  |     row += nodes.entry('', nodes.paragraph('', nodes.Text('Audit event'))) | 
					
						
							|  |  |  |     row += nodes.entry('', nodes.paragraph('', nodes.Text('Arguments'))) | 
					
						
							|  |  |  |     row += nodes.entry('', nodes.paragraph('', nodes.Text('References'))) | 
					
						
							|  |  |  |     head += row | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for name in sorted(getattr(env, "all_audit_events", ())): | 
					
						
							|  |  |  |         audit_event = env.all_audit_events[name] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         row = nodes.row() | 
					
						
							|  |  |  |         node = nodes.paragraph('', nodes.Text(name)) | 
					
						
							|  |  |  |         row += nodes.entry('', node) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         node = nodes.paragraph() | 
					
						
							|  |  |  |         for i, a in enumerate(audit_event['args']): | 
					
						
							|  |  |  |             if i: | 
					
						
							|  |  |  |                 node += nodes.Text(", ") | 
					
						
							|  |  |  |             node += nodes.literal(a, nodes.Text(a)) | 
					
						
							|  |  |  |         row += nodes.entry('', node) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         node = nodes.paragraph() | 
					
						
							| 
									
										
										
										
											2019-07-01 16:03:53 -07:00
										 |  |  |         backlinks = enumerate(sorted(set(audit_event['source'])), start=1) | 
					
						
							|  |  |  |         for i, (doc, label) in backlinks: | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |             if isinstance(label, str): | 
					
						
							|  |  |  |                 ref = nodes.reference("", nodes.Text("[{}]".format(i)), internal=True) | 
					
						
							| 
									
										
										
										
											2019-09-09 12:54:56 +02:00
										 |  |  |                 try: | 
					
						
							|  |  |  |                     ref['refuri'] = "{}#{}".format( | 
					
						
							|  |  |  |                         app.builder.get_relative_uri(fromdocname, doc), | 
					
						
							|  |  |  |                         label, | 
					
						
							|  |  |  |                     ) | 
					
						
							|  |  |  |                 except NoUri: | 
					
						
							|  |  |  |                     continue | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |                 node += ref | 
					
						
							|  |  |  |         row += nodes.entry('', node) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         body += row | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for node in doctree.traverse(audit_event_list): | 
					
						
							|  |  |  |         node.replace_self(table) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-08 20:01:25 +01:00
										 |  |  | def patch_pairindextypes(app, _env) -> None: | 
					
						
							|  |  |  |     """Remove all entries from ``pairindextypes`` before writing POT files.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     We want to run this just before writing output files, as the check to | 
					
						
							|  |  |  |     circumvent is in ``I18nBuilder.write_doc()``. | 
					
						
							|  |  |  |     As such, we link this to ``env-check-consistency``, even though it has | 
					
						
							|  |  |  |     nothing to do with the environment consistency check. | 
					
						
							|  |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2023-05-04 08:11:09 +01:00
										 |  |  |     if app.builder.name != 'gettext': | 
					
						
							|  |  |  |         return | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # allow translating deprecated index entries | 
					
						
							|  |  |  |     try: | 
					
						
							|  |  |  |         from sphinx.domains.python import pairindextypes | 
					
						
							|  |  |  |     except ImportError: | 
					
						
							|  |  |  |         pass | 
					
						
							|  |  |  |     else: | 
					
						
							|  |  |  |         # Sphinx checks if a 'pair' type entry on an index directive is one of | 
					
						
							|  |  |  |         # the Sphinx-translated pairindextypes values. As we intend to move | 
					
						
							|  |  |  |         # away from this, we need Sphinx to believe that these values don't | 
					
						
							|  |  |  |         # exist, by deleting them when using the gettext builder. | 
					
						
							| 
									
										
										
										
											2023-05-08 20:01:25 +01:00
										 |  |  |         pairindextypes.clear() | 
					
						
							| 
									
										
										
										
											2023-05-04 08:11:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-10 03:06:53 +00:00
										 |  |  | def setup(app): | 
					
						
							|  |  |  |     app.add_role('issue', issue_role) | 
					
						
							| 
									
										
										
										
											2022-04-25 12:05:54 +02:00
										 |  |  |     app.add_role('gh', gh_issue_role) | 
					
						
							| 
									
										
											  
											
												Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
  Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
........
  r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
  Fix markup.
........
  r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
  #7125: fix typo.
........
  r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
  #7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
  r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
  #7116: str.join() takes an iterable.
........
  r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
  Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
  r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
  Fix missing word.
........
  r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
  Fix punctuation.
........
  r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
  Revert unintended change.
........
  r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
  Fix markup.
........
  r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
  Fix duplicate target.
........
  r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
  Add a new directive marking up implementation details and start using it.
........
  r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
  Make it more robust.
........
  r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
  Document new directive.
........
  r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
  Allow short form with text as argument.
........
  r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
  Fix stylesheet for multi-paragraph impl-details.
........
  r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
  Use "impl-detail" directive where applicable.
........
  r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
  #6324: membership test tries iteration via __iter__.
........
  r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
  #7088: document new functions in signal as Unix-only.
........
  r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
  Reorder __slots__ fine print and add a clarification.
........
  r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
  #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
  r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
  #7156: document curses as Unix-only.
........
  r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
  #6977: getopt does not support optional option arguments.
........
  r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
  Add proper references.
........
  r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
  Make printout margin important.
........
  r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
  #7188: fix optionxform() docs.
........
  r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
  add further note about what's passed to optionxform
........
  r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
  Improve some docstrings in the 'warnings' module.
........
  r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
  Fix markup.
........
  r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
  Fix a demo.
........
  r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
  Fix a strange mis-edit.
........
											
										 
											2009-10-27 15:28:25 +00:00
										 |  |  |     app.add_directive('impl-detail', ImplementationDetail) | 
					
						
							| 
									
										
										
										
											2018-10-12 10:55:20 -04:00
										 |  |  |     app.add_directive('availability', Availability) | 
					
						
							| 
									
										
										
										
											2019-05-23 08:45:22 -07:00
										 |  |  |     app.add_directive('audit-event', AuditEvent) | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |     app.add_directive('audit-event-table', AuditEventListDirective) | 
					
						
							| 
									
										
										
										
											2010-11-12 08:57:12 +00:00
										 |  |  |     app.add_directive('deprecated-removed', DeprecatedRemoved) | 
					
						
							| 
									
										
										
										
											2008-06-01 21:05:17 +00:00
										 |  |  |     app.add_builder(PydocTopicsBuilder) | 
					
						
							| 
									
										
										
										
											2018-10-13 08:14:08 +02:00
										 |  |  |     app.add_object_type('opcode', 'opcode', '%s (opcode)', parse_opcode_signature) | 
					
						
							|  |  |  |     app.add_object_type('pdbcommand', 'pdbcmd', '%s (pdb command)', parse_pdb_command) | 
					
						
							| 
									
										
										
										
											2023-10-18 16:15:42 -07:00
										 |  |  |     app.add_object_type('monitoring-event', 'monitoring-event', '%s (monitoring event)', parse_monitoring_event) | 
					
						
							| 
									
										
										
										
											2010-07-29 16:01:11 +00:00
										 |  |  |     app.add_directive_to_domain('py', 'decorator', PyDecoratorFunction) | 
					
						
							|  |  |  |     app.add_directive_to_domain('py', 'decoratormethod', PyDecoratorMethod) | 
					
						
							| 
									
										
										
										
											2015-02-12 22:49:18 +01:00
										 |  |  |     app.add_directive_to_domain('py', 'coroutinefunction', PyCoroutineFunction) | 
					
						
							|  |  |  |     app.add_directive_to_domain('py', 'coroutinemethod', PyCoroutineMethod) | 
					
						
							| 
									
										
										
										
											2018-09-18 17:55:44 -04:00
										 |  |  |     app.add_directive_to_domain('py', 'awaitablefunction', PyAwaitableFunction) | 
					
						
							|  |  |  |     app.add_directive_to_domain('py', 'awaitablemethod', PyAwaitableMethod) | 
					
						
							| 
									
										
										
										
											2015-12-08 12:14:50 +02:00
										 |  |  |     app.add_directive_to_domain('py', 'abstractmethod', PyAbstractMethod) | 
					
						
							| 
									
										
										
										
											2012-09-30 15:10:06 +02:00
										 |  |  |     app.add_directive('miscnews', MiscNews) | 
					
						
							| 
									
										
										
										
											2023-05-08 20:01:25 +01:00
										 |  |  |     app.connect('env-check-consistency', patch_pairindextypes) | 
					
						
							| 
									
										
										
										
											2019-06-27 10:47:59 -07:00
										 |  |  |     app.connect('doctree-resolved', process_audit_events) | 
					
						
							| 
									
										
										
										
											2020-07-06 22:28:15 +02:00
										 |  |  |     app.connect('env-merge-info', audit_events_merge) | 
					
						
							|  |  |  |     app.connect('env-purge-doc', audit_events_purge) | 
					
						
							| 
									
										
										
										
											2014-09-30 22:17:41 +02:00
										 |  |  |     return {'version': '1.0', 'parallel_read_safe': True} |