Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d70795d

Browse files
committed
MNT: remove debugging code, clean up imports, improve warning
1 parent 7196cd5 commit d70795d

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,6 @@ def set_hatch_color(self, hatch_color):
11191119
"""
11201120
Gets the color to use for hatching.
11211121
"""
1122-
if hatch_color is None:
1123-
raise ValueError()
11241122
self._hatch_color = hatch_color
11251123

11261124
def get_hatch_linewidth(self):

lib/matplotlib/collections.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ def draw(self, renderer):
299299
gc.set_hatch_color(self._hatch_color)
300300
except AttributeError:
301301
# if we end up with a GC that does not have this method
302-
import warnings
303-
warnings.warn("Your backend does not have support for "
304-
"setting the hatch color.")
302+
warnings.warn("Your backend does not support setting the "
303+
"hatch color.")
304+
305305

306306
if self.get_sketch_params() is not None:
307307
gc.set_sketch_params(*self.get_sketch_params())

lib/matplotlib/patches.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import six
77
from six.moves import map, zip
8+
import warnings
89

910
import math
1011

@@ -117,7 +118,6 @@ def __init__(self,
117118
self._fill = True # needed for set_facecolor call
118119
if color is not None:
119120
if (edgecolor is not None or facecolor is not None):
120-
import warnings
121121
warnings.warn("Setting the 'color' property will override"
122122
"the edgecolor or facecolor properties. ")
123123
self.set_color(color)
@@ -556,7 +556,6 @@ def draw(self, renderer):
556556
gc.set_hatch_color(self._hatch_color)
557557
except AttributeError:
558558
# if we end up with a GC that does not have this method
559-
import warnings
560559
warnings.warn("Your backend does not have support for "
561560
"setting the hatch color.")
562561

@@ -4305,9 +4304,8 @@ def draw(self, renderer):
43054304
gc.set_hatch_color(self._hatch_color)
43064305
except AttributeError:
43074306
# if we end up with a GC that does not have this method
4308-
import warnings
4309-
warnings.warn("Your backend does not have support for "
4310-
"setting the hatch color.")
4307+
warnings.warn("Your backend does not support setting the "
4308+
"hatch color.")
43114309

43124310
if self.get_sketch_params() is not None:
43134311
gc.set_sketch_params(*self.get_sketch_params())

0 commit comments

Comments
 (0)