From 588c46173e28abb50d7b176ff09b383e0b7b0a09 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Mon, 29 Mar 2021 19:10:24 -0600 Subject: allow overriding package names in specific repos --- repos/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'repos/base.py') 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() -- cgit v1.2.3