Construct an Axes. Args: axes: A list of Axis objects or (axis_name, axis_value) tuples. Raises: ValueError: If the user provides empty or duplicate axis names.
(self, axes)
| 205 | |
| 206 | @tc.accepts(object, tc.List(AxisLike)) |
| 207 | def __init__(self, axes): |
| 208 | """Construct an Axes. |
| 209 | |
| 210 | Args: |
| 211 | axes: A list of Axis objects or (axis_name, axis_value) tuples. |
| 212 | |
| 213 | Raises: |
| 214 | ValueError: If the user provides empty or duplicate axis names. |
| 215 | """ |
| 216 | self._axes = collections.OrderedDict() |
| 217 | |
| 218 | for axis_data in axes: |
| 219 | axis = as_axis(axis_data) |
| 220 | |
| 221 | name = axis.name |
| 222 | if name in self._axes: |
| 223 | raise ValueError('Duplicate axis name: %s' % name) |
| 224 | |
| 225 | self._axes[name] = axis |
| 226 | |
| 227 | def __iter__(self): |
| 228 | return iter(self._axes) |