Commit
·
97ed795
1
Parent(s):
1b90d76
Update maskrcnn_benchmark/utils/imports.py
Browse files
maskrcnn_benchmark/utils/imports.py
CHANGED
@@ -1,23 +1,9 @@
|
|
1 |
-
|
2 |
-
import
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
# from https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
|
11 |
-
def import_file(module_name, file_path, make_importable=False):
|
12 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
13 |
-
module = importlib.util.module_from_spec(spec)
|
14 |
-
spec.loader.exec_module(module)
|
15 |
-
if make_importable:
|
16 |
-
sys.modules[module_name] = module
|
17 |
-
return module
|
18 |
-
else:
|
19 |
-
import imp
|
20 |
-
|
21 |
-
def import_file(module_name, file_path, make_importable=None):
|
22 |
-
module = imp.load_source(module_name, file_path)
|
23 |
-
return module
|
|
|
1 |
+
import importlib.util
|
2 |
+
import sys
|
3 |
+
|
4 |
+
def import_file(module_name, file_path, make_importable=False):
|
5 |
+
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
6 |
+
module = importlib.util.module_from_spec(spec)
|
7 |
+
sys.modules[module_name] = module
|
8 |
+
spec.loader.exec_module(module)
|
9 |
+
return module
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|