Skip to content

Commit 2587354

Browse files
committed
Fix mypy issues in _load_py_cssfproject
1 parent 9c196ed commit 2587354

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cssfinder/cssfproject.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def _load_py_cssfproject(cls, project_path: Path) -> Self:
224224
project_module = importlib.util.module_from_spec(spec)
225225
spec.loader.exec_module(project_module)
226226

227-
project_object: CSSFProject = getattr(project_module, "__project__", None)
227+
project_object = getattr(project_module, "__project__", None)
228228

229229
if project_object is None:
230230
msg = (
@@ -233,6 +233,14 @@ def _load_py_cssfproject(cls, project_path: Path) -> Self:
233233
)
234234
raise ImportError(msg)
235235

236+
if not isinstance(project_object, cls):
237+
msg = (
238+
f"Expected CSSFProject object in '__project__' field in {project_path}."
239+
)
240+
raise TypeError(
241+
msg,
242+
)
243+
236244
if not isinstance(project_object, cls):
237245
msg = (
238246
"Incorrect object in '__project__' field, should contain "

0 commit comments

Comments
 (0)