pesterchum/quirks/defaults.py

35 lines
610 B
Python
Raw Normal View History

"""Default quirk functions that are always included with Pesterchum."""
2011-06-07 11:48:35 -04:00
import random
def upperrep(text: str):
"""Returns 'text' as uppercase."""
2011-06-07 11:48:35 -04:00
return text.upper()
2011-06-07 11:48:35 -04:00
upperrep.command = "upper"
def lowerrep(text: str):
"""Returns 'text' as lowercase."""
2011-06-07 11:48:35 -04:00
return text.lower()
2011-06-07 11:48:35 -04:00
lowerrep.command = "lower"
def scramblerep(text: str):
"""Returns 'text' randomly scrambled."""
2011-06-07 11:48:35 -04:00
return "".join(random.sample(text, len(text)))
2011-06-07 11:48:35 -04:00
scramblerep.command = "scramble"
def reverserep(text: str):
"""Returns the reverse of 'text'."""
2011-06-07 11:48:35 -04:00
return text[::-1]
2011-06-07 11:48:35 -04:00
reverserep.command = "reverse"