Merging PR_218 openai_rev package with new streamlit chat app
This commit is contained in:
28
venv/lib/python3.9/site-packages/validators/slug.py
Normal file
28
venv/lib/python3.9/site-packages/validators/slug.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import re
|
||||
|
||||
from .utils import validator
|
||||
|
||||
slug_regex = re.compile(r'^[-a-zA-Z0-9_]+$')
|
||||
|
||||
|
||||
@validator
|
||||
def slug(value):
|
||||
"""
|
||||
Validate whether or not given value is valid slug.
|
||||
|
||||
Valid slug can contain only alphanumeric characters, hyphens and
|
||||
underscores.
|
||||
|
||||
Examples::
|
||||
|
||||
>>> slug('my.slug')
|
||||
ValidationFailure(func=slug, args={'value': 'my.slug'})
|
||||
|
||||
>>> slug('my-slug-2134')
|
||||
True
|
||||
|
||||
.. versionadded:: 0.6
|
||||
|
||||
:param value: value to validate
|
||||
"""
|
||||
return slug_regex.match(value)
|
||||
Reference in New Issue
Block a user