Skip to content

Commit

Permalink
Removing deprecated module 'imp' in favour of 'importlib'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Williamson committed Nov 20, 2024
1 parent 4e7cd9a commit c28edf0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions common/python/simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import struct
import time
import bisect
import imp
import importlib
import os
import sys
from collections import namedtuple, deque
Expand Down Expand Up @@ -261,9 +261,9 @@ def create_block(self, ini_path, number, block_address):
ini_path = os.path.join(ROOT, ini_path)
module_path = os.path.dirname(ini_path)
try:
f, pathname, description = imp.find_module(
f, pathname, description = importlib.import_module(
block_name + "_sim", [module_path])
package = imp.load_module(
package = importlib.exec_module(
block_name + "_sim", f, pathname, description)
clsnames = [n for n in dir(package)
if n.lower() == block_name + "simulation"]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_python_sim_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import sys
import os
import imp
import importlib
import numpy

import unittest
Expand Down Expand Up @@ -46,9 +46,9 @@ def __init__(self, module_path, timing_ini, timing_section):

def runTest(self):
# Load <block>_sim.py into common.python.<block>_sim
file, pathname, description = imp.find_module(
file, pathname, description = importlib.import_module(
self.block_name + "_sim", [self.module_path])
mod = imp.load_module(
mod = importlib.exec_module(
"common.python." + self.block_name,
file, pathname, description)
# Make instance of <Block>Simulation
Expand Down

0 comments on commit c28edf0

Please sign in to comment.