From d7707e626cf64b25840376a2b42c166e7ae99ab9 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Tue, 14 Nov 2023 10:47:24 +0000 Subject: [PATCH] fix is_google_fonts_repo checker --- Lib/gftools/utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/gftools/utils.py b/Lib/gftools/utils.py index 5c6ec916e..e73b5772e 100644 --- a/Lib/gftools/utils.py +++ b/Lib/gftools/utils.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from __future__ import annotations import requests from io import BytesIO from zipfile import ZipFile @@ -564,7 +565,10 @@ def font_version(font: TTFont): return version -def is_google_fonts_repo(fp: Path): - if "fonts" not in fp.parts: - raise ValueError(f"'{fp}' is not a path to a valid google/fonts repo") +def is_google_fonts_repo(fp: "Path | str"): + if isinstance(fp, str): + fp = Path(fp) + absolute_parts = fp.absolute().parts + if "fonts" not in absolute_parts: + raise ValueError(f"'{fp.absolute()}' is not a path to a valid google/fonts repo") return True \ No newline at end of file