Skip to content

Commit 520f319

Browse files
authored
chore: Fix internal deprecated function usage (#202)
* change deprecated functions used internally to their new function names * news
1 parent 6f4d7b9 commit 520f319

14 files changed

Lines changed: 53 additions & 31 deletions

‎news/fix-internal-deps.rst‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* No news needed: fix internal use of deprecated functions.
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

‎src/diffpy/structure/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ def load_structure(filename, fmt="auto", **kw):
101101
Path to the file to be loaded.
102102
fmt : str, Optional
103103
Format of the structure file such as 'cif' or 'xyz'. Must be
104-
one of the formats listed by the `parsers.inputFormats` function.
104+
one of the formats listed by the `parsers.input_formats` function.
105105
When 'auto', all supported formats are tried in a sequence.
106106
kw : Optional
107-
Extra keyword arguments that are passed to `parsers.getParser`
107+
Extra keyword arguments that are passed to `parsers.get_parser`
108108
function. These configure the dedicated Parser object that
109109
is used to read content in filename.
110110

‎src/diffpy/structure/apps/anyeye.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def convert_structure_file(pd):
187187
fmt = pd.get("format", "auto")
188188
stru = None
189189
if fmt == "auto":
190-
stru, fmt = loadStructureFile(strufile)
190+
stru, fmt = load_structure_file(strufile)
191191
pd["fmt"] = fmt
192192
# if fmt is recognized by the viewer, use as is
193193
if fmt in pd["formats"] and pd["formula"] is None:

‎src/diffpy/structure/lattice.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ class Lattice(object):
159159
Note
160160
----
161161
The array attributes are read-only. They get updated by changing
162-
some lattice parameters or by calling the `setLatPar()` or
163-
`setLatBase()` methods.
162+
some lattice parameters or by calling the `set_latt_parms()` or
163+
`set_new_latt_base_vec()` methods.
164164
165165
Examples
166166
--------
@@ -757,13 +757,13 @@ def __repr__(self):
757757
I3 = numpy.identity(3, dtype=float)
758758
rotbaseI3diff = max(numpy.reshape(numpy.fabs(self.baserot - I3), 9))
759759
cartlatpar = numpy.array([1.0, 1.0, 1.0, 90.0, 90.0, 90.0])
760-
latpardiff = cartlatpar - self.abcABG()
760+
latpardiff = cartlatpar - self.cell_parms()
761761
if rotbaseI3diff > self._epsilon:
762762
s = "Lattice(base=%r)" % self.base
763763
elif numpy.fabs(latpardiff).max() < self._epsilon:
764764
s = "Lattice()"
765765
else:
766-
s = "Lattice(a=%g, b=%g, c=%g, alpha=%g, beta=%g, gamma=%g)" % self.abcABG()
766+
s = "Lattice(a=%g, b=%g, c=%g, alpha=%g, beta=%g, gamma=%g)" % self.cell_parms()
767767
return s
768768

769769

‎src/diffpy/structure/parsers/__init__.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1717
The recognized structure formats are defined by subclassing `StructureParser`,
1818
by convention these classes are named `P_<format>.py`. The parser classes should
19-
to override the `parseLines()` and `toLines()` methods of `StructureParser`.
19+
to override the `parse_lines()` and `to_lines()` methods of `StructureParser`.
2020
Any structure parser needs to be registered in `parser_index` module.
2121
2222
For normal usage it should be sufficient to use the routines provided
@@ -25,9 +25,9 @@
2525
Content:
2626
* StructureParser: base class for a concrete Parser
2727
* parser_index: dictionary of known structure formats
28-
* getParser: factory for Parser at given format
29-
* inputFormats: list of available input formats
30-
* outputFormats: list of available output formats
28+
* get_parser: factory for Parser at given format
29+
* input_formats: list of available input formats
30+
* output_formats: list of available output formats
3131
"""
3232

3333
from diffpy.structure.parsers.parser_index_mod import parser_index

‎src/diffpy/structure/parsers/p_auto.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
##############################################################################
1515
"""Parser for automatic file format detection.
1616
17-
This Parser does not provide the the `toLines()` method.
17+
This Parser does not provide the the `to_lines()` method.
1818
"""
1919

2020
import os

‎src/diffpy/structure/parsers/p_cif.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
rx_float : re.Pattern
2020
The constant regular expression for `leading_float()`.
2121
symvec : dict
22-
The helper dictionary for `getSymOp()`.
22+
The helper dictionary for `get_symop()`.
2323
2424
Note
2525
----
@@ -362,7 +362,6 @@ def parseLines(self, lines):
362362
"""
363363
return self.parse_lines(lines)
364364

365-
@deprecated(parseLines_deprecation_msg)
366365
def parse_lines(self, lines):
367366
"""Parse list of lines in CIF format.
368367

‎src/diffpy/structure/parsers/p_discus.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def parseLines(self, lines):
140140
raise StructureFormatError(emsg)
141141
# take care of superlattice
142142
if self.stru.pdffit["ncell"][:3] != [1, 1, 1]:
143-
latpars = list(self.stru.lattice.abcABG())
143+
latpars = list(self.stru.lattice.cell_parms())
144144
superlatpars = [latpars[i] * self.stru.pdffit["ncell"][i] for i in range(3)] + latpars[3:]
145145
superlattice = Lattice(*superlatpars)
146146
self.stru.place_in_lattice(superlattice)
@@ -215,7 +215,7 @@ def parse_lines(self, lines):
215215
raise StructureFormatError(emsg)
216216
# take care of superlattice
217217
if self.stru.pdffit["ncell"][:3] != [1, 1, 1]:
218-
latpars = list(self.stru.lattice.abcABG())
218+
latpars = list(self.stru.lattice.cell_parms())
219219
superlatpars = [latpars[i] * self.stru.pdffit["ncell"][i] for i in range(3)] + latpars[3:]
220220
superlattice = Lattice(*superlatpars)
221221
self.stru.place_in_lattice(superlattice)
@@ -268,7 +268,7 @@ def to_lines(self, stru):
268268
if stru_pdffit.get("stepcut", 0.0) > 0.0:
269269
line = "shape stepcut, %g" % stru_pdffit["stepcut"]
270270
lines.append(line)
271-
lines.append("cell %9.6f, %9.6f, %9.6f, %9.6f, %9.6f, %9.6f" % self.stru.lattice.abcABG())
271+
lines.append("cell %9.6f, %9.6f, %9.6f, %9.6f, %9.6f, %9.6f" % self.stru.lattice.cell_parms())
272272
lines.append("ncell %9i, %9i, %9i, %9i" % (1, 1, 1, len(self.stru)))
273273
lines.append("atoms")
274274
for a in self.stru:

‎src/diffpy/structure/parsers/p_pdb.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ def parse_lines(self, lines):
215215
sc[2, :] = [float(x) for x in line[10:40].split()]
216216
scaleU[2] = float(line[45:55])
217217
base = numpy.transpose(numpy.linalg.inv(sc))
218-
abcABGcryst = numpy.array(stru.lattice.abcABG())
218+
abcABGcryst = numpy.array(stru.lattice.cell_parms())
219219
stru.lattice.set_new_latt_base_vec(base)
220-
abcABGscale = numpy.array(stru.lattice.abcABG())
220+
abcABGscale = numpy.array(stru.lattice.cell_parms())
221221
reldiff = numpy.fabs(1.0 - abcABGscale / abcABGcryst)
222222
if not numpy.all(reldiff < 1.0e-4):
223223
emsg = "%d: " % p_nl + "SCALE and CRYST1 are not consistent."

‎src/diffpy/structure/parsers/p_vesta.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def parse_lines(self, lines):
184184
emsg = "VESTA file is missing STRUC lattice parameters"
185185
raise StructureFormatError(emsg)
186186

187-
stru.lattice.setLatPar(
187+
stru.lattice.set_latt_parms(
188188
a=latt_abc[0],
189189
b=latt_abc[1],
190190
c=latt_abc[2],

0 commit comments

Comments
 (0)