Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7d741df

Browse filesBrowse files
authored
Merge pull request #21402 from DimitriPapadopoulos/argument_mutable_default
Do not use mutables as default parameters
2 parents a08089f + 5af3e19 commit 7d741df
Copy full SHA for 7d741df

File tree

Expand file treeCollapse file tree

3 files changed

+10
-5
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-5
lines changed

‎examples/images_contours_and_fields/image_annotated_heatmap.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/image_annotated_heatmap.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797

9898

9999
def heatmap(data, row_labels, col_labels, ax=None,
100-
cbar_kw={}, cbarlabel="", **kwargs):
100+
cbar_kw=None, cbarlabel="", **kwargs):
101101
"""
102102
Create a heatmap from a numpy array and two lists of labels.
103103
@@ -120,9 +120,12 @@ def heatmap(data, row_labels, col_labels, ax=None,
120120
All other arguments are forwarded to `imshow`.
121121
"""
122122

123-
if not ax:
123+
if ax is None:
124124
ax = plt.gca()
125125

126+
if cbar_kw is None:
127+
cbar_kw = {}
128+
126129
# Plot the heatmap
127130
im = ax.imshow(data, **kwargs)
128131

‎examples/widgets/annotated_cursor.py

Copy file name to clipboardExpand all lines: examples/widgets/annotated_cursor.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ class AnnotatedCursor(Cursor):
7676
"""
7777

7878
def __init__(self, line, numberformat="{0:.4g};{1:.4g}", offset=(5, 5),
79-
dataaxis='x', textprops={}, **cursorargs):
79+
dataaxis='x', textprops=None, **cursorargs):
80+
if textprops is None:
81+
textprops = {}
8082
# The line object, for which the coordinates are displayed
8183
self.line = line
8284
# The format string, on which .format() is called for creating the text

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ def flush(self):
249249
pass # replaced by the constructor
250250

251251

252-
def generate_transform(transform_list=[]):
253-
if len(transform_list):
252+
def generate_transform(transform_list=None):
253+
if transform_list:
254254
output = StringIO()
255255
for type, value in transform_list:
256256
if (type == 'scale' and (value == (1,) or value == (1, 1))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.