Remove use of deprecated imp module in job system. #1717
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, django-extensions devs! Thanks for a great package. I use django-extensions all the time.
This PR removes the following Python deprecation:
Since Python 3.3,
import_module
imports the parent modules. I believe this mimics the behavior of the existing code that is usingfind_module
. https://docs.python.org/3/library/importlib.html#importlib.import_moduleimport_module
will also raise anImportError
if the module name is not found. This matches the expected error interface offind_job_module
.I took the liberty of adding a type annotation and docstring while I was at it.
I did not write any additional tests because this portion of the code has decent test coverage, and I saw that the existing tests cover
find_job_module
.