Skip to content

Commit d352c09

Browse files
committed
fix: revert original code to import
1 parent 2900590 commit d352c09

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/diffpy/pdffit2/__init__.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,24 @@
1616
##############################################################################
1717
"""PDFfit2 - real space structure refinement program."""
1818

19-
from diffpy.pdffit2.output import redirect_stdout # noqa
19+
# WARNING: Do NOT remove the isort: off/on comments in this file.
20+
# These tags are used to prevent isort from reordering imports in this file.
21+
# __version__ must be initialized before importing C++ extensions.
2022

21-
# package version
22-
from diffpy.pdffit2.version import __date__, __version__ # noqa
23+
# isort: off
24+
# Import the package version before C++ extensions are loaded.
25+
from diffpy.pdffit2.output import redirect_stdout
26+
from diffpy.pdffit2.version import __date__, __version__
2327

24-
# silence the pyflakes syntax checker
28+
# Import C++ related modules since the __version__ attribute is used.
29+
from diffpy.pdffit2.pdffit import PdfFit
30+
from diffpy.pdffit2.pdffit2 import is_element
31+
32+
# isort: on
33+
34+
# Ensure all necessary components are imported and initialized
2535
assert __version__ or True
36+
assert __date__ or True
37+
assert all((PdfFit, redirect_stdout, is_element))
2638

2739
# End of file

0 commit comments

Comments
 (0)