diff options
-rw-r--r-- | repos/base.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/repos/base.py b/repos/base.py index c7790c1..3537f05 100644 --- a/repos/base.py +++ b/repos/base.py @@ -4,7 +4,7 @@ import gzip import json from pathlib import Path import re -from typing import Any, Callable, Mapping +from typing import Any, Callable, Mapping, Optional import requests import semver @@ -55,16 +55,22 @@ class JSONDecoder(json.JSONDecoder): @dataclass() class Repository: - family: str + family: Optional[str] repo: str index_url: str parse: Callable[[Path], Mapping[str, Version]] def full_name(self): - return f'{self.family} {self.repo}' + if self.family is None: + return self.repo + else: + return f'{self.family} {self.repo}' def _cache_dir(self) -> Path: - return Path('data') / slug(self.family) / slug(self.repo) + if self.family is None: + return Path('data') / slug(self.repo) + else: + return Path('data') / slug(self.family) / slug(self.repo) def _cache_file(self, name: str) -> Path: return self._cache_dir() / name |