Python matplotlib.cbook._str_equal() Examples
The following are 5
code examples of matplotlib.cbook._str_equal().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.cbook
, or try the search function
.
Example #1
Source File: font_manager.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def score_weight(self, weight1, weight2): """ Returns a match score between *weight1* and *weight2*. The result is 0.0 if both weight1 and weight 2 are given as strings and have the same value. Otherwise, the result is the absolute value of the difference between the CSS numeric values of *weight1* and *weight2*, normalized between 0.05 and 1.0. """ # exact match of the weight names, e.g. weight1 == weight2 == "regular" if cbook._str_equal(weight1, weight2): return 0.0 w1 = weight1 if isinstance(weight1, Number) else weight_dict[weight1] w2 = weight2 if isinstance(weight2, Number) else weight_dict[weight2] return 0.95 * (abs(w1 - w2) / 1000) + 0.05
Example #2
Source File: font_manager.py From CogAlg with MIT License | 6 votes |
def score_weight(self, weight1, weight2): """ Returns a match score between *weight1* and *weight2*. The result is 0.0 if both weight1 and weight 2 are given as strings and have the same value. Otherwise, the result is the absolute value of the difference between the CSS numeric values of *weight1* and *weight2*, normalized between 0.05 and 1.0. """ # exact match of the weight names, e.g. weight1 == weight2 == "regular" if cbook._str_equal(weight1, weight2): return 0.0 w1 = weight1 if isinstance(weight1, Number) else weight_dict[weight1] w2 = weight2 if isinstance(weight2, Number) else weight_dict[weight2] return 0.95 * (abs(w1 - w2) / 1000) + 0.05
Example #3
Source File: rcsetup.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def validate_hist_bins(s): if cbook._str_equal(s, "auto"): return s try: return int(s) except (TypeError, ValueError): pass try: return validate_floatlist(s) except ValueError: pass raise ValueError("'hist.bins' must be 'auto', an int or " + "a sequence of floats")
Example #4
Source File: rcsetup.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def validate_hist_bins(s): if cbook._str_equal(s, "auto"): return s try: return int(s) except (TypeError, ValueError): pass try: return validate_floatlist(s) except ValueError: pass raise ValueError("'hist.bins' must be 'auto', an int or " + "a sequence of floats")
Example #5
Source File: rcsetup.py From coffeegrindsize with MIT License | 5 votes |
def validate_hist_bins(s): if cbook._str_equal(s, "auto"): return s try: return int(s) except (TypeError, ValueError): pass try: return validate_floatlist(s) except ValueError: pass raise ValueError("'hist.bins' must be 'auto', an int or " + "a sequence of floats")