Beispiel #1
0
    def make_simulation_docs(path: Path):
        instantiations = ReflectionHandler.all_nonabstract_subclasses(
            MotifInstantiationStrategy, "Instantiation",
            "motif_instantiation_strategy/")
        instantiations = [
            DocumentationFormat(inst,
                                inst.__name__.replace('Instantiation', ""),
                                DocumentationFormat.LEVELS[2])
            for inst in instantiations
        ]

        implanting_strategies = ReflectionHandler.all_nonabstract_subclasses(
            SignalImplantingStrategy, 'Implanting',
            'signal_implanting_strategy/')
        implanting_strategies = [
            DocumentationFormat(implanting,
                                implanting.__name__.replace('Implanting', ""),
                                DocumentationFormat.LEVELS[2])
            for implanting in implanting_strategies
        ]

        classes_to_document = [DocumentationFormat(Motif, Motif.__name__, DocumentationFormat.LEVELS[1])] + instantiations + \
                              [DocumentationFormat(Signal, Signal.__name__, DocumentationFormat.LEVELS[1])] + implanting_strategies + \
                               [DocumentationFormat(Implanting, Implanting.__name__, DocumentationFormat.LEVELS[1])]

        file_path = path / "simulation.rst"
        with file_path.open("w") as file:
            for doc_format in classes_to_document:
                write_class_docs(doc_format, file)
Beispiel #2
0
    def make_docs(instruction, name, path: Path):
        file_path = path / f"{name}.rst"

        with file_path.open("w") as file:
            write_class_docs(
                DocumentationFormat(instruction, "",
                                    DocumentationFormat.LEVELS[1]), file)
        return file_path
Beispiel #3
0
    def make_reports_docs(path):
        filename = "reports.rst"

        open(path + filename, "w").close()

        for report_type_class in [DataReport, EncodingReport, MLReport, TrainMLModelReport, MultiDatasetReport]:
            with open(path + filename, "a") as file:
                doc_format = DocumentationFormat(cls=report_type_class,
                                                 cls_name=f"**{report_type_class.get_title()}**",
                                                 level_heading=DocumentationFormat.LEVELS[1])
                write_class_docs(doc_format, file)

            subdir = DefaultParamsLoader.convert_to_snake_case(report_type_class.__name__) + "s"

            classes = ReflectionHandler.all_nonabstract_subclasses(report_type_class, "", f"reports/{subdir}/")
            make_docs(path, classes, filename, "", "a")
Beispiel #4
0
 def make_trainmlmodel_docs(path):
     file_path = path / "hp.rst"
     with file_path.open("w") as file:
         write_class_docs(DocumentationFormat(TrainMLModelInstruction, "", DocumentationFormat.LEVELS[1]), file)
         write_class_docs(DocumentationFormat(SplitConfig, "SplitConfig", DocumentationFormat.LEVELS[1]), file)
         write_class_docs(DocumentationFormat(ReportConfig, "ReportConfig", DocumentationFormat.LEVELS[1]), file)
     return file_path
Beispiel #5
0
 def make_docs(instruction, name, path):
     with open(f"{path}{name}.rst", "w") as file:
         write_class_docs(
             DocumentationFormat(instruction, "",
                                 DocumentationFormat.LEVELS[1]), file)
     return f"{path}{name}.rst"