From eade5183ca4029ac2a2db4257e0123a1f2b56f88 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 16:35:34 +0200 Subject: [PATCH] lint --- macros/macros.py | 11 +++++++---- macros/main.py | 4 +--- mkdocs.yml | 4 ++-- requirements.txt | 2 +- templates/table.jinja | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/macros/macros.py b/macros/macros.py index 9dd0b06ca..f20dcfbca 100644 --- a/macros/macros.py +++ b/macros/macros.py @@ -15,6 +15,7 @@ from rich import print + def return_jinja_env() -> Environment: return Environment( loader=FileSystemLoader(TEMPLATES_DIR), @@ -45,7 +46,7 @@ def schema_table() -> str: ] input_file = SCHEMA_DIR / "reproschema.yaml" - + reproschema = yaml.load(input_file) env = return_jinja_env() @@ -55,7 +56,9 @@ def schema_table() -> str: for this_class in target_classes: class_dict = reproschema["classes"][this_class] - class_dict["uri"] = class_dict["class_uri"].replace("reproschema:", reproschema["id"]) + class_dict["uri"] = class_dict["class_uri"].replace( + "reproschema:", reproschema["id"] + ) slots = [] for this_slot in class_dict["slots"]: @@ -63,7 +66,7 @@ def schema_table() -> str: slot_dict = reproschema["slots"][this_slot] slot_dict["name"] = this_slot - + if "title" not in slot_dict: slot_dict["title"] = "**TODO**" if "description" not in slot_dict: @@ -74,7 +77,7 @@ def schema_table() -> str: if prefix in reproschema["prefixes"]: value = reproschema["prefixes"][prefix] - slot_dict ["uri"] = slot_dict["slot_uri"].replace(f"{prefix}:", value) + slot_dict["uri"] = slot_dict["slot_uri"].replace(f"{prefix}:", value) slots.append(slot_dict) diff --git a/macros/main.py b/macros/main.py index 0c9ebd00f..c8ec985bd 100644 --- a/macros/main.py +++ b/macros/main.py @@ -29,6 +29,4 @@ def define_env(env): Macro aliases must start with "MACROS___" """ - env.macro( - macros.schema_table, "MACROS___schema_table" - ) + env.macro(macros.schema_table, "MACROS___schema_table") diff --git a/mkdocs.yml b/mkdocs.yml index 1652a508a..c8ea7b687 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -75,7 +75,7 @@ markdown_extensions: - pymdownx.snippets: auto_append: - includes/abbreviations.md - - tables + - tables - toc: anchorlink: true @@ -87,4 +87,4 @@ plugins: - search - tags - macros: - module_name: macros/main \ No newline at end of file + module_name: macros/main diff --git a/requirements.txt b/requirements.txt index 238eb6d8d..044ec90ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ mkdocs-macros-plugin mkdocs-material pymdown-extensions rdflib==5.0.0 -ruamel.yaml \ No newline at end of file +ruamel.yaml diff --git a/templates/table.jinja b/templates/table.jinja index 9012dbd68..f1f99d690 100644 --- a/templates/table.jinja +++ b/templates/table.jinja @@ -10,4 +10,4 @@ URI: [{{ this_class.uri }}]({{ this_class.uri }}) | :------- | :---- | :---------- | :-- | {% for slot in this_class.slots %} | {{ slot.name }} | {{ slot.title }} | {{ slot.description }} | [{{ slot.uri }}]({{ slot.uri }}) | -{% endfor %} \ No newline at end of file +{% endfor %}