Skip to content

Commit 3041bc2

Browse files
authored
Merge pull request #162 from stevenhua0320/deprecate-utils-method
chore: deprecate private function in utils
2 parents 7da571a + 9c26c25 commit 3041bc2

3 files changed

Lines changed: 49 additions & 26 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* Added ``_link_atom_attribute`` method in ``diffpy.structure.utils``
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* Derecated ``_linkAtomAttribute`` method in ``diffpy.structure.utils`` for removal in version 4.0.0
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/structure/structure.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from diffpy.structure.atom import Atom
2323
from diffpy.structure.lattice import Lattice
24-
from diffpy.structure.utils import _linkAtomAttribute, atomBareSymbol, isiterable
24+
from diffpy.structure.utils import _link_atom_attribute, atomBareSymbol, isiterable
2525
from diffpy.utils._deprecator import build_deprecation_message, deprecated
2626

2727
# ----------------------------------------------------------------------------
@@ -812,149 +812,149 @@ def _get_composition(self):
812812

813813
# linked atom attributes
814814

815-
element = _linkAtomAttribute(
815+
element = _link_atom_attribute(
816816
"element",
817817
"""Character array of `Atom` types. Assignment updates
818818
the element attribute of the respective `Atoms`.
819819
Set the maximum length of the element string to 5 characters.""",
820820
toarray=lambda items: numpy.char.array(items, itemsize=5),
821821
)
822822

823-
xyz = _linkAtomAttribute(
823+
xyz = _link_atom_attribute(
824824
"xyz",
825825
"""Array of fractional coordinates of all `Atoms`.
826826
Assignment updates `xyz` attribute of all `Atoms`.""",
827827
)
828828

829-
x = _linkAtomAttribute(
829+
x = _link_atom_attribute(
830830
"x",
831831
"""Array of all fractional coordinates `x`.
832832
Assignment updates `xyz` attribute of all `Atoms`.""",
833833
)
834834

835-
y = _linkAtomAttribute(
835+
y = _link_atom_attribute(
836836
"y",
837837
"""Array of all fractional coordinates `y`.
838838
Assignment updates `xyz` attribute of all `Atoms`.""",
839839
)
840840

841-
z = _linkAtomAttribute(
841+
z = _link_atom_attribute(
842842
"z",
843843
"""Array of all fractional coordinates `z`.
844844
Assignment updates `xyz` attribute of all `Atoms`.""",
845845
)
846846

847-
label = _linkAtomAttribute(
847+
label = _link_atom_attribute(
848848
"label",
849849
"""Character array of `Atom` names. Assignment updates
850850
the label attribute of all `Atoms`.
851851
Set the maximum length of the label string to 5 characters.""",
852852
toarray=lambda items: numpy.char.array(items, itemsize=5),
853853
)
854854

855-
occupancy = _linkAtomAttribute(
855+
occupancy = _link_atom_attribute(
856856
"occupancy",
857857
"""Array of `Atom` occupancies. Assignment updates the
858858
occupancy attribute of all `Atoms`.""",
859859
)
860860

861-
xyz_cartn = _linkAtomAttribute(
861+
xyz_cartn = _link_atom_attribute(
862862
"xyz_cartn",
863863
"""Array of absolute Cartesian coordinates of all `Atoms`.
864864
Assignment updates the `xyz` attribute of all `Atoms`.""",
865865
)
866866

867-
anisotropy = _linkAtomAttribute(
867+
anisotropy = _link_atom_attribute(
868868
"anisotropy",
869869
"""Boolean array for anisotropic thermal displacement flags.
870870
Assignment updates the anisotropy attribute of all `Atoms`.""",
871871
)
872872

873-
U = _linkAtomAttribute(
873+
U = _link_atom_attribute(
874874
"U",
875875
"""Array of anisotropic thermal displacement tensors.
876876
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
877877
)
878878

879-
Uisoequiv = _linkAtomAttribute(
879+
Uisoequiv = _link_atom_attribute(
880880
"Uisoequiv",
881881
"""Array of isotropic thermal displacement or equivalent values.
882882
Assignment updates the U attribute of all `Atoms`.""",
883883
)
884884

885-
U11 = _linkAtomAttribute(
885+
U11 = _link_atom_attribute(
886886
"U11",
887887
"""Array of `U11` elements of the anisotropic displacement tensors.
888888
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
889889
)
890890

891-
U22 = _linkAtomAttribute(
891+
U22 = _link_atom_attribute(
892892
"U22",
893893
"""Array of `U22` elements of the anisotropic displacement tensors.
894894
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
895895
)
896896

897-
U33 = _linkAtomAttribute(
897+
U33 = _link_atom_attribute(
898898
"U33",
899899
"""Array of `U33` elements of the anisotropic displacement tensors.
900900
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
901901
)
902902

903-
U12 = _linkAtomAttribute(
903+
U12 = _link_atom_attribute(
904904
"U12",
905905
"""Array of `U12` elements of the anisotropic displacement tensors.
906906
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
907907
)
908908

909-
U13 = _linkAtomAttribute(
909+
U13 = _link_atom_attribute(
910910
"U13",
911911
"""Array of `U13` elements of the anisotropic displacement tensors.
912912
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
913913
)
914914

915-
U23 = _linkAtomAttribute(
915+
U23 = _link_atom_attribute(
916916
"U23",
917917
"""Array of `U23` elements of the anisotropic displacement tensors.
918918
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
919919
)
920920

921-
Bisoequiv = _linkAtomAttribute(
921+
Bisoequiv = _link_atom_attribute(
922922
"Bisoequiv",
923923
"""Array of Debye-Waller isotropic thermal displacement or equivalent
924924
values. Assignment updates the U attribute of all `Atoms`.""",
925925
)
926926

927-
B11 = _linkAtomAttribute(
927+
B11 = _link_atom_attribute(
928928
"B11",
929929
"""Array of `B11` elements of the Debye-Waller displacement tensors.
930930
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
931931
)
932932

933-
B22 = _linkAtomAttribute(
933+
B22 = _link_atom_attribute(
934934
"B22",
935935
"""Array of `B22` elements of the Debye-Waller displacement tensors.
936936
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
937937
)
938938

939-
B33 = _linkAtomAttribute(
939+
B33 = _link_atom_attribute(
940940
"B33",
941941
"""Array of `B33` elements of the Debye-Waller displacement tensors.
942942
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
943943
)
944944

945-
B12 = _linkAtomAttribute(
945+
B12 = _link_atom_attribute(
946946
"B12",
947947
"""Array of `B12` elements of the Debye-Waller displacement tensors.
948948
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
949949
)
950950

951-
B13 = _linkAtomAttribute(
951+
B13 = _link_atom_attribute(
952952
"B13",
953953
"""Array of `B13` elements of the Debye-Waller displacement tensors.
954954
Assignment updates the U and anisotropy attributes of all `Atoms`.""",
955955
)
956956

957-
B23 = _linkAtomAttribute(
957+
B23 = _link_atom_attribute(
958958
"B23",
959959
"""Array of `B23` elements of the Debye-Waller displacement tensors.
960960
Assignment updates the U and anisotropy attributes of all `Atoms`.""",

src/diffpy/structure/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def atomBareSymbol(smbl):
6969
# Helpers for the Structure class --------------------------------------------
7070

7171

72-
def _linkAtomAttribute(attrname, doc, toarray=numpy.array):
72+
def _link_atom_attribute(attrname, doc, toarray=numpy.array):
7373
"""Create property wrapper that maps the specified atom attribute.
7474
7575
The returned property object provides convenient access to atom

0 commit comments

Comments
 (0)