-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove yoast plugin requirement (#12)
* better handling without yoast plugin * run ruff
- Loading branch information
1 parent
248e71a
commit de859bd
Showing
7 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import json | ||
import tempfile | ||
from pathlib import Path | ||
from typing import Set | ||
|
||
|
||
def json_without_cols(in_file: Path, del_cols: Set[str]) -> Path: | ||
in_data = json.loads(in_file.read_text()) | ||
delete_keys = {"yoast_head", "yoast_head_json"} | ||
out_data = [ | ||
{key: item[key] for key, value in item.items() if key not in delete_keys} | ||
for item in in_data | ||
] | ||
|
||
with tempfile.NamedTemporaryFile(mode="w+", delete=False) as f: | ||
json.dump(out_data, f) | ||
path = f.name | ||
|
||
return Path(path) |