(value: T, type: type[T], transform: Callable[[T], K])
| 313 | |
| 314 | @staticmethod |
| 315 | def __makeTransformedAttribute(value: T, type: type[T], transform: Callable[[T], K]) -> Attribute[K]: |
| 316 | if value is None: |
| 317 | return _ValuedAttribute(None) # type: ignore |
| 318 | elif isinstance(value, type): |
| 319 | try: |
| 320 | return _ValuedAttribute(transform(value)) |
| 321 | except Exception as e: |
| 322 | return _BadAttribute(value, type, e) # type: ignore |
| 323 | else: |
| 324 | return _BadAttribute(value, type) # type: ignore |
| 325 | |
| 326 | @staticmethod |
| 327 | def _makeStringAttribute(value: int | str | None) -> Attribute[str]: |
no test coverage detected