Skip to content

Commit 8ffdd21

Browse files
committed
Do not throw error when getsource fails, fixes #27
Some libraries generate models in runtime, eg. django-simple-history there is no source code of the models and it doesn't make sense to parse it because there won't be any ignore comments that we look for
1 parent a99ade3 commit 8ffdd21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/extra_checks/ast/source_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, obj: Type) -> None:
4343
def source(self) -> Optional[str]:
4444
try:
4545
return textwrap.dedent(inspect.getsource(self._obj))
46-
except TypeError:
46+
except (TypeError, OSError):
4747
# TODO: add warning?
4848
return None
4949

0 commit comments

Comments
 (0)