From bf8f3f5cb7cd2fd40f2b7d3a230eb47335521497 Mon Sep 17 00:00:00 2001 From: wendtalexander Date: Sun, 29 Sep 2024 18:27:27 +0200 Subject: [PATCH] adding comments --- pyrelacs/repros/repros.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pyrelacs/repros/repros.py b/pyrelacs/repros/repros.py index 89171cb..842e3cd 100644 --- a/pyrelacs/repros/repros.py +++ b/pyrelacs/repros/repros.py @@ -2,6 +2,7 @@ import sys import importlib.util import ast import pathlib +from typing import Tuple from IPython import embed import nixio as nix @@ -11,12 +12,19 @@ log = config_logging() class Repro: + """ + Repro Class that searches in the repro folder for classes instances and executes the + the run function in the searched class + + """ + def __init__(self) -> None: pass def run_repro( self, nix_file: nix.File, name: str, file: pathlib.Path, *args, **kwargs ) -> None: + spec = importlib.util.spec_from_file_location("rep", file) if not spec: log.error("Could not load the file") @@ -33,7 +41,17 @@ class Repro: else: raise AttributeError(f"{file.name} has no {name} class") - def names_of_repros(self): + def names_of_repros(self) -> Tuple[list, list]: + """ + Searches for class names in the repro folder in all python files + + Returns + ------- + Tuple[list, list] + list of class names + list of file names from the class names + """ + file_path_cur = pathlib.Path(__file__).parent python_files = list(file_path_cur.glob("**/*.py")) exclude_files = ["repros.py", "__init__.py"]