Skip to content

Raise ModuleNotPresent instead of KeyError from find_modules_that_directly_import #113

@pydanny

Description

@pydanny

To produce the error:

import grimp
graph = grimp.build_graph("nifty_library", include_external_packages=True)
graph.find_modules_that_directly_import('yaml')

This results in this error:

----> 1 graph.find_modules_that_directly_import('yaml')

File ~/.virtualenvs/kraken-core/lib/python3.10/site-packages/grimp/adaptors/graph.py:234, in ImportGraph.find_modules_that_directly_import(self, module)
    233 def find_modules_that_directly_import(self, module: str) -> Set[str]:
--> 234     return self._importers_by_imported[module]

KeyError: 'yaml'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions