aboutsummaryrefslogtreecommitdiff
path: root/repos/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'repos/base.py')
-rw-r--r--repos/base.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/repos/base.py b/repos/base.py
index 3537f05..c20853a 100644
--- a/repos/base.py
+++ b/repos/base.py
@@ -11,14 +11,18 @@ import semver
__all__ = [
'Repository',
+ 'slug',
'Version',
]
HTTP_DATE = '%a, %d %b %Y %H:%M:%S GMT'
SLUGIFY = re.compile(r'\W+')
-def slug(text: str) -> str:
- return SLUGIFY.sub('-', text.lower()).strip('-')
+def slug(text: Optional[str]) -> str:
+ if text is None:
+ return ''
+ else:
+ return SLUGIFY.sub('-', text.lower()).strip('-')
@total_ordering
@dataclass()