Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Jun 17, 2024
1 parent 4583404 commit eade518
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
11 changes: 7 additions & 4 deletions macros/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from rich import print


def return_jinja_env() -> Environment:
return Environment(
loader=FileSystemLoader(TEMPLATES_DIR),
Expand Down Expand Up @@ -45,7 +46,7 @@ def schema_table() -> str:
]

input_file = SCHEMA_DIR / "reproschema.yaml"

reproschema = yaml.load(input_file)

env = return_jinja_env()
Expand All @@ -55,15 +56,17 @@ 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"]:

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:
Expand All @@ -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)

Expand Down
4 changes: 1 addition & 3 deletions macros/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ markdown_extensions:
- pymdownx.snippets:
auto_append:
- includes/abbreviations.md
- tables
- tables
- toc:
anchorlink: true

Expand All @@ -87,4 +87,4 @@ plugins:
- search
- tags
- macros:
module_name: macros/main
module_name: macros/main
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ mkdocs-macros-plugin
mkdocs-material
pymdown-extensions
rdflib==5.0.0
ruamel.yaml
ruamel.yaml
2 changes: 1 addition & 1 deletion templates/table.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
{% endfor %}

0 comments on commit eade518

Please sign in to comment.