Skip to content

Commit 8abd539

Browse files
committed
Uglify list comprehension
1 parent f6b734c commit 8abd539

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

pelican/plugins/yaml_metadata/yaml_metadata.py

100644100755
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,15 @@ def _parse_date(obj):
6767

6868
return get_date(str(obj).strip().replace("_", " "))
6969

70+
7071
def _convert_py_to_meta(obj) -> list[str]:
7172
# Convert a yaml-parsed python object to meta's list of strings
7273
if isinstance(obj, list):
7374
return [str(i) for i in obj]
7475
else:
7576
return [str(obj)]
7677

78+
7779
class YAMLMetadataReader(MarkdownReader):
7880
"""Reader for Markdown files with YAML metadata."""
7981

@@ -109,9 +111,8 @@ def read(self, source_path):
109111
# Simulate markdown.extensions.meta's behavior
110112
# of writing the markdown object's Meta attribiute
111113
# Note this is not 1:1 (datetimes are reformatted)
112-
self._md.Meta = { # type: ignore
113-
k: _convert_py_to_meta(v)
114-
for k, v in metadata.items()
114+
self._md.Meta = { # type: ignore
115+
k: _convert_py_to_meta(v) for k, v in metadata.items()
115116
}
116117

117118
return (

0 commit comments

Comments
 (0)