Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

Location:
python/vendor/current/Doc/tools
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Doc/tools/sphinx-build.py

    r2 r388  
    44    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    55
    6     :copyright: 2007 by Georg Brandl.
     6    :copyright: 2007-2010 by Georg Brandl.
    77    :license: Python license.
    88"""
    99
    1010import sys
     11import warnings
     12
     13# Get rid of UserWarnings reported by pkg_resources.
     14warnings.filterwarnings('ignore', category=UserWarning, module='jinja2')
    1115
    1216if __name__ == '__main__':
  • python/vendor/current/Doc/tools/sphinxext/download.html

    r2 r388  
    3636</table>
    3737
     38<p>These archives contain all the content in the documentation.</p>
    3839
    39 <p>These archives contain all the content in the documentation.</p>
     40<p>HTML Help (<tt>.chm</tt>) files are made available in the "Windows" section
     41on the <a href="http://python.org/download/releases/{{ release[:5] }}/">Python
     42download page</a>.</p>
     43
    4044
    4145<h2>Unpacking</h2>
  • python/vendor/current/Doc/tools/sphinxext/indexcontent.html

    r2 r388  
    88      <p class="biglink"><a class="biglink" href="{{ pathto("tutorial/index") }}">Tutorial</a><br/>
    99         <span class="linkdescr">start here</span></p>
    10       <p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">Using Python</a><br/>
    11          <span class="linkdescr">how to use Python on different platforms</span></p>
    1210      <p class="biglink"><a class="biglink" href="{{ pathto("library/index") }}">Library Reference</a><br/>
    1311         <span class="linkdescr">keep this under your pillow</span></p>
    1412      <p class="biglink"><a class="biglink" href="{{ pathto("reference/index") }}">Language Reference</a><br/>
    1513         <span class="linkdescr">describes syntax and language elements</span></p>
     14      <p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">Python Setup and Usage</a><br/>
     15         <span class="linkdescr">how to use Python on different platforms</span></p>
    1616      <p class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">Python HOWTOs</a><br/>
    1717         <span class="linkdescr">in-depth documents on specific topics</span></p>
     
    2525      <p class="biglink"><a class="biglink" href="{{ pathto("distutils/index") }}">Distributing Python Modules</a><br/>
    2626         <span class="linkdescr">sharing modules with others</span></p>
    27       <p class="biglink"><a class="biglink" href="{{ pathto("documenting/index") }}">Documenting Python</a><br/>
    28          <span class="linkdescr">guide for documentation authors</span></p>
    2927      <p class="biglink"><a class="biglink" href="{{ pathto("faq/index") }}">FAQs</a><br/>
    3028         <span class="linkdescr">frequently asked questions (with answers!)</span></p>
     
    3533  <table class="contentstable" align="center"><tr>
    3634    <td width="50%">
    37       <p class="biglink"><a class="biglink" href="{{ pathto("modindex") }}">Global Module Index</a><br/>
     35      <p class="biglink"><a class="biglink" href="{{ pathto("py-modindex") }}">Global Module Index</a><br/>
    3836         <span class="linkdescr">quick access to all modules</span></p>
    3937      <p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">General Index</a><br/>
  • python/vendor/current/Doc/tools/sphinxext/indexsidebar.html

    r2 r388  
    33            <h3>Docs for other versions</h3>
    44            <ul>
    5               <li><a href="http://docs.python.org/2.7/">Python 2.7 (in development)</a></li>
    6               <li><a href="http://docs.python.org/3.1/">Python 3.1 (stable)</a></li>
    7               <li><a href="http://docs.python.org/dev/py3k/">Python 3.2 (in development)</a></li>
     5              <li><a href="http://docs.python.org/3.3/">Python 3.3 (stable)</a></li>
     6              <li><a href="http://docs.python.org/3.4/">Python 3.4 (in development)</a></li>
    87              <li><a href="http://www.python.org/doc/versions/">Old versions</a></li>
    98            </ul>
     
    1211            <ul>
    1312              {# XXX: many of these should probably be merged in the main docs #}
    14               <li><a href="http://www.python.org/doc/faq/">FAQs</a></li>
    15               <li><a href="http://www.python.org/doc/essays/">Guido's Essays</a></li>
    16               <li><a href="http://www.python.org/doc/newstyle/">New-style Classes</a></li>
    1713              <li><a href="http://www.python.org/dev/peps/">PEP Index</a></li>
    1814              <li><a href="http://wiki.python.org/moin/BeginnersGuide">Beginner's Guide</a></li>
    1915              <li><a href="http://wiki.python.org/moin/PythonBooks">Book List</a></li>
    2016              <li><a href="http://www.python.org/doc/av/">Audio/Visual Talks</a></li>
    21               <li><a href="http://www.python.org/doc/other/">Other Doc Collections</a></li>
    2217            </ul>
  • python/vendor/current/Doc/tools/sphinxext/layout.html

    r2 r388  
    33        <li><img src="{{ pathto('_static/py.png', 1) }}" alt=""
    44                 style="vertical-align: middle; margin-top: -1px"/></li>
    5         <li><a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}</li>
     5        <li><a href="http://www.python.org/">Python</a>{{ reldelim1 }}</li>
     6        <li>
     7          {%- if versionswitcher is defined %}
     8          <span class="version_switcher_placeholder">{{ release }}</span>
     9          <a href="{{ pathto('index') }}">Documentation</a>{{ reldelim1 }}
     10          {%- else %}
     11          <a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}
     12          {%- endif %}
     13        </li>
    614{% endblock %}
    715{% block extrahead %}
    816    <link rel="shortcut icon" type="image/png" href="{{ pathto('_static/py.png', 1) }}" />
     17    {% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
     18    {% if versionswitcher is defined and not embedded %}<script type="text/javascript" src="{{ pathto('_static/version_switch.js', 1) }}"></script>{% endif %}
    919{{ super() }}
    1020{% endblock %}
     
    1323    &copy; <a href="{{ pathto('copyright') }}">Copyright</a> {{ copyright|e }}.
    1424    <br />
    15     The Python Software Foundation is a non-profit corporation. 
     25    The Python Software Foundation is a non-profit corporation.
    1626    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    1727    <br />
    1828    Last updated on {{ last_updated|e }}.
     29    <a href="{{ pathto('bugs') }}">Found a bug</a>?
     30    <br />
    1931    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version|e }}.
    2032    </div>
    2133{% endblock %}
     34{% block sidebarsourcelink %}
     35{%- if show_source and has_source and sourcename %}
     36<h3>{{ _('This Page') }}</h3>
     37<ul class="this-page-menu">
     38  <li><a href="{{ pathto('bugs') }}">Report a Bug</a></li>
     39  <li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
     40         rel="nofollow">Show Source</a></li>
     41</ul>
     42{%- endif %}
     43{% endblock %}
  • python/vendor/current/Doc/tools/sphinxext/patchlevel.py

    r2 r388  
    4242        'PY_RELEASE_LEVEL_ALPHA': 'a',
    4343        'PY_RELEASE_LEVEL_BETA':  'b',
    44         'PY_RELEASE_LEVEL_GAMMA': 'c',
     44        'PY_RELEASE_LEVEL_GAMMA': 'rc',
    4545        }
    4646    if level != 'PY_RELEASE_LEVEL_FINAL':
  • python/vendor/current/Doc/tools/sphinxext/pyspecific.py

    r2 r388  
    66    Sphinx extension with Python doc-specific markup.
    77
    8     :copyright: 2008, 2009 by Georg Brandl.
     8    :copyright: 2008-2013 by Georg Brandl.
    99    :license: Python license.
    1010"""
    1111
    1212ISSUE_URI = 'http://bugs.python.org/issue%s'
     13SOURCE_URI = 'http://hg.python.org/cpython/file/2.7/%s'
    1314
    1415from docutils import nodes, utils
     16
     17import sphinx
     18from sphinx.util.nodes import split_explicit_title
     19from sphinx.writers.html import HTMLTranslator
     20from sphinx.writers.latex import LaTeXTranslator
     21from sphinx.locale import versionlabels
    1522
    1623# monkey-patch reST parser to disable alphabetic and roman enumerated lists
     
    2128    Body.enum.converters['upperroman'] = lambda x: None
    2229
    23 # monkey-patch HTML translator to give versionmodified paragraphs a class
    24 def new_visit_versionmodified(self, node):
    25     self.body.append(self.starttag(node, 'p', CLASS=node['type']))
    26     text = versionlabels[node['type']] % node['version']
    27     if len(node):
    28         text += ': '
    29     else:
    30         text += '.'
    31     self.body.append('<span class="versionmodified">%s</span>' % text)
    32 
    33 from sphinx.writers.html import HTMLTranslator
    34 from sphinx.locale import versionlabels
    35 HTMLTranslator.visit_versionmodified = new_visit_versionmodified
     30if sphinx.__version__[:3] < '1.2':
     31    # monkey-patch HTML translator to give versionmodified paragraphs a class
     32    def new_visit_versionmodified(self, node):
     33        self.body.append(self.starttag(node, 'p', CLASS=node['type']))
     34        text = versionlabels[node['type']] % node['version']
     35        if len(node):
     36            text += ': '
     37        else:
     38            text += '.'
     39        self.body.append('<span class="versionmodified">%s</span>' % text)
     40    HTMLTranslator.visit_versionmodified = new_visit_versionmodified
     41
     42# monkey-patch HTML and LaTeX translators to keep doctest blocks in the
     43# doctest docs themselves
     44orig_visit_literal_block = HTMLTranslator.visit_literal_block
     45def new_visit_literal_block(self, node):
     46    meta = self.builder.env.metadata[self.builder.current_docname]
     47    old_trim_doctest_flags = self.highlighter.trim_doctest_flags
     48    if 'keepdoctest' in meta:
     49        self.highlighter.trim_doctest_flags = False
     50    try:
     51        orig_visit_literal_block(self, node)
     52    finally:
     53        self.highlighter.trim_doctest_flags = old_trim_doctest_flags
     54
     55HTMLTranslator.visit_literal_block = new_visit_literal_block
     56
     57orig_depart_literal_block = LaTeXTranslator.depart_literal_block
     58def new_depart_literal_block(self, node):
     59    meta = self.builder.env.metadata[self.curfilestack[-1]]
     60    old_trim_doctest_flags = self.highlighter.trim_doctest_flags
     61    if 'keepdoctest' in meta:
     62        self.highlighter.trim_doctest_flags = False
     63    try:
     64        orig_depart_literal_block(self, node)
     65    finally:
     66        self.highlighter.trim_doctest_flags = old_trim_doctest_flags
     67
     68LaTeXTranslator.depart_literal_block = new_depart_literal_block
    3669
    3770# Support for marking up and linking to bugs.python.org issues
     
    4174    text = 'issue ' + issue
    4275    refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue)
     76    return [refnode], []
     77
     78
     79# Support for linking to Python source files easily
     80
     81def source_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
     82    has_t, title, target = split_explicit_title(text)
     83    title = utils.unescape(title)
     84    target = utils.unescape(target)
     85    refnode = nodes.reference(title, title, refuri=SOURCE_URI % target)
    4386    return [refnode], []
    4487
     
    72115
    73116
     117# Support for documenting decorators
     118
     119from sphinx import addnodes
     120from sphinx.domains.python import PyModulelevel, PyClassmember
     121
     122class PyDecoratorMixin(object):
     123    def handle_signature(self, sig, signode):
     124        ret = super(PyDecoratorMixin, self).handle_signature(sig, signode)
     125        signode.insert(0, addnodes.desc_addname('@', '@'))
     126        return ret
     127
     128    def needs_arglist(self):
     129        return False
     130
     131class PyDecoratorFunction(PyDecoratorMixin, PyModulelevel):
     132    def run(self):
     133        # a decorator function is a function after all
     134        self.name = 'py:function'
     135        return PyModulelevel.run(self)
     136
     137class PyDecoratorMethod(PyDecoratorMixin, PyClassmember):
     138    def run(self):
     139        self.name = 'py:method'
     140        return PyClassmember.run(self)
     141
     142
     143# Support for documenting version of removal in deprecations
     144
     145from sphinx.locale import versionlabels
     146from sphinx.util.compat import Directive
     147
     148versionlabels['deprecated-removed'] = \
     149    'Deprecated since version %s, will be removed in version %s'
     150
     151class DeprecatedRemoved(Directive):
     152    has_content = True
     153    required_arguments = 2
     154    optional_arguments = 1
     155    final_argument_whitespace = True
     156    option_spec = {}
     157
     158    def run(self):
     159        node = addnodes.versionmodified()
     160        node.document = self.state.document
     161        node['type'] = 'deprecated-removed'
     162        version = (self.arguments[0], self.arguments[1])
     163        node['version'] = version
     164        if len(self.arguments) == 3:
     165            inodes, messages = self.state.inline_text(self.arguments[2],
     166                                                      self.lineno+1)
     167            node.extend(inodes)
     168            if self.content:
     169                self.state.nested_parse(self.content, self.content_offset, node)
     170            ret = [node] + messages
     171        else:
     172            ret = [node]
     173        env = self.state.document.settings.env
     174        env.note_versionchange('deprecated', version[0], node, self.lineno)
     175        return ret
     176
     177
    74178# Support for building "topic help" for pydoc
    75179
     
    78182    'attribute-access', 'attribute-references', 'augassign', 'binary',
    79183    'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object',
    80     'bltin-file-objects', 'bltin-null-object', 'bltin-type-objects', 'booleans',
    81     'break', 'callable-types', 'calls', 'class', 'coercion-rules',
    82     'comparisons', 'compound', 'context-managers', 'continue', 'conversions',
    83     'customization', 'debugger', 'del', 'dict', 'dynamic-features', 'else',
    84     'exceptions', 'exec', 'execmodel', 'exprlists', 'floating', 'for',
    85     'formatstrings', 'function', 'global', 'id-classes', 'identifiers', 'if',
    86     'imaginary', 'import', 'in', 'integers', 'lambda', 'lists', 'naming',
    87     'numbers', 'numeric-types', 'objects', 'operator-summary', 'pass', 'power',
    88     'print', 'raise', 'return', 'sequence-methods', 'sequence-types',
    89     'shifting', 'slicings', 'specialattrs', 'specialnames',
    90     'string-conversions', 'string-methods', 'strings', 'subscriptions', 'truth',
    91     'try', 'types', 'typesfunctions', 'typesmapping', 'typesmethods',
    92     'typesmodules', 'typesseq', 'typesseq-mutable', 'unary', 'while', 'with',
    93     'yield'
     184    'bltin-null-object', 'bltin-type-objects', 'booleans',
     185    'break', 'callable-types', 'calls', 'class', 'comparisons', 'compound',
     186    'context-managers', 'continue', 'conversions', 'customization', 'debugger',
     187    'del', 'dict', 'dynamic-features', 'else', 'exceptions', 'execmodel',
     188    'exprlists', 'floating', 'for', 'formatstrings', 'function', 'global',
     189    'id-classes', 'identifiers', 'if', 'imaginary', 'import', 'in', 'integers',
     190    'lambda', 'lists', 'naming', 'numbers', 'numeric-types',
     191    'objects', 'operator-summary', 'pass', 'power', 'raise', 'return',
     192    'sequence-types', 'shifting', 'slicings', 'specialattrs', 'specialnames',
     193    'string-methods', 'strings', 'subscriptions', 'truth', 'try', 'types',
     194    'typesfunctions', 'typesmapping', 'typesmethods', 'typesmodules',
     195    'typesseq', 'typesseq-mutable', 'unary', 'while', 'with', 'yield'
    94196]
    95197
     
    100202from docutils.utils import new_document
    101203
    102 try:
    103     from sphinx.builders import Builder
    104 except ImportError:
    105     # using Sphinx < 0.6, which has a different package layout
    106     from sphinx.builder import Builder
    107     # monkey-patch toctree directive to accept (and ignore) the :numbered: flag
    108     from sphinx.directives.other import toctree_directive
    109     toctree_directive.options['numbered'] = toctree_directive.options['glob']
    110 
    111 try:
    112     from sphinx.writers.text import TextWriter
    113 except ImportError:
    114     from sphinx.textwriter import TextWriter
     204from sphinx.builders import Builder
     205from sphinx.writers.text import TextWriter
    115206
    116207
     
    129220    def write(self, *ignored):
    130221        writer = TextWriter(self)
    131         for label in self.status_iterator(pydoc_topic_labels, 'building topics... '):
    132             if label not in self.env.labels:
     222        for label in self.status_iterator(pydoc_topic_labels,
     223                                          'building topics... ',
     224                                          length=len(pydoc_topic_labels)):
     225            if label not in self.env.domaindata['std']['labels']:
    133226                self.warn('label %r not in documentation' % label)
    134227                continue
    135             docname, labelid, sectname = self.env.labels[label]
     228            docname, labelid, sectname = self.env.domaindata['std']['labels'][label]
    136229            doctree = self.env.get_and_resolve_doctree(docname, self)
    137230            document = new_document('<section node>')
     
    139232            destination = StringOutput(encoding='utf-8')
    140233            writer.write(document, destination)
    141             self.topics[label] = writer.output
     234            self.topics[label] = str(writer.output)
    142235
    143236    def finish(self):
    144         f = open(path.join(self.outdir, 'pydoc_topics.py'), 'w')
     237        f = open(path.join(self.outdir, 'topics.py'), 'w')
    145238        try:
    146239            f.write('# Autogenerated by Sphinx on %s\n' % asctime())
     
    158251
    159252import re
    160 from sphinx import addnodes
    161 
    162 opcode_sig_re = re.compile(r'(\w+(?:\+\d)?)\s*\((.*)\)')
     253
     254opcode_sig_re = re.compile(r'(\w+(?:\+\d)?)(?:\s*\((.*)\))?')
    163255
    164256def parse_opcode_signature(env, sig, signode):
     
    169261    opname, arglist = m.groups()
    170262    signode += addnodes.desc_name(opname, opname)
    171     paramlist = addnodes.desc_parameterlist()
    172     signode += paramlist
    173     paramlist += addnodes.desc_parameter(arglist, arglist)
     263    if arglist is not None:
     264        paramlist = addnodes.desc_parameterlist()
     265        signode += paramlist
     266        paramlist += addnodes.desc_parameter(arglist, arglist)
    174267    return opname.strip()
     268
     269
     270# Support for documenting pdb commands
     271
     272pdbcmd_sig_re = re.compile(r'([a-z()!]+)\s*(.*)')
     273
     274# later...
     275#pdbargs_tokens_re = re.compile(r'''[a-zA-Z]+  |  # identifiers
     276#                                   [.,:]+     |  # punctuation
     277#                                   [\[\]()]   |  # parens
     278#                                   \s+           # whitespace
     279#                                   ''', re.X)
     280
     281def parse_pdb_command(env, sig, signode):
     282    """Transform a pdb command signature into RST nodes."""
     283    m = pdbcmd_sig_re.match(sig)
     284    if m is None:
     285        raise ValueError
     286    name, args = m.groups()
     287    fullname = name.replace('(', '').replace(')', '')
     288    signode += addnodes.desc_name(name, name)
     289    if args:
     290        signode += addnodes.desc_addname(' '+args, ' '+args)
     291    return fullname
    175292
    176293
    177294def setup(app):
    178295    app.add_role('issue', issue_role)
     296    app.add_role('source', source_role)
    179297    app.add_directive('impl-detail', ImplementationDetail)
     298    app.add_directive('deprecated-removed', DeprecatedRemoved)
    180299    app.add_builder(PydocTopicsBuilder)
    181300    app.add_builder(suspicious.CheckSuspiciousMarkupBuilder)
    182301    app.add_description_unit('opcode', 'opcode', '%s (opcode)',
    183302                             parse_opcode_signature)
     303    app.add_description_unit('pdbcommand', 'pdbcmd', '%s (pdb command)',
     304                             parse_pdb_command)
    184305    app.add_description_unit('2to3fixer', '2to3fixer', '%s (2to3 fixer)')
     306    app.add_directive_to_domain('py', 'decorator', PyDecoratorFunction)
     307    app.add_directive_to_domain('py', 'decoratormethod', PyDecoratorMethod)
  • python/vendor/current/Doc/tools/sphinxext/static/basic.css

    r2 r388  
    3939
    4040div.sphinxsidebarwrapper {
     41    position: relative;
     42    top: 0;
    4143    padding: 10px 5px 0 10px;
     44    word-wrap: break-word;
    4245}
    4346
     
    254257table.docutils td, table.docutils th {
    255258    padding: 2px 5px 2px 5px;
    256     border-left: 0;   
    257     background-color: #eef;   
     259    border-left: 0;
     260    background-color: #eef;
     261}
     262
     263table.docutils td p.last, table.docutils th p.last {
     264    margin-bottom: 0;
    258265}
    259266
     
    267274
    268275table.docutils th {
    269     border-top: 1px solid #cac;   
     276    border-top: 1px solid #cac;
    270277    background-color: #ede;
    271278}
     
    277284
    278285th.head {
    279     text-align: center;   
     286    text-align: center;
    280287}
    281288
     
    330337}
    331338
    332 p.deprecated {
     339.deprecated {
    333340    background-color: #ffe4e4;
    334341    border: 1px solid #f66;
    335     padding: 7px
     342    padding: 7px;
     343}
     344
     345div.deprecated p {
     346    margin-bottom: 0;
    336347}
    337348
     
    343354
    344355.footnote:target  {
    345     background-color: #ffa
     356    background-color: #ffa;
    346357}
    347358
     
    365376pre {
    366377    overflow: auto;
     378    overflow-y: hidden;
    367379}
    368380
  • python/vendor/current/Doc/tools/sphinxext/susp-ignored.csv

    r2 r388  
    11c-api/arg,,:ref,"PyArg_ParseTuple(args, ""O|O:ref"", &object, &callback)"
    22c-api/list,,:high,list[low:high]
    3 c-api/list,,:high,list[low:high] = itemlist
    43c-api/sequence,,:i2,o[i1:i2]
    5 c-api/sequence,,:i2,o[i1:i2] = v
    6 c-api/sequence,,:i2,del o[i1:i2]
    74c-api/unicode,,:end,str[start:end]
    8 distutils/apiref,,:action,http://pypi.python.org/pypi?:action=list_classifiers
    95distutils/setupscript,,::,
    106extending/embedding,,:numargs,"if(!PyArg_ParseTuple(args, "":numargs""))"
     
    139extending/newtypes,,:call,"if (!PyArg_ParseTuple(args, ""sss:call"", &arg1, &arg2, &arg3)) {"
    1410extending/windows,,:initspam,/export:initspam
    15 howto/cporting,,:add,"if (!PyArg_ParseTuple(args, ""ii:add_ints"", &one, &two))"
    1611howto/cporting,,:encode,"if (!PyArg_ParseTuple(args, ""O:encode_object"", &myobj))"
    1712howto/cporting,,:say,"if (!PyArg_ParseTuple(args, ""U:say_hello"", &name))"
     
    2419howto/curses,,:white,"7:white."
    2520howto/curses,,:yellow,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
     21howto/logging,,:root,WARNING:root:Watch out!
     22howto/logging,,:Watch,WARNING:root:Watch out!
     23howto/logging,,:root,DEBUG:root:This message should go to the log file
     24howto/logging,,:root,INFO:root:So should this
     25howto/logging,,:So,INFO:root:So should this
     26howto/logging,,:root,"WARNING:root:And this, too"
     27howto/logging,,:And,"WARNING:root:And this, too"
     28howto/logging,,:root,INFO:root:Started
     29howto/logging,,:Started,INFO:root:Started
     30howto/logging,,:root,INFO:root:Doing something
     31howto/logging,,:Doing,INFO:root:Doing something
     32howto/logging,,:root,INFO:root:Finished
     33howto/logging,,:Finished,INFO:root:Finished
     34howto/logging,,:root,WARNING:root:Look before you leap!
     35howto/logging,,:Look,WARNING:root:Look before you leap!
     36howto/logging,,:This,DEBUG:This message should appear on the console
     37howto/logging,,:So,INFO:So should this
     38howto/logging,,:And,"WARNING:And this, too"
     39howto/logging,,:logger,severity:logger name:message
     40howto/logging,,:message,severity:logger name:message
     41howto/logging,,:This,DEBUG:root:This message should go to the log file
    2642howto/regex,,::,
    2743howto/regex,,:foo,(?:foo)
    2844howto/urllib2,,:example,"for example ""joe@password:example.com"""
    29 howto/webservers,,.. image:,.. image:: http.png
    3045library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)],"
     46library/cookie,,`,!#$%&'*+-.^_`|~
    3147library/datetime,,:MM,
    3248library/datetime,,:SS,
     
    4258library/doctest,,`,The ``example`` module
    4359library/doctest,,`,Using ``factorial``
     60library/exceptions,,:err,err.object[err.start:err.end]
    4461library/functions,,:step,a[start:stop:step]
    4562library/functions,,:stop,"a[start:stop, i]"
     
    4764library/hotshot,,:lineno,"ncalls  tottime  percall  cumtime  percall filename:lineno(function)"
    4865library/httplib,,:port,host:port
    49 library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
    50 library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
     66library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS"
     67library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS"
    5168library/itertools,,:stop,elements from seq[start:stop:step]
    5269library/itertools,,:step,elements from seq[start:stop:step]
    5370library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh"
    54 library/logging,,:And,
    55 library/logging,,:package1,
    56 library/logging,,:package2,
    57 library/logging,,:root,
    58 library/logging,,:This,
    59 library/logging,,:port,host:port
     71library/logging.handlers,,:port,host:port
    6072library/mmap,,:i2,obj[i1:i2]
    6173library/multiprocessing,,:queue,">>> QueueManager.register('get_queue', callable=lambda:queue)"
     
    6779library/multiprocessing,,`,# A test of `multiprocessing.Pool` class
    6880library/multiprocessing,,`,# Add more tasks using `put()`
    69 library/multiprocessing,,`,# create server for a `HostManager` object
    70 library/multiprocessing,,`,# Depends on `multiprocessing` package -- tested with `processing-0.60`
    7181library/multiprocessing,,`,# in the original order then consider using `Pool.map()` or
    7282library/multiprocessing,,`,# Not sure if we should synchronize access to `socket.accept()` method by
     
    7585library/multiprocessing,,`,# register the Foo class; make `g()` and `_h()` accessible via proxy
    7686library/multiprocessing,,`,# register the generator function baz; use `GeneratorProxy` to make proxies
    77 library/multiprocessing,,`,`Cluster` is a subclass of `SyncManager` so it allows creation of
    78 library/multiprocessing,,`,`hostname` gives the name of the host.  If hostname is not
    79 library/multiprocessing,,`,`slots` is used to specify the number of slots for processes on
    8087library/optparse,,:len,"del parser.rargs[:len(value)]"
    8188library/os.path,,:foo,c:foo
    82 library/parser,,`,"""Make a function that raises an argument to the exponent `exp`."""
     89library/pdb,,:lineno,filename:lineno
    8390library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS"""
    8491library/profile,,:lineno,ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     
    8693library/pyexpat,,:elem1,<py:elem1 />
    8794library/pyexpat,,:py,"xmlns:py = ""http://www.python.org/ns/"">"
    88 library/repr,,`,"return `obj`"
    8995library/smtplib,,:port,"as well as a regular host:port server."
    9096library/socket,,::,'5aef:2b::8'
    9197library/sqlite3,,:memory,
    92 library/sqlite3,,:age,"select name_last, age from people where name_last=:who and age=:age"
    93 library/sqlite3,,:who,"select name_last, age from people where name_last=:who and age=:age"
     98library/sqlite3,,:who,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})"
     99library/sqlite3,,:age,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})"
    94100library/ssl,,:My,"Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc."
    95101library/ssl,,:My,"Organizational Unit Name (eg, section) []:My Group"
     
    100106library/ssl,,:US,Country Name (2 letter code) [AU]:US
    101107library/stdtypes,,:len,s[len(s):len(s)]
    102 library/stdtypes,,:len,s[len(s):len(s)]
    103 library/string,,:end,s[start:end]
    104108library/string,,:end,s[start:end]
    105109library/subprocess,,`,"output=`mycmd myarg`"
     
    123127reference/datamodel,,:max,
    124128reference/expressions,,:index,x[index:index]
    125 reference/expressions,,:datum,{key:datum...}
    126129reference/expressions,,`,`expressions...`
    127 reference/grammar,,:output,#diagram:output
    128 reference/grammar,,:rules,#diagram:rules
    129 reference/grammar,,:token,#diagram:token
     130reference/expressions,,`,"""`"""
    130131reference/grammar,,`,'`' testlist1 '`'
    131132reference/lexical_analysis,,:fileencoding,# vim:fileencoding=<encoding-name>
     
    150151using/cmdline,,:module,action:message:category:module:line
    151152using/cmdline,,:errorhandler,:errorhandler
    152 using/windows,162,`,`` this fixes syntax highlighting errors in some editors due to the \\\\ hackery
    153 using/windows,170,`,``
    154153whatsnew/2.0,418,:len,
    155154whatsnew/2.3,,::,
     
    165164whatsnew/2.5,,:step,[start:stop:step]
    166165whatsnew/2.5,,:stop,[start:stop:step]
     166faq/programming,,:reduce,"print (lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,"
     167faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,"
     168faq/programming,,:chr,">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr("
     169faq/programming,,::,for x in sequence[::-1]:
     170library/bisect,,:hi,all(val >= x for val in a[i:hi])
     171library/bisect,,:hi,all(val > x for val in a[i:hi])
     172library/socket,,::,"(10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))]"
     173library/stdtypes,,:end,s[start:end]
     174license,,`,* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
     175license,,`,* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
     176license,,`,"``Software''), to deal in the Software without restriction, including"
     177license,,`,"THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,"
     178whatsnew/2.7,735,:Sunday,'2009:4:Sunday'
     179whatsnew/2.7,862,::,"export PYTHONWARNINGS=all,error:::Cookie:0"
     180whatsnew/2.7,862,:Cookie,"export PYTHONWARNINGS=all,error:::Cookie:0"
     181whatsnew/2.7,,::,>>> urlparse.urlparse('http://[1080::8:800:200C:417A]/foo')
     182whatsnew/2.7,,::,"ParseResult(scheme='http', netloc='[1080::8:800:200C:417A]',"
     183howto/pyporting,75,::,# make sure to use :: Python *and* :: Python :: 3 so
     184howto/pyporting,75,::,"'Programming Language :: Python',"
     185howto/pyporting,75,::,'Programming Language :: Python :: 3'
     186library/urllib2,67,:close,Connection:close
  • python/vendor/current/Doc/tools/sphinxext/suspicious.py

    r2 r388  
    4242"""
    4343
    44 import os, sys
     44import os
     45import re
    4546import csv
    46 import re
     47import sys
     48
    4749from docutils import nodes
    48 
    49 try:
    50     from sphinx.builders import Builder
    51 except ImportError:
    52     from sphinx.builder import Builder
    53 
     50from sphinx.builders import Builder
    5451
    5552detect_all = re.compile(ur'''
     
    6057    ''', re.UNICODE | re.VERBOSE).finditer
    6158
     59
    6260class Rule:
    6361    def __init__(self, docname, lineno, issue, line):
    64         "A rule for ignoring issues"
     62        """A rule for ignoring issues"""
    6563        self.docname = docname # document to which this rule applies
    6664        self.lineno = lineno   # line number in the original source;
     
    6967        self.issue = issue     # the markup fragment that triggered this rule
    7068        self.line = line       # text of the container element (single line only)
     69        self.used = False
     70
     71    def __repr__(self):
     72        return '{0.docname},,{0.issue},{0.line}'.format(self)
     73
     74
     75
     76class dialect(csv.excel):
     77    """Our dialect: uses only linefeed as newline."""
     78    lineterminator = '\n'
    7179
    7280
    7381class CheckSuspiciousMarkupBuilder(Builder):
    7482    """
    75     Checks for possibly invalid markup that may leak into the output
     83    Checks for possibly invalid markup that may leak into the output.
    7684    """
    7785    name = 'suspicious'
     
    8290        open(self.log_file_name, 'w').close()
    8391        # load database of previously ignored issues
    84         self.load_rules(os.path.join(os.path.dirname(__file__), 'susp-ignored.csv'))
     92        self.load_rules(os.path.join(os.path.dirname(__file__),
     93                                     'susp-ignored.csv'))
    8594
    8695    def get_outdated_docs(self):
     
    91100
    92101    def prepare_writing(self, docnames):
    93         ### PYTHON PROJECT SPECIFIC ###
    94         for name in set(docnames):
    95             if name.split('/', 1)[0] == 'documenting':
    96                 docnames.remove(name)
    97         ### PYTHON PROJECT SPECIFIC ###
     102        pass
    98103
    99104    def write_doc(self, docname, doctree):
    100         self.any_issue = False # set when any issue is encountered in this document
     105        # set when any issue is encountered in this document
     106        self.any_issue = False
    101107        self.docname = docname
    102108        visitor = SuspiciousVisitor(doctree, self)
     
    104110
    105111    def finish(self):
     112        unused_rules = [rule for rule in self.rules if not rule.used]
     113        if unused_rules:
     114            self.warn('Found %s/%s unused rules:' %
     115                      (len(unused_rules), len(self.rules)))
     116            for rule in unused_rules:
     117                self.info(repr(rule))
    106118        return
    107119
     
    111123
    112124    def is_ignored(self, line, lineno, issue):
    113         """Determine whether this issue should be ignored.
    114         """
     125        """Determine whether this issue should be ignored."""
    115126        docname = self.docname
    116127        for rule in self.rules:
     
    129140                abs(rule.lineno - lineno) > 5: continue
    130141            # if it came this far, the rule matched
     142            rule.used = True
    131143            return True
    132144        return False
     
    145157    def write_log_entry(self, lineno, issue, text):
    146158        f = open(self.log_file_name, 'ab')
    147         writer = csv.writer(f)
     159        writer = csv.writer(f, dialect)
    148160        writer.writerow([self.docname.encode('utf-8'),
    149                 lineno,
    150                 issue.encode('utf-8'),
    151                 text.strip().encode('utf-8')])
    152         del writer
     161                         lineno,
     162                         issue.encode('utf-8'),
     163                         text.strip().encode('utf-8')])
    153164        f.close()
    154165
     
    165176        for i, row in enumerate(csv.reader(f)):
    166177            if len(row) != 4:
    167                 raise ValueError("wrong format in %s, line %d: %s" % (filename, i+1, row))
     178                raise ValueError(
     179                    "wrong format in %s, line %d: %s" % (filename, i+1, row))
    168180            docname, lineno, issue, text = row
    169181            docname = docname.decode('utf-8')
     
    179191
    180192def get_lineno(node):
    181     "Obtain line number information for a node"
     193    """Obtain line number information for a node."""
    182194    lineno = None
    183195    while lineno is None and node:
     
    204216    p = text.rfind('\n', 0, index) + 1
    205217    q = text.find('\n', index)
    206     if q<0: q = len(text)
     218    if q < 0:
     219        q = len(text)
    207220    return text[p:q]
    208221
     
    223236            seen = set() # don't report the same issue more than only once per line
    224237            for match in detect_all(text):
    225                 #import pdb; pdb.set_trace()
    226238                issue = match.group()
    227239                line = extract_line(text, match.start())
Note: See TracChangeset for help on using the changeset viewer.