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

Unified Diff: doxypypy/doxypypy/test/sample_maze.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_maze.outbare.py
diff --git a/doxypypy/doxypypy/test/sample_maze.outbare.py b/doxypypy/doxypypy/test/sample_maze.outbare.py
new file mode 100644
index 0000000000000000000000000000000000000000..b1cada58b99f01f0eb3ad828e7a02089b54a7742
--- /dev/null
+++ b/doxypypy/doxypypy/test/sample_maze.outbare.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+##
+#Generate a simple maze pattern.
+#
+#Tip of the hat to both the original Commodore 64 program and the book
+#"10 Print Chr$(205.5+rnd(1)); Goto 10" that it inspired.
+#
+#Note that this is neither the shortest nor the most faithful way to
+#write this program in Python. Rather it is being used as a simple
+#example for the doxypypy Doxygen input filter for Python and makes use
+#of features like keyword arguments and generators and has a docstring
+#that documents them both appropriately.
+#
+
+from sys import stdout
+from random import choice
+
+
+##
+# Generates a single block of a maze.
+#
+# This simple generator randomly picks a character from a list (the two
+# diagonal lines by default) and returns it on each iteration.
+#
+# Kwargs:
+# blockOptions -- The list of characters to choose from.
+#
+# Yields:
+# A single character chosen from blockOptions.
+#
+def generateBlock(blockOptions=u"╱╲"):
+ while True:
+ yield choice(blockOptions)
+
+# Establish our block generator and generate a series of blocks.
+blockGenerator = generateBlock()
+blockCount = 0
+while blockCount < 3200:
+ blockCount += 1
+ print(next(blockGenerator)),
+ # Deal with Python's extra space print weirdness.
+ stdout.softspace = False

Powered by Google App Engine
This is Rietveld 408576698