We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 506e20e commit 284e337Copy full SHA for 284e337
django_lightweight_queue/utils.py
@@ -1,8 +1,8 @@
1
-import imp
2
import time
3
import datetime
4
import warnings
5
import importlib
+import importlib.util
6
from typing import (
7
Any,
8
Set,
@@ -33,7 +33,10 @@
33
34
35
def load_extra_config(file_path: str) -> None:
36
- extra_settings = imp.load_source('extra_settings', file_path)
+ # Based on https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
37
+ spec = importlib.util.spec_from_file_location('extra_settings', file_path)
38
+ extra_settings = importlib.util.module_from_spec(spec) # type: ignore[arg-type]
39
+ spec.loader.exec_module(extra_settings) # type: ignore[union-attr]
40
41
def get_setting_names(module: object) -> Set[str]:
42
return set(name for name in dir(module) if name.isupper())
0 commit comments