Skip to content

Commit 593c9eb

Browse files
CJ-Wrightchiahaoliu
authored andcommitted
FIX: remove mutable args
(cherry picked from commit 6f6822a)
1 parent d4ba657 commit 593c9eb

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

diffpy/pdfmorph/morphs/morph.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,14 @@ class Morph(object):
8989
(self.xobjout, self.yobjout, self.xrefout, self.yrefout),
9090
doc='Return a tuple of all output arrays')
9191

92-
def __init__(self, config = {}):
92+
def __init__(self, config=None):
9393
'''Create a default Morph instance.
9494
9595
config -- dictionary that contains all configuration variables
9696
'''
9797
# declare empty attributes
98+
if config is None:
99+
config = {}
98100
self.xobjin = None
99101
self.yobjin = None
100102
self.xobjout = None

diffpy/pdfmorph/pdfplot.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
# FIXME - make this return the figure object in the future, so several views
2121
# can be composed.
22-
def plotPDFs(pairlist, labels = [], offset = 'auto', rmin = None, rmax = None):
22+
def plotPDFs(pairlist, labels=None, offset ='auto', rmin = None, rmax = None):
2323
"""Plots several PDFs on top of one another.
2424
2525
pairlist -- iterable of (r, gr) pairs to plot
@@ -36,6 +36,8 @@ def plotPDFs(pairlist, labels = [], offset = 'auto', rmin = None, rmax = None):
3636
upper bound of the PDF is not altered.
3737
3838
"""
39+
if labels is None:
40+
labels = []
3941
if offset is 'auto':
4042
offset = _findOffset(pairlist)
4143

@@ -59,8 +61,8 @@ def plotPDFs(pairlist, labels = [], offset = 'auto', rmin = None, rmax = None):
5961
pylab.show()
6062
return
6163

62-
def comparePDFs(pairlist, labels = [], rmin = None, rmax = None, show = True,
63-
maglim = None, mag = 5, rw = None, legend = True):
64+
def comparePDFs(pairlist, labels=None, rmin = None, rmax = None, show = True,
65+
maglim = None, mag = 5, rw = None, legend = True):
6466
"""Plot two PDFs on top of each other and difference curve.
6567
6668
pairlist -- iterable of (r, gr) pairs to plot
@@ -82,6 +84,8 @@ def comparePDFs(pairlist, labels = [], rmin = None, rmax = None, show = True,
8284
line. The difference curve will be in green and offset for clarity.
8385
8486
"""
87+
if labels is None:
88+
labels = []
8589
rfit, grfit = pairlist[0]
8690
rdat, grdat = pairlist[1]
8791
labeldata = labels[1]

0 commit comments

Comments
 (0)