Skip to content

Commit f313387

Browse files
committed
removed imp module
Since it has been depreceated and would be removed from python 3.12 onwards
1 parent 83caecc commit f313387

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

Diff for: requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ pytest-benchmark
1010
pytest-docker-pexpect
1111
twine
1212
pathlib2
13+
importlib

Diff for: thefuck/conf.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@
44
from six import text_type
55
from . import const
66
from .system import Path
7+
import importlib.util
78

8-
try:
9-
import importlib.util
10-
11-
def load_source(name, pathname, _file=None):
12-
module_spec = importlib.util.spec_from_file_location(name, pathname)
13-
module = importlib.util.module_from_spec(module_spec)
14-
module_spec.loader.exec_module(module)
15-
return module
16-
except ImportError:
17-
from imp import load_source
18-
9+
def load_source(name, pathname, _file=None):
10+
module_spec = importlib.util.spec_from_file_location(name, pathname)
11+
module = importlib.util.module_from_spec(module_spec)
12+
module_spec.loader.exec_module(module)
13+
return module
1914

2015
class Settings(dict):
2116
def __getattr__(self, item):

0 commit comments

Comments
 (0)