-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
165 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from absl import app, flags | ||
from gymnasium.envs.registration import EnvSpec | ||
from md_utils import dict_to_table | ||
|
||
from minari.utils import get_env_spec_dict | ||
|
||
|
||
FLAGS = flags.FLAGS | ||
flags.DEFINE_string("env_spec", None, "Environment spec json file") | ||
flags.DEFINE_string("file_name", None, "File name to save the md file") | ||
|
||
|
||
def main(argv): | ||
del argv | ||
env_spec_dict = get_env_spec_dict(EnvSpec.from_json(FLAGS.env_spec)) | ||
md_table = dict_to_table(env_spec_dict) | ||
with open(FLAGS.file_name, "w") as f: | ||
f.write(md_table) | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run(main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from typing import Dict | ||
|
||
|
||
def dict_to_table(table_dict: Dict[str, str]) -> str: | ||
markdown = "| | |\n |----|----|" | ||
for key, value in table_dict.items(): | ||
markdown += f"\n| {key} | {value} |" | ||
return markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters