mirror of
https://github.com/zensical/zensical.git
synced 2026-05-03 17:40:31 +00:00
chore: lint long lines
Signed-off-by: Timothée Mazzucotelli <dev@pawamoy.fr>
This commit is contained in:
committed by
GitHub
parent
8183517272
commit
76de3b6f9c
@@ -442,7 +442,10 @@ def _apply_defaults(config: dict, path: str) -> dict:
|
||||
def set_default(
|
||||
entry: dict, key: str, default: Any, data_type: type | None = None
|
||||
) -> Any:
|
||||
"""Set a key to a default value if it isn't set, and optionally cast it to the specified data type."""
|
||||
"""Set a key to a default value if it isn't set.
|
||||
|
||||
Optionally cast it to the specified data type.
|
||||
"""
|
||||
if key in entry and entry[key] is None:
|
||||
del entry[key]
|
||||
|
||||
@@ -492,7 +495,7 @@ def _list_templates(config: dict) -> list[tuple[str, int]]:
|
||||
|
||||
|
||||
def _convert_extra(data: dict | list) -> dict | list:
|
||||
"""Recursively convert all None values in a dictionary or list to empty strings."""
|
||||
"""Recursively convert None values in a dictionary/list to empty strings."""
|
||||
if isinstance(data, dict):
|
||||
# Process each key-value pair in the dictionary
|
||||
return {
|
||||
@@ -528,7 +531,7 @@ def _convert_nav(nav: list) -> list:
|
||||
|
||||
|
||||
def _convert_nav_item(item: str | dict | list) -> dict | list:
|
||||
"""Convert MkDocs shorthand navigation structure into something more manageable.
|
||||
"""Convert MkDocs shorthand navigation structure into something manageable.
|
||||
|
||||
We need to annotate each item with a title, URL, icon, and children.
|
||||
"""
|
||||
@@ -609,7 +612,7 @@ def _convert_extra_javascript(value: list) -> list:
|
||||
|
||||
|
||||
def _convert_markdown_extensions(value: Any) -> tuple[list[str], dict]:
|
||||
"""Convert Markdown extensions configuration to what Python Markdown expects."""
|
||||
"""Convert Markdown extensions to what Python Markdown expects."""
|
||||
markdown_extensions = ["toc", "tables"]
|
||||
mdx_configs: dict[str, dict[str, Any]] = {"toc": {}, "tables": {}}
|
||||
|
||||
@@ -724,7 +727,7 @@ def _convert_plugins(value: Any, config: dict) -> dict:
|
||||
def _yaml_load(
|
||||
source: IO, loader: type[BaseLoader] | None = None
|
||||
) -> dict[str, Any]:
|
||||
"""Load configuration file and resolve environment variables and parent files.
|
||||
"""Load configuration file, resolve environment variables and parent files.
|
||||
|
||||
Note that INHERIT is only a bandaid that was introduced to allow for some
|
||||
degree of modularity, but with serious shortcomings. Zensical will use a
|
||||
@@ -756,7 +759,8 @@ def _yaml_load(
|
||||
)
|
||||
if not os.path.exists(abspath):
|
||||
raise ConfigurationError(
|
||||
f"Inherited config file '{relpath}' doesn't exist at '{abspath}'."
|
||||
f"Inherited config file '{relpath}' "
|
||||
f"doesn't exist at '{abspath}'."
|
||||
)
|
||||
with open(abspath, encoding="utf-8") as fd:
|
||||
parent = _yaml_load(fd, loader)
|
||||
|
||||
@@ -34,7 +34,7 @@ from markdown.postprocessors import Postprocessor
|
||||
|
||||
|
||||
class SearchProcessor(Postprocessor):
|
||||
"""Post processor that extracts searchable content from the rendered HTML."""
|
||||
"""Post processor to extract searchable content from the rendered HTML."""
|
||||
|
||||
def __init__(self, md: Markdown) -> None:
|
||||
super().__init__(md)
|
||||
|
||||
@@ -135,7 +135,7 @@ def execute_serve(config_file: str | None, **kwargs: Any) -> None:
|
||||
required=False,
|
||||
)
|
||||
def new_project(directory: str | None, **kwargs: Any) -> None: # noqa: ARG001
|
||||
"""Create a new template project in the current directory or in the given directory.
|
||||
"""Create a new template project in the current or given directory.
|
||||
|
||||
Raises:
|
||||
ClickException: if the directory already contains a zensical.toml or a
|
||||
|
||||
Reference in New Issue
Block a user