Skip to content

Commit

Permalink
changed imp to importlib
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelVRossi committed Oct 7, 2023
1 parent b627270 commit 29e44c1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions derpconf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import logging
from collections import defaultdict
from os.path import join, exists, abspath, dirname, isdir
import imp
import importlib

import six
from textwrap import fill
Expand Down Expand Up @@ -94,7 +94,8 @@ def __load_from_path(cls, conf, path):
with open(path) as config_file:
name = 'configuration'
code = config_file.read()
module = imp.new_module(name)
spec = importlib._bootstrap.ModuleSpec(name, None)
module = importlib.util.module_from_spec(spec)

six.exec_(code, module.__dict__)

Expand All @@ -118,7 +119,8 @@ def verify(cls, path):
with open(path) as config_file:
name = 'configuration'
code = config_file.read()
module = imp.new_module(name)
spec = importlib._bootstrap.ModuleSpec(name, None)
module = importlib.util.module_from_spec(spec)

six.exec_(code, module.__dict__)

Expand Down

0 comments on commit 29e44c1

Please sign in to comment.