File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
import six
2
+ import sys
2
3
3
4
if six .PY2 :
4
5
from inspect import getargspec as getfullargspec
5
6
else :
6
7
from inspect import getfullargspec
7
8
8
- __all__ = ('getfullargspec' ,)
9
+ def load_module (name , path ):
10
+ """Load module using the Python version compatible function."""
11
+ if sys .version_info >= (3 , 3 ):
12
+ from imp import load_source
13
+ from importlib .machinery import SourceFileLoader
14
+ return SourceFileLoader (name , path ).load_module ()
15
+ else :
16
+ from imp import load_source
17
+ return load_source (name , path )
18
+
19
+ __all__ = ('getfullargspec' , 'load_module' )
Original file line number Diff line number Diff line change 1
- import imp
2
1
import logging
3
2
import os
4
3
import warnings
5
4
from os import getenv
5
+ from pynamodb ._compat import load_module
6
6
7
7
log = logging .getLogger (__name__ )
8
8
20
20
21
21
override_settings = {}
22
22
if os .path .isfile (OVERRIDE_SETTINGS_PATH ):
23
- override_settings = imp . load_source ('__pynamodb_override_settings__' , OVERRIDE_SETTINGS_PATH )
23
+ override_settings = load_module ('__pynamodb_override_settings__' , OVERRIDE_SETTINGS_PATH )
24
24
if hasattr (override_settings , 'session_cls' ) or hasattr (override_settings , 'request_timeout_seconds' ):
25
25
warnings .warn ("The `session_cls` and `request_timeout_second` options are no longer supported" )
26
26
log .info ('Override settings for pynamo available {}' .format (OVERRIDE_SETTINGS_PATH ))
You can’t perform that action at this time.
0 commit comments