Skip to content

Commit 1ba7042

Browse files
committed
Remove avoid flake8 in __init__ and add clear directions with isort tags
1 parent b953041 commit 1ba7042

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

.flake8

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ exclude =
44
__pycache__,
55
build,
66
dist,
7-
__init__.py
87
doc/source/conf.py
98
max-line-length = 115
109
# Ignore some style 'errors' produced while formatting by 'black'

src/diffpy/pdffit2/__init__.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,24 @@
1717

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

20-
# Import package version to be used by C++ extensions
20+
# WARNING: Do NOT remove the isort: off/on comments in this file.
21+
# These tags are used to prevent isort from reordering imports in this file.
22+
# __version__ must be initialized before importing C++ extensions.
23+
24+
# isort: off
25+
# Import the package version before C++ extensions are loaded.
2126
from diffpy.pdffit2.output import redirect_stdout
2227
from diffpy.pdffit2.version import __date__, __version__
2328

24-
# Ensure the version and date variables are initialized
25-
assert __version__ or True
26-
assert __date__ or True
27-
28-
# Import C++ related modules after version info is initialized
29+
# Import C++ related modules since the __version__ attribute is used.
2930
from diffpy.pdffit2.pdffit import PdfFit
3031
from diffpy.pdffit2.pdffit2 import is_element
3132

33+
# isort: on
34+
3235
# Ensure all necessary components are imported and initialized
36+
assert __version__ or True
37+
assert __date__ or True
3338
assert all((PdfFit, redirect_stdout, is_element))
3439

3540
# End of file

0 commit comments

Comments
 (0)