forked from awendt/pyrelacs
adding comments
This commit is contained in:
parent
13d4db25fa
commit
bf8f3f5cb7
@ -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"]
|
||||
|
Loading…
Reference in New Issue
Block a user