This is a second way to initialize StructuredVoidFormat, using the raw data as input. Added to avoid changing the signature of __init__.
(cls, data, **options)
| 1474 | |
| 1475 | @classmethod |
| 1476 | def from_data(cls, data, **options): |
| 1477 | """ |
| 1478 | This is a second way to initialize StructuredVoidFormat, |
| 1479 | using the raw data as input. Added to avoid changing |
| 1480 | the signature of __init__. |
| 1481 | """ |
| 1482 | format_functions = [] |
| 1483 | for field_name in data.dtype.names: |
| 1484 | format_function = _get_format_function(data[field_name], **options) |
| 1485 | if data.dtype[field_name].shape != (): |
| 1486 | format_function = SubArrayFormat(format_function, **options) |
| 1487 | format_functions.append(format_function) |
| 1488 | return cls(format_functions) |
| 1489 | |
| 1490 | def __call__(self, x): |
| 1491 | str_fields = [ |
no test coverage detected