import minigrid.wrappers __author__ = "Feng Gu" __email__ = "contact@fenggu.me" """ isort:skip_file """ import inspect import os import re from gymnasium.envs.registration import registry from tqdm import tqdm from utils import trim readme_path = os.path.join( os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "README.md", ) LAYOUT = "env" pattern = re.compile(r"(?") index_texts += sections[6] index_texts += env_index_toctree for env_name in env_names: index_texts += env_name + "\n" index_texts += """\n```\n""" f.close() output_path = os.path.join( os.path.dirname(os.path.dirname(__file__)), "environments", "index.md", ) # output index.md with open(output_path, "w+") as f: f.write(index_texts) f.close() # gen /environments/design.md design_path = os.path.join( os.path.dirname(os.path.dirname(__file__)), "environments", "design.md", ) design_texts = """--- layout: "contents" title: Design firstpage: ---\n""" design_texts += sections[5] with open(design_path, "w+") as f: f.write(design_texts) f.close() # gen /environments/wrappers.md wrappers_path = os.path.join( os.path.dirname(os.path.dirname(__file__)), "api", "wrappers.md", ) wrappers_texts = ( """--- title: Wrappers lastpage: ---\n""" + sections[4] + "\n" ) for name, obj in inspect.getmembers(minigrid.wrappers): if inspect.isclass(obj) and obj.__doc__ is not None: formatted_doc = " ".join(trim(obj.__doc__).split()) wrappers_texts += f"""## {name} {formatted_doc}\n\n""" with open(wrappers_path, "w+") as f: f.write(wrappers_texts) f.close() # gen content/pubs.md pubs_path = os.path.join( os.path.dirname(os.path.dirname(__file__)), "content", "pubs.md", ) pubs_texts = ( """--- layout: "contents" title: Publications firstpage: ---\n#List of Publications\n""" + sections[1] + "\n" ) with open(pubs_path, "w+") as f: f.write(pubs_texts) f.close() # gen content/basic_usage.md pubs_path = os.path.join( os.path.dirname(os.path.dirname(__file__)), "content", "basic_usage.md", ) pubs_texts = ( """--- layout: "contents" title: Basic Usage firstpage: ---\n""" + sections[3] + "\n" ) with open(pubs_path, "w+") as f: f.write(pubs_texts) f.close()