diff --git a/hooks/utils/pyproject_file.py b/hooks/utils/pyproject_file.py index 6288cc1..b39eac1 100644 --- a/hooks/utils/pyproject_file.py +++ b/hooks/utils/pyproject_file.py @@ -18,7 +18,11 @@ def __init__(self, path: str) -> None: @property def package_name(self) -> str: - return str(self.contents["tool"]["poetry"]["name"]) + try: + name = str(self.contents["tool"]["poetry"]["name"]) + except KeyError: + name = str(self.contents["project"]["name"]) + return name def add_mypy_ignore(self, bad_imports): self.contents["tool"]["mypy"]["overrides"][0]["module"].extend(bad_imports)