From 19af0e7499c03540d147f95a5886e85736f7be9b Mon Sep 17 00:00:00 2001 From: Arthur Gunn Date: Mon, 22 Apr 2013 22:23:12 +1200 Subject: [PATCH] Added the 'gunn' function. --- socode.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/socode.py b/socode.py index 7fdb2cf..e975899 100755 --- a/socode.py +++ b/socode.py @@ -28,6 +28,35 @@ import urllib2 import platform +from cStringIO import StringIO + + +# WARNING: call only if very cool: +def gunn(n=3): + caller = inspect.stack()[1][3] + + if caller != "": + sysStdOut = sys.stdout + sys.stdout = StringIO() + + shazeline(caller) + out = sys.stdout.getvalue() + + sys.stdout.close() + sys.stdout = sysStdOut + + print "\n"+out.replace("pretty", "VERY").replace("\n", "!!!\n") + + members = inspect.getmembers(sys.modules[__name__]) + names = [name for name, obj in members if inspect.isfunction(obj) and name!="lafin"] + random.shuffle(names) + coolGuys = names[:n] + + [shazeline(name) for name in coolGuys] + + if caller != "gunn" and random.random() > 0.6: gunn(0) + print + def alisnic(number): print 'fizz' * (number % 3 == 0) + 'buzz' * (number % 5 == 0) @@ -615,6 +644,7 @@ def dpayne(): windspy() samlabs821() alisnic(random.randint(1, 1024)) + gunn() # as per instructed, please leave this as the final function lafin()