(accessor: TypeT)
| 281 | """ |
| 282 | |
| 283 | def decorator(accessor: TypeT) -> TypeT: |
| 284 | if hasattr(cls, name): |
| 285 | warnings.warn( |
| 286 | f"registration of accessor {accessor!r} under name " |
| 287 | f"{name!r} for type {cls!r} is overriding a preexisting " |
| 288 | f"attribute with the same name.", |
| 289 | UserWarning, |
| 290 | stacklevel=find_stack_level(), |
| 291 | ) |
| 292 | setattr(cls, name, Accessor(name, accessor)) |
| 293 | cls._accessors.add(name) |
| 294 | return accessor |
| 295 | |
| 296 | return decorator |
| 297 |
nothing calls this directly
no test coverage detected