diff options
author | Melody Horn <melody@boringcactus.com> | 2021-03-29 19:10:24 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-03-29 19:10:24 -0600 |
commit | 588c46173e28abb50d7b176ff09b383e0b7b0a09 (patch) | |
tree | c117d2bea30025dbf56cdab51e6fa1dec4c70301 /repos/base.py | |
parent | 72c0ecc21f571bba38c889c57be0ba53aa72c015 (diff) | |
download | where-packaged-588c46173e28abb50d7b176ff09b383e0b7b0a09.tar.gz where-packaged-588c46173e28abb50d7b176ff09b383e0b7b0a09.zip |
allow overriding package names in specific repos
Diffstat (limited to 'repos/base.py')
-rw-r--r-- | repos/base.py | 8 |
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() |