make argument naming more consistent (input) -> (inp)

This commit is contained in:
Ryan Hitchman 2009-11-18 18:49:51 -07:00
parent 1f1b6396e7
commit 42270718e9
4 changed files with 13 additions and 13 deletions

View File

@ -12,10 +12,10 @@ MAX_STEPS = 1000000
@hook.command
def bf(input):
def bf(inp):
"""Runs a Brainfuck program."""
program = re.sub('[^][<>+-.,]', '', input)
program = re.sub('[^][<>+-.,]', '', inp)
# create a dict of brackets pairs, for speed later on
brackets={}

View File

@ -30,13 +30,13 @@ def nrolls(count, n):
@hook.command
def dice(input):
def dice(inp):
".dice <diceroll> - simulates dicerolls, e.g. .dice 2d20-d5+4 roll 2 " \
"D20s, subtract 1D5, add 4"
if not input.strip():
if not inp.strip():
return dice.__doc__
spec = whitespace_re.sub('', input)
spec = whitespace_re.sub('', inp)
if not valid_diceroll_re.match(spec):
return "Invalid diceroll"
sum = 0

View File

@ -4,16 +4,16 @@ from util import hook
@hook.command
def md5(input):
return hashlib.md5(input).hexdigest()
def md5(inp):
return hashlib.md5(inp).hexdigest()
@hook.command
def sha1(input):
return hashlib.sha1(input).hexdigest()
def sha1(inp):
return hashlib.sha1(inp).hexdigest()
@hook.command
def hash(input):
return ', '.join(x + ": " + getattr(hashlib, x)(input).hexdigest()
def hash(inp):
return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest()
for x in 'md5 sha1 sha256'.split())

View File

@ -8,9 +8,9 @@ re_lineends = re.compile(r'[\r\n]*')
@hook.command
def py(input):
def py(inp):
res = urllib.urlopen("http://eval.appspot.com/eval?statement=%s" %
urllib.quote(input.strip(), safe='')).readlines()
urllib.quote(inp.strip(), safe='')).readlines()
if len(res) == 0:
return
res[0] = re_lineends.split(res[0])[0]