From 43d765c6b10d3c35e24fdb3e40a28fafbd227b8e Mon Sep 17 00:00:00 2001 From: Lisandra-dev Date: Mon, 6 Nov 2023 16:11:19 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20synced=20local=20'find=5Funused?= =?UTF-8?q?=5Fmedia.py'=20with=20remote=20'find=5Funused=5Fmedia.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- find_unused_media.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/find_unused_media.py b/find_unused_media.py index 29c4a21..e6cff43 100644 --- a/find_unused_media.py +++ b/find_unused_media.py @@ -1,13 +1,17 @@ from pathlib import Path import os import argparse +from typing import Optional import yaml -def find_unused_media(img_path: Path = None, dry_run: bool = False): +def find_unused_media(img_path: Optional[Path] = None, dry_run: bool = False): # load mkdocs.yml with open("mkdocs.yml", "r", encoding="utf-8") as f: - config = yaml.load(f, Loader=yaml.UnsafeLoader) + # remove all !! pairs from the yaml file + data = f.read() + data = data.replace("!!", "") + config = yaml.safe_load(data) docs_dir = Path.cwd() / Path(config.get("docs_dir", "docs")) assets_dir = Path(docs_dir, config["extra"]["attachments"])