Skip to content

Commit

Permalink
fix is_google_fonts_repo checker
Browse files Browse the repository at this point in the history
  • Loading branch information
m4rc1e committed Nov 14, 2023
1 parent bdd216a commit d7707e6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Lib/gftools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit d7707e6

Please # to comment.