Skip to content

Commit

Permalink
fix pre-commit checks
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Mirz <[email protected]>
  • Loading branch information
m-mirz committed Jan 18, 2025
1 parent 71efde1 commit b256f38
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
1 change: 0 additions & 1 deletion json_ld/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
import json_ld.langPack
23 changes: 8 additions & 15 deletions json_ld/langPack.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import chevron
import logging

logger = logging.getLogger(__name__)


Expand All @@ -14,10 +15,7 @@ def location(version):
return "cimpy." + version + ".Base"


base = {
"base_class": "Base",
"class_location": location
}
base = {"base_class": "Base", "class_location": location}

template_files = [{"filename": "json_ld_template.mustache", "ext": ".json"}]

Expand All @@ -27,7 +25,7 @@ def get_class_location(class_name, class_map, version):


def _set_default(text, render):
return '0.0'
return "0.0"


def set_enum_classes(new_enum_classes):
Expand All @@ -40,18 +38,13 @@ def set_float_classes(new_float_classes):

def run_template(version_path, class_details):
for template_info in template_files:
class_file = os.path.join(version_path, class_details['class_name']
+ template_info["ext"])
class_file = os.path.join(version_path, class_details["class_name"] + template_info["ext"])
if not os.path.exists(class_file):
with open(class_file, 'w') as file:
template_path = os.path.join(os.getcwd(), 'json_ld/templates',
template_info["filename"])
class_details['setDefault'] = _set_default
with open(class_file, "w") as file:
template_path = os.path.join(os.getcwd(), "json_ld/templates", template_info["filename"])
class_details["setDefault"] = _set_default
with open(template_path) as f:
args = {
'data': class_details,
'template': f
}
args = {"data": class_details, "template": f}
output = chevron.render(**args)
file.write(output)

Expand Down
2 changes: 1 addition & 1 deletion json_ld/templates/json_ld_template.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
}
}
]
}
}

0 comments on commit b256f38

Please sign in to comment.