Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
karkhaz committed Jul 13, 2023
1 parent 7137231 commit f6519de
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
12 changes: 10 additions & 2 deletions scripts/gen_format_schemas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/usr/bin/env python3
# Copyright Kani Contributors
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# Generate documentation for every public class in the `benchcomp.schemas`
# module. This script generates one Markdown file for each class; these Markdown
# files can then be included in the Kani book.
#
# The script first dumps the schema into JSON Draft-07 [1] format, and then used
# the json_schema_for_humans package to render that into Markdown.
#
# [1] https://json-schema.org/draft-07/json-schema-release-notes.html


import inspect
import json
Expand Down Expand Up @@ -45,8 +55,6 @@ def main():

with open(tmpdir / f"{name}.json", "w") as handle:
print(json.dumps(schema_docs, indent=2), file=handle)
with open(f"/tmp/{name}.json", "w") as handle:
print(json.dumps(schema_docs, indent=2), file=handle)

jsfh.generate.generate_from_filename(
tmpdir, out_dir / f"{name}.md", config=config)
Expand Down
2 changes: 1 addition & 1 deletion tools/benchcomp/benchcomp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class _SchemaValidator:
"""Validate data structures with a schema
Objects of this class are callable, with a single `data` argument. The data
is validated and returned if the `schema` packages is installed, or returned
is validated and returned if the `schema` package is installed, or returned
if not.
"""

Expand Down
3 changes: 1 addition & 2 deletions tools/benchcomp/benchcomp/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ def _replace_types(self, schema_dict):

def __call__(self):
s = self.get_raw_schema()
name, description = s["name"], s["description"]
ret = self._replace_types(s["schema"])
return schema.Schema(ret, name=name, description=description)
return schema.Schema(ret, name=s["name"], description=s["description]")



Expand Down
2 changes: 1 addition & 1 deletion tools/benchcomp/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
schema
json-schema-for-humans
pyyaml
schema

0 comments on commit f6519de

Please sign in to comment.