Get a version of the given `array` in a different flavor. The input `array` must be of the given `src_flavor`, and the returned array will be of the indicated `dst_flavor`. Both flavors may be the same, but it is not guaranteed that the returned array will be the same object as the
(
array: npt.ArrayLike, src_flavor: FlavorType, dst_flavor: FlavorType
)
| 107 | |
| 108 | |
| 109 | def array_of_flavor2( |
| 110 | array: npt.ArrayLike, src_flavor: FlavorType, dst_flavor: FlavorType |
| 111 | ) -> Any | list[Any] | np.ndarray: |
| 112 | """Get a version of the given `array` in a different flavor. |
| 113 | |
| 114 | The input `array` must be of the given `src_flavor`, and the |
| 115 | returned array will be of the indicated `dst_flavor`. Both |
| 116 | flavors may be the same, but it is not guaranteed that the |
| 117 | returned array will be the same object as the input one in this |
| 118 | case. |
| 119 | |
| 120 | If the conversion is not supported, a ``FlavorError`` is raised. |
| 121 | |
| 122 | """ |
| 123 | convkey = (src_flavor, dst_flavor) |
| 124 | if convkey not in converter_map: |
| 125 | raise FlavorError( |
| 126 | "conversion from flavor ``%s`` to flavor ``%s`` " |
| 127 | "is unsupported or unavailable in this system" |
| 128 | % (src_flavor, dst_flavor) |
| 129 | ) |
| 130 | |
| 131 | convfunc = converter_map[convkey] |
| 132 | return convfunc(array) |
| 133 | |
| 134 | |
| 135 | def flavor_to_flavor( |
no test coverage detected