Move utilities to seperate file

This commit is contained in:
Joscha 2017-04-03 20:36:27 +00:00
parent 2529c2d238
commit 966034bdde
2 changed files with 21 additions and 3 deletions

View file

@ -1,8 +1,5 @@
import time import time
def mention(name):
return "".join(c for c in name if not c in ".!?;&<'\"" and not c.isspace())
class SessionView(): class SessionView():
""" """
This class keeps track of session details. This class keeps track of session details.

21
yaboli/utils.py Normal file
View file

@ -0,0 +1,21 @@
def mention(name):
"""
mention(name) -> name
Removes all whitespace and some special characters from the name,
such that the resulting name, if prepended with a "@", will mention the user.
"""
return "".join(c for c in name if not c in ".!?;&<'\"" and not c.isspace())
def reduce_name(name):
"""
reduce_name(name) -> name
Reduces a name to a form which can be compared with other such forms.
If two such forms are equal, they are both mentioned by the same @mentions,
and should be considered identical when used to identify users.
"""
#TODO: implement
pass