Skip to content

Commit 5e74c8a

Browse files
committed
MNT: call _final_imports.import_now just once
Break out of repeated calls from imported modules.
1 parent a0bf317 commit 5e74c8a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/diffpy/srreal/_final_imports.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ def import_now():
3030
'''
3131
Import all Python modules that tweak extension-defined classes.
3232
'''
33+
global _import_now_called
34+
if _import_now_called:
35+
return
36+
_import_now_called = True
3337
from importlib import import_module
3438
import_module('diffpy.srreal.attributes')
3539
import_module('diffpy.srreal.atomradiitable')
@@ -44,3 +48,5 @@ def import_now():
4448
import_module('diffpy.srreal.pdfcalculator')
4549
import_module('diffpy.srreal.structureconverters')
4650
return
51+
52+
_import_now_called = False

0 commit comments

Comments
 (0)