Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / third_party / cython / src / Tools / cython-epydoc.py
blob66e74019e19a3ead04a919feb7346b60ba2dbd21
1 #! /usr/bin/env python
3 # --------------------------------------------------------------------
5 import re
6 from epydoc import docstringparser as dsp
8 CYTHON_SIGNATURE_RE = re.compile(
9 # Class name (for builtin methods)
10 r'^\s*((?P<class>\w+)\.)?' +
11 # The function name
12 r'(?P<func>\w+)' +
13 # The parameters
14 r'\(((?P<self>(?:self|cls|mcs)),?)?(?P<params>.*)\)' +
15 # The return value (optional)
16 r'(\s*(->)\s*(?P<return>\w+(?:\s*\w+)))?' +
17 # The end marker
18 r'\s*(?:\n|$)')
20 parse_signature = dsp.parse_function_signature
22 def parse_function_signature(func_doc, doc_source,
23 docformat, parse_errors):
24 PYTHON_SIGNATURE_RE = dsp._SIGNATURE_RE
25 assert PYTHON_SIGNATURE_RE is not CYTHON_SIGNATURE_RE
26 try:
27 dsp._SIGNATURE_RE = CYTHON_SIGNATURE_RE
28 found = parse_signature(func_doc, doc_source,
29 docformat, parse_errors)
30 dsp._SIGNATURE_RE = PYTHON_SIGNATURE_RE
31 if not found:
32 found = parse_signature(func_doc, doc_source,
33 docformat, parse_errors)
34 return found
35 finally:
36 dsp._SIGNATURE_RE = PYTHON_SIGNATURE_RE
38 dsp.parse_function_signature = parse_function_signature
40 # --------------------------------------------------------------------
42 from epydoc.cli import cli
43 cli()
45 # --------------------------------------------------------------------