Method: pylint.lint.pylinter._load_reporter_by_class
Calls: 4, Exceptions: 3, Paths: 4Back
Path 1: 1 calls (0.25)
'missing.module.Class' (1)
ImportError (1)
1def _load_reporter_by_class(reporter_class: str) -> type[BaseReporter]:
2 qname = reporter_class
3 module_part = astroid.modutils.get_module_part(qname)
4 module = astroid.modutils.load_module_from_name(module_part)
5 class_name = qname.split(".")[-1]
6 klass = getattr(module, class_name)
7 assert issubclass(klass, BaseReporter), f"{klass} is not a BaseReporter"
8 return klass # type: ignore[no-any-return]
Path 2: 1 calls (0.25)
'lint.unittest_lint._CustomPyLinter' (1)
AssertionError (1)
1def _load_reporter_by_class(reporter_class: str) -> type[BaseReporter]:
2 qname = reporter_class
3 module_part = astroid.modutils.get_module_part(qname)
4 module = astroid.modutils.load_module_from_name(module_part)
5 class_name = qname.split(".")[-1]
6 klass = getattr(module, class_name)
7 assert issubclass(klass, BaseReporter), f"{klass} is not a BaseReporter"
8 return klass # type: ignore[no-any-return]
Path 3: 1 calls (0.25)
'lint.unittest_lint.MyReporter' (1)
AttributeError (1)
1def _load_reporter_by_class(reporter_class: str) -> type[BaseReporter]:
2 qname = reporter_class
3 module_part = astroid.modutils.get_module_part(qname)
4 module = astroid.modutils.load_module_from_name(module_part)
5 class_name = qname.split(".")[-1]
6 klass = getattr(module, class_name)
7 assert issubclass(klass, BaseReporter), f"{klass} is not a BaseReporter"
8 return klass # type: ignore[no-any-return]
Path 4: 1 calls (0.25)
'unittest_reporting.NopReporter' (1)
NopReporter def (1)
1def _load_reporter_by_class(reporter_class: str) -> type[BaseReporter]:
2 qname = reporter_class
3 module_part = astroid.modutils.get_module_part(qname)
4 module = astroid.modutils.load_module_from_name(module_part)
5 class_name = qname.split(".")[-1]
6 klass = getattr(module, class_name)
7 assert issubclass(klass, BaseReporter), f"{klass} is not a BaseReporter"
8 return klass # type: ignore[no-any-return]