(self, v)
| 1708 | return desc |
| 1709 | |
| 1710 | def validate_coerce(self, v): |
| 1711 | if is_none_or_typed_array_spec(v): |
| 1712 | pass |
| 1713 | elif self.array_ok and is_homogeneous_array(v): |
| 1714 | try: |
| 1715 | v_array = copy_to_readonly_numpy_array(v, force_numeric=True) |
| 1716 | except (ValueError, TypeError, OverflowError): |
| 1717 | self.raise_invalid_val(v) |
| 1718 | v = v_array # Always numeric numpy array |
| 1719 | # Normalize v onto the interval [-180, 180) |
| 1720 | v = (v + 180) % 360 - 180 |
| 1721 | elif self.array_ok and is_simple_array(v): |
| 1722 | # Check numeric |
| 1723 | invalid_els = [e for e in v if not isinstance(e, numbers.Number)] |
| 1724 | |
| 1725 | if invalid_els: |
| 1726 | self.raise_invalid_elements(invalid_els[:10]) |
| 1727 | |
| 1728 | v = [(x + 180) % 360 - 180 for x in to_scalar_or_list(v)] |
| 1729 | elif not isinstance(v, numbers.Number): |
| 1730 | self.raise_invalid_val(v) |
| 1731 | else: |
| 1732 | # Normalize v onto the interval [-180, 180) |
| 1733 | v = (v + 180) % 360 - 180 |
| 1734 | |
| 1735 | return v |
| 1736 | |
| 1737 | |
| 1738 | class SubplotidValidator(BaseValidator): |
nothing calls this directly
no test coverage detected