Skip to content

Commit 304f0d6

Browse files
committed
Ensure ordering of import in __init__.py
1 parent 05b15ce commit 304f0d6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.flake8

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ exclude =
44
__pycache__,
55
build,
66
dist,
7+
__init__.py
78
doc/source/conf.py
89
max-line-length = 115
910
# Ignore some style 'errors' produced while formatting by 'black'

src/diffpy/pdffit2/__init__.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@
1717

1818
"""PDFfit2 - real space structure refinement program."""
1919

20-
# package version
20+
# Import package version to be used by with C++ extensions
2121
from diffpy.pdffit2.output import redirect_stdout
22-
from diffpy.pdffit2.pdffit import PdfFit
23-
from diffpy.pdffit2.pdffit2 import is_element
2422
from diffpy.pdffit2.version import __date__, __version__
2523

26-
# silence the pyflakes syntax checker
24+
# Ensure the version and date variables are initialized
2725
assert __version__ or True
2826
assert __date__ or True
27+
28+
# Import C++ related modules after version info is initialized
29+
from diffpy.pdffit2.pdffit import PdfFit
30+
from diffpy.pdffit2.pdffit2 import is_element # Import element check functionality
31+
32+
# Ensure all necessary components are imported and initialized
2933
assert all((PdfFit, redirect_stdout, is_element))
3034

3135
# End of file

0 commit comments

Comments
 (0)