Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
attach tohou titles to developer roles
#!/usr/bin/env python
import random
class ThCredits:
""" Attaches fancy titles to developer roles """
_epithets = [
"nine-tailed %s",
"ordinary %s",
"perfect and elegant %s",
"%s hiding in the darkness",
"the %s of knowledge and shade",
"hyperactive monster %s",
"superficially busy %s",
"%s that lurks in the boundary",
"traditional %s of fantasy",
"%s of the riverside mist",
"supreme %s of paradise",
"horizontal thinking %s"
]
@classmethod
def attach(self, developers):
""" Returns developrs list with titles attached """
epithet_index = 0
previous_epithet_index = 0
epithets_number = len(self._epithets) - 1
for name in developers:
while True:
epithet_index = random.randint(0, epithets_number)
if (epithet_index != previous_epithet_index):
developers[name] = self._epithets[epithet_index] % developers[name]
previous_epithet_index = epithet_index
break
return developers
# Usage example:
# developers = {"Joe": "architect", "Fred": "programmer", "Mary": "QA specialist", "Alice": "technical writer"}
# developers = ThCredits.attach(developers)
# print developers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment