GeezerVison is showing github.com — Add output to bottom of scripts · stevencoding/python-patterns@f61504c
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: 3-tier.py +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -56,3 +56,17 @@ def main(): | 56 | 56 |
| 57 | 57 | if __name__ == '__main__': | 58 | 58 | main() | | 59 | + | | 60 | +### OUTPUT ### | | 61 | +# PRODUCT LIST: | | 62 | +# eggs | | 63 | +# milk | | 64 | +# cheese | | 65 | +# | | 66 | +# PRODUCT INFORMATION: | | 67 | +# Name: Cheese, Price: 2.00, Quantity: 10 | | 68 | +# PRODUCT INFORMATION: | | 69 | +# Name: Eggs, Price: 0.20, Quantity: 100 | | 70 | +# PRODUCT INFORMATION: | | 71 | +# Name: Milk, Price: 1.50, Quantity: 10 | | 72 | +# That product "arepas" does not exist in the records |
Collapse file Copy file name to clipboardExpand all lines: abstract_factory.py +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -76,3 +76,17 @@ def get_factory(): | 76 | 76 | shop.pet_factory = get_factory() | 77 | 77 | shop.show_pet() | 78 | 78 | print("=" * 20) | | 79 | + | | 80 | +### OUTPUT ### | | 81 | +# This is a lovely Dog | | 82 | +# It says woof | | 83 | +# It eats dog food | | 84 | +# ==================== | | 85 | +# This is a lovely Cat | | 86 | +# It says meow | | 87 | +# It eats cat food | | 88 | +# ==================== | | 89 | +# This is a lovely Dog | | 90 | +# It says woof | | 91 | +# It eats dog food | | 92 | +# ==================== |
Collapse file Copy file name to clipboardExpand all lines: adapter.py +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -91,3 +91,6 @@ def main(): | 91 | 91 | if __name__ == "__main__": | 92 | 92 | import doctest | 93 | 93 | doctest.testmod() | | 94 | + | | 95 | +### OUTPUT ### | | 96 | + |
Collapse file Copy file name to clipboardExpand all lines: borg.py +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,3 +38,14 @@ class YourBorg(Borg): | 38 | 38 | print('rm1: {0}'.format(rm1)) | 39 | 39 | print('rm2: {0}'.format(rm2)) | 40 | 40 | print('rm3: {0}'.format(rm3)) | | 41 | + | | 42 | +### OUTPUT ### | | 43 | +# rm1: Running | | 44 | +# rm2: Running | | 45 | +# rm1: Zombie | | 46 | +# rm2: Zombie | | 47 | +# rm1 id: 139825262601040 | | 48 | +# rm2 id: 139825262601104 | | 49 | +# rm1: Zombie | | 50 | +# rm2: Zombie | | 51 | +# rm3: Zombie |
Collapse file Copy file name to clipboardExpand all lines: bridge.py +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,3 +46,7 @@ def main(): | 46 | 46 |
| 47 | 47 | if __name__ == '__main__': | 48 | 48 | main() | | 49 | + | | 50 | +### OUTPUT ### | | 51 | +# API1.circle at 1:2 radius 7.5 | | 52 | +# API2.circle at 5:7 radius 27.5 |
Collapse file Copy file name to clipboardExpand all lines: builder.py +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -68,3 +68,7 @@ def __repr__(self): | 68 | 68 | director.construct_building() | 69 | 69 | building = director.get_building() | 70 | 70 | print(building) | | 71 | + | | 72 | +### OUTPUT ### | | 73 | +# Floor: One | Size: Big | | 74 | +# Floor: More than One | Size: Small |
Collapse file Copy file name to clipboardExpand all lines: catalog.py +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -58,3 +58,6 @@ def main(): | 58 | 58 |
| 59 | 59 | if __name__ == "__main__": | 60 | 60 | main() | | 61 | + | | 62 | +### OUTPUT ### | | 63 | +# executed method 2! |
Collapse file Copy file name to clipboardExpand all lines: chain.py +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -53,3 +53,14 @@ def delegate(self, requests): | 53 | 53 | client = Client() | 54 | 54 | requests = [2, 5, 14, 22, 18, 3, 35, 27, 20] | 55 | 55 | client.delegate(requests) | | 56 | + | | 57 | +### OUTPUT ### | | 58 | +# request 2 handled in handler 1 | | 59 | +# request 5 handled in handler 1 | | 60 | +# request 14 handled in handler 2 | | 61 | +# request 22 handled in handler 3 | | 62 | +# request 18 handled in handler 2 | | 63 | +# request 3 handled in handler 1 | | 64 | +# end of chain, no handler for 35 | | 65 | +# request 27 handled in handler 3 | | 66 | +# request 20 handled in handler 2 |
Collapse file Copy file name to clipboardExpand all lines: command.py +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,3 +38,9 @@ def main(): | 38 | 38 |
| 39 | 39 | if __name__ == "__main__": | 40 | 40 | main() | | 41 | + | | 42 | +### OUTPUT ### | | 43 | +# renaming foo.txt to bar.txt | | 44 | +# renaming bar.txt to baz.txt | | 45 | +# renaming baz.txt to bar.txt | | 46 | +# renaming bar.txt to foo.txt |
Collapse file Copy file name to clipboardExpand all lines: composite.py +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -332,3 +332,7 @@ def addChild2(self, child): | 332 | 332 | # print(window.Frame.Button2) | 333 | 333 | print(window.Frame.Button1.label) | 334 | 334 | print(window.Frame.Button2.label) | | 335 | + | | 336 | +### OUTPUT ### | | 337 | +# Submit | | 338 | +# Browse |
|