From f31338773fdc84a984ce1ec31a5d226690e96390 Mon Sep 17 00:00:00 2001 From: Harshit Vijay Date: Sat, 21 Sep 2024 15:43:20 +0530 Subject: [PATCH] removed imp module Since it has been depreceated and would be removed from python 3.12 onwards --- requirements.txt | 1 + thefuck/conf.py | 17 ++++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/requirements.txt b/requirements.txt index e9a91a47..a22f542b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ pytest-benchmark pytest-docker-pexpect twine pathlib2 +importlib diff --git a/thefuck/conf.py b/thefuck/conf.py index 611ec84b..e3119320 100644 --- a/thefuck/conf.py +++ b/thefuck/conf.py @@ -4,18 +4,13 @@ from warnings import warn from six import text_type from . import const from .system import Path +import importlib.util -try: - import importlib.util - - def load_source(name, pathname, _file=None): - module_spec = importlib.util.spec_from_file_location(name, pathname) - module = importlib.util.module_from_spec(module_spec) - module_spec.loader.exec_module(module) - return module -except ImportError: - from imp import load_source - +def load_source(name, pathname, _file=None): + module_spec = importlib.util.spec_from_file_location(name, pathname) + module = importlib.util.module_from_spec(module_spec) + module_spec.loader.exec_module(module) + return module class Settings(dict): def __getattr__(self, item):