File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 6
6
else :
7
7
from inspect import getfullargspec
8
8
9
+
9
10
def load_module (name , path ):
10
11
"""Load module using the Python version compatible function."""
11
12
if sys .version_info >= (3 , 3 ):
12
13
from importlib .machinery import SourceFileLoader
13
- return SourceFileLoader (name , path ).load_module ()
14
- else :
14
+
15
+ # Typeshed is incorrect in requiring a string arg to `load_module`,
16
+ # as this works with no args or a None arg.
17
+ # Even `load_module` is now deprecated, so we should update to just
18
+ # using the following approach in >= python 3.5:
19
+ # https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
20
+ loader = SourceFileLoader (name , path )
21
+ return loader .load_module () # type: ignore
22
+ else :
15
23
from imp import load_source
16
24
return load_source (name , path )
17
25
You can’t perform that action at this time.
0 commit comments