Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Unified Diff: third_party/cython/src/Tools/cython-epydoc.py

Issue 385073004: Adding cython v0.20.2 in third-party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reference cython dev list thread. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/cython/src/Tools/cython.st ('k') | third_party/cython/src/Tools/cython-mode.el » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/cython/src/Tools/cython-epydoc.py
diff --git a/third_party/cython/src/Tools/cython-epydoc.py b/third_party/cython/src/Tools/cython-epydoc.py
new file mode 100644
index 0000000000000000000000000000000000000000..66e74019e19a3ead04a919feb7346b60ba2dbd21
--- /dev/null
+++ b/third_party/cython/src/Tools/cython-epydoc.py
@@ -0,0 +1,45 @@
+#! /usr/bin/env python
+
+# --------------------------------------------------------------------
+
+import re
+from epydoc import docstringparser as dsp
+
+CYTHON_SIGNATURE_RE = re.compile(
+ # Class name (for builtin methods)
+ r'^\s*((?P<class>\w+)\.)?' +
+ # The function name
+ r'(?P<func>\w+)' +
+ # The parameters
+ r'\(((?P<self>(?:self|cls|mcs)),?)?(?P<params>.*)\)' +
+ # The return value (optional)
+ r'(\s*(->)\s*(?P<return>\w+(?:\s*\w+)))?' +
+ # The end marker
+ r'\s*(?:\n|$)')
+
+parse_signature = dsp.parse_function_signature
+
+def parse_function_signature(func_doc, doc_source,
+ docformat, parse_errors):
+ PYTHON_SIGNATURE_RE = dsp._SIGNATURE_RE
+ assert PYTHON_SIGNATURE_RE is not CYTHON_SIGNATURE_RE
+ try:
+ dsp._SIGNATURE_RE = CYTHON_SIGNATURE_RE
+ found = parse_signature(func_doc, doc_source,
+ docformat, parse_errors)
+ dsp._SIGNATURE_RE = PYTHON_SIGNATURE_RE
+ if not found:
+ found = parse_signature(func_doc, doc_source,
+ docformat, parse_errors)
+ return found
+ finally:
+ dsp._SIGNATURE_RE = PYTHON_SIGNATURE_RE
+
+dsp.parse_function_signature = parse_function_signature
+
+# --------------------------------------------------------------------
+
+from epydoc.cli import cli
+cli()
+
+# --------------------------------------------------------------------
« no previous file with comments | « third_party/cython/src/Tools/cython.st ('k') | third_party/cython/src/Tools/cython-mode.el » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698