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

Unified Diff: doxypypy/doxypypy/test/sample_docexample.outbare.py

Issue 1574883002: add doxypypy and py_filter so this will turn google style (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 11 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
Index: doxypypy/doxypypy/test/sample_docexample.outbare.py
diff --git a/doxypypy/doxypypy/test/sample_docexample.outbare.py b/doxypypy/doxypypy/test/sample_docexample.outbare.py
new file mode 100644
index 0000000000000000000000000000000000000000..7ecd0b50a60367854969ab9b9e204733fd27cf1c
--- /dev/null
+++ b/doxypypy/doxypypy/test/sample_docexample.outbare.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+##
+#Documentation Example
+#
+#This is the example used in the doxypypy documentation.
+#It demonstrates basic docstring usage (including doctests).
+#
+
+
+##
+# Does nothing more than demonstrate syntax.
+#
+# This is an example of how a Pythonic human-readable docstring can
+# get parsed by doxypypy and marked up with Doxygen commands as a
+# regular input filter to Doxygen.
+#
+# Args:
+# arg1: A positional argument.
+# arg2: Another positional argument.
+#
+# Kwargs:
+# kwarg: A keyword argument.
+#
+# Returns:
+# A string holding the result.
+#
+# Raises:
+# ZeroDivisionError, AssertionError, & ValueError.
+#
+# Examples:
+# >>> myfunction(2, 3)
+# '5 - 0, whatever.'
+# >>> myfunction(5, 0, 'oops.')
+# Traceback (most recent call last):
+# ...
+# ZeroDivisionError: integer division or modulo by zero
+# >>> myfunction(4, 1, 'got it.')
+# '5 - 4, got it.'
+# >>> myfunction(23.5, 23, 'oh well.')
+# Traceback (most recent call last):
+# ...
+# AssertionError
+# >>> myfunction(5, 50, 'too big.')
+# Traceback (most recent call last):
+# ...
+# ValueError
+#
+def myfunction(arg1, arg2, kwarg='whatever.'):
+ assert isinstance(arg1, int)
+ if arg2 > 23:
+ raise ValueError
+ return '{0} - {1}, {2}'.format(arg1 + arg2, arg1 / arg2, kwarg)
+
+if __name__ == "__main__":
+ import doctest
+ doctest.testmod()

Powered by Google App Engine
This is Rietveld 408576698