Skip to content

Commit 8af2e9b

Browse files
committed
Add src
1 parent d39431e commit 8af2e9b

File tree

6 files changed

+41
-77
lines changed

6 files changed

+41
-77
lines changed

src/diffpy/__init__.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
#!/usr/bin/env python
22
##############################################################################
33
#
4-
# diffpy by DANSE Diffraction group
5-
# Simon J. L. Billinge
6-
# (c) 2008 The Trustees of Columbia University
7-
# in the City of New York. All rights reserved.
4+
# (c) 2024 The Trustees of Columbia University in the City of New York.
5+
# All rights reserved.
86
#
9-
# File coded by: Chris Farrow
7+
# File coded by: Billinge Group members and community contributors.
108
#
11-
# See AUTHORS.txt for a list of people who contributed.
12-
# See LICENSE_DANSE.txt for license information.
9+
# See GitHub contributions for a more detailed list of contributors.
10+
# https://github.com/diffpy/diffpy.srfit/graphs/contributors
11+
#
12+
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
1515

16-
"""diffpy - tools for structure analysis by diffraction.
17-
18-
Blank namespace package.
19-
"""
16+
"""Blank namespace package for module diffpy."""
2017

2118

2219
from pkgutil import extend_path
2320

2421
__path__ = extend_path(__path__, __name__)
2522

26-
2723
# End of file

src/diffpy/srfit/__init__.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
#!/usr/bin/env python
22
##############################################################################
33
#
4-
# diffpy.srfit by DANSE Diffraction group
5-
# Simon J. L. Billinge
6-
# (c) 2008 The Trustees of Columbia University
7-
# in the City of New York. All rights reserved.
4+
# (c) 2024 The Trustees of Columbia University in the City of New York.
5+
# All rights reserved.
86
#
9-
# File coded by: Chris Farrow
7+
# File coded by: Billinge Group members and community contributors.
108
#
11-
# See AUTHORS.txt for a list of people who contributed.
12-
# See LICENSE_DANSE.txt for license information.
9+
# See GitHub contributions for a more detailed list of contributors.
10+
# https://github.com/diffpy/diffpy.srfit/graphs/contributors
11+
#
12+
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
1515

16+
1617
"""Complex modeling framework for structure refinement and solution.
1718
1819
SrFit is a tool for coherently combining known information about a material to
@@ -31,9 +32,10 @@
3132
learn how to use and customize the various parts of SrFit.
3233
"""
3334

34-
__all__ = ["__version__"]
35-
3635
# package version
3736
from diffpy.srfit.version import __version__
3837

38+
# silence the pyflakes syntax checker
39+
assert __version__ or True
40+
3941
# End of file

src/diffpy/srfit/equation/builder.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,10 @@ def __wrapSrFitOperators():
666666
def is_exported_type(cls):
667667
"""Check if the class should be wrapped as OperatorBuilder."""
668668
return (
669-
inspect.isclass(cls) and
670-
issubclass(cls, opmod.Operator) and
671-
not inspect.isabstract(cls) and
672-
cls not in excluded_types
669+
inspect.isclass(cls)
670+
and issubclass(cls, opmod.Operator)
671+
and not inspect.isabstract(cls)
672+
and cls not in excluded_types
673673
)
674674

675675
# create OperatorBuilder objects

src/diffpy/srfit/interface/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@
2121
"""
2222

2323

24-
from diffpy.srfit.interface.interface import ParameterInterface
24+
from diffpy.srfit.interface.interface import FitRecipeInterface, ParameterInterface, RecipeOrganizerInterface
2525

2626
_parameter_interface = ParameterInterface
2727

28-
from diffpy.srfit.interface.interface import RecipeOrganizerInterface
29-
3028
_recipeorganizer_interface = RecipeOrganizerInterface
3129

32-
from diffpy.srfit.interface.interface import FitRecipeInterface
33-
3430
_fitrecipe_interface = FitRecipeInterface
3531

3632
# End of file

src/diffpy/srfit/structure/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
interface and automatic structure constraint generation from space group
1818
information.
1919
"""
20+
from diffpy.srfit.structure.sgconstraints import constrainAsSpaceGroup
21+
22+
# silence pyflakes checker
23+
assert constrainAsSpaceGroup
2024

2125

2226
def struToParameterSet(name, stru):
@@ -54,10 +58,4 @@ def struToParameterSet(name, stru):
5458
raise TypeError("Unadaptable structure format")
5559

5660

57-
from diffpy.srfit.structure.sgconstraints import constrainAsSpaceGroup
58-
59-
# silence pyflakes checker
60-
assert constrainAsSpaceGroup
61-
62-
6361
# End of file

src/diffpy/srfit/version.py

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,26 @@
11
#!/usr/bin/env python
22
##############################################################################
33
#
4-
# diffpy.srfit by DANSE Diffraction group
5-
# Simon J. L. Billinge
6-
# (c) 2008 The Trustees of Columbia University
7-
# in the City of New York. All rights reserved.
4+
# (c) 2024 The Trustees of Columbia University in the City of New York.
5+
# All rights reserved.
86
#
9-
# File coded by: Chris Farrow
7+
# File coded by: Billinge Group members and community contributors.
108
#
11-
# See AUTHORS.txt for a list of people who contributed.
12-
# See LICENSE_DANSE.txt for license information.
9+
# See GitHub contributions for a more detailed list of contributors.
10+
# https://github.com/diffpy/diffpy.srfit/graphs/contributors
11+
#
12+
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
1515

16-
"""
17-
Definition of __version__, __date__, __timestamp__, __git_commit__.
18-
19-
Notes
20-
-----
21-
Variable `__gitsha__` is deprecated as of version 3.0.
22-
Use `__git_commit__` instead.
23-
"""
24-
25-
__all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"]
26-
27-
import os.path
28-
29-
from pkg_resources import resource_filename
30-
31-
# obtain version information from the version.cfg file
32-
cp = dict(version="", date="", commit="", timestamp="0")
33-
fcfg = resource_filename(__name__, "version.cfg")
34-
if not os.path.isfile(fcfg): # pragma: no cover
35-
from warnings import warn
36-
37-
warn('Package metadata not found, execute "./setup.py egg_info".')
38-
fcfg = os.devnull
39-
with open(fcfg) as fp:
40-
kwords = [[w.strip() for w in line.split(" = ", 1)] for line in fp if line[:1].isalpha() and " = " in line]
41-
assert all(w[0] in cp for w in kwords), "received unrecognized keyword"
42-
cp.update(kwords)
16+
"""Definition of __version__."""
4317

44-
__version__ = cp["version"]
45-
__date__ = cp["date"]
46-
__git_commit__ = cp["commit"]
47-
__timestamp__ = int(cp["timestamp"])
18+
# We do not use the other three variables, but can be added back if needed.
19+
# __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"]
4820

49-
# TODO remove deprecated __gitsha__ in version 3.1.
50-
__gitsha__ = __git_commit__
21+
# obtain version information
22+
from importlib.metadata import version
5123

52-
del cp, fcfg, fp, kwords
24+
__version__ = version("diffpy.srfit")
5325

5426
# End of file

0 commit comments

Comments
 (0)