Embedded python model
This commit is contained in:
parent
94545afb28
commit
e623b960a6
@ -370,9 +370,13 @@ def write_model_readmes(dataset: Dataset):
|
|||||||
info['forks'] = forks
|
info['forks'] = forks
|
||||||
info['owner_name'] = owner_name
|
info['owner_name'] = owner_name
|
||||||
info['owner_slug'] = owner_slug
|
info['owner_slug'] = owner_slug
|
||||||
security_rules_file = dataset_path / model_id / 'security_rules.yaml'
|
model_path = dataset_path / model_id
|
||||||
|
security_rules_file = model_path / 'security_rules.yaml'
|
||||||
|
model_file = model_path / f"{model_id}.py"
|
||||||
|
with model_file.open("r") as f:
|
||||||
|
model = f.read()
|
||||||
try:
|
try:
|
||||||
with open(security_rules_file, 'r') as f:
|
with security_rules_file.open('r') as f:
|
||||||
security_rules = yaml.safe_load(f)
|
security_rules = yaml.safe_load(f)
|
||||||
security_rules = check_security_rules(security_rules)
|
security_rules = check_security_rules(security_rules)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
@ -383,7 +387,7 @@ def write_model_readmes(dataset: Dataset):
|
|||||||
security_rules = {}
|
security_rules = {}
|
||||||
print(f"Writing readme file {readme}")
|
print(f"Writing readme file {readme}")
|
||||||
dir.mkdir(exist_ok=True)
|
dir.mkdir(exist_ok=True)
|
||||||
with open(readme, 'w', encoding="utf-8") as f:
|
with readme.open('w', encoding="utf-8") as f:
|
||||||
f.write(f"""---
|
f.write(f"""---
|
||||||
title: {slug}
|
title: {slug}
|
||||||
keywords: model TODO
|
keywords: model TODO
|
||||||
@ -411,6 +415,10 @@ The repository has {plural(stars, 'star')} and was forked {plural(forks, 'time')
|
|||||||
|
|
||||||
The images below were generated by executing the model file. The DFD is represented as a CodeableModels file.
|
The images below were generated by executing the model file. The DFD is represented as a CodeableModels file.
|
||||||
|
|
||||||
|
```python
|
||||||
|
{model}
|
||||||
|
```
|
||||||
|
|
||||||
### Statistics
|
### Statistics
|
||||||
|
|
||||||
The Application consists of a total of {plural(info['t'], 'element')}:
|
The Application consists of a total of {plural(info['t'], 'element')}:
|
||||||
|
Loading…
Reference in New Issue
Block a user