brain_pipe.utils.find.Finder¶
- class Finder¶
Bases:
object
Utility to find classes in a package.
- __init__()¶
Create a finder.
Methods
__init__
()Create a finder.
filter
(previously_found, obj)Filter a dictionary of previously found classes.
filter_fn
(member, to_find)Filter function to filter classes.
load_from_path
(path[, attach_to_main])Load all classes from a path.
predicate_fn
(member)Predicate function to filter classes.
- filter(previously_found, obj)¶
Filter a dictionary of previously found classes.
- Parameters:
previously_found (Dict[str, Any]) – A dictionary containing all previously found classes. Keys correspond to the class names.
obj (Any) – The object to filter the dictionary with. Only subclasses are included
- Returns:
A dictionary containing all found classes. Keys correspond to the class names.
- Return type:
Dict[str, Any]
- filter_fn(member, to_find)¶
Filter function to filter classes.
- Parameters:
member (Any) – The member to be filtered.
to_find (Optional[Any]) – The class to find subclasses of. If None, all classes are returned.
- Returns:
Whether the member should be included.
- Return type: