(data, unit)
| 104 | |
| 105 | |
| 106 | def array_attach_units(data, unit): |
| 107 | if isinstance(data, Quantity) and data.units != unit: |
| 108 | raise ValueError(f"cannot attach unit {unit} to quantity {data}") |
| 109 | |
| 110 | if unit in no_unit_values or (isinstance(unit, int) and unit == 1): |
| 111 | return data |
| 112 | |
| 113 | quantity = unit_registry.Quantity(data, unit) |
| 114 | return quantity |
| 115 | |
| 116 | |
| 117 | def extract_units(obj): |
no outgoing calls
no test coverage detected
searching dependent graphs…