From 2a45e45fd09f659253b44f35550de056e8e39a59 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Mon, 29 Mar 2021 18:55:00 -0600 Subject: allow repositories with no family --- repos/base.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'repos') 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 -- cgit v1.2.3