fix
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import hashlib
|
||||
import random
|
||||
import string
|
||||
|
||||
|
||||
def first_word(s: str) -> str:
|
||||
@@ -13,6 +15,11 @@ def truncate_str(s: str, maxlen: int = 30) -> str:
|
||||
return s[: maxlen - 3] + '...'
|
||||
|
||||
|
||||
def random_str(maxlen: int = 10) -> str:
|
||||
"""Returns a random string of letters."""
|
||||
return ''.join(random.choice(string.ascii_letters) for _ in range(maxlen))
|
||||
|
||||
|
||||
def md5_hash(s: str) -> str:
|
||||
"""Computes the MD5 hash of a string."""
|
||||
return hashlib.md5(s.encode()).hexdigest()
|
||||
|
||||
Reference in New Issue
Block a user