Add an item by value, consulting the keyfunc for the key.
(
self,
value: _KT,
_sa_initiator: Union[AttributeEventToken, Literal[None, False]] = None,
)
| 446 | @collection.appender # type: ignore[untyped-decorator] |
| 447 | @collection.internally_instrumented # type: ignore[untyped-decorator] |
| 448 | def set( |
| 449 | self, |
| 450 | value: _KT, |
| 451 | _sa_initiator: Union[AttributeEventToken, Literal[None, False]] = None, |
| 452 | ) -> None: |
| 453 | """Add an item by value, consulting the keyfunc for the key.""" |
| 454 | |
| 455 | key = self.keyfunc(value) |
| 456 | |
| 457 | if key is base.NO_VALUE: |
| 458 | if not self.ignore_unpopulated_attribute: |
| 459 | self._raise_for_unpopulated( |
| 460 | value, _sa_initiator, warn_only=False |
| 461 | ) |
| 462 | else: |
| 463 | return |
| 464 | elif key is Missing: |
| 465 | if not self.ignore_unpopulated_attribute: |
| 466 | self._raise_for_unpopulated( |
| 467 | value, _sa_initiator, warn_only=True |
| 468 | ) |
| 469 | key = None |
| 470 | else: |
| 471 | return |
| 472 | |
| 473 | self.__setitem__(key, value, _sa_initiator) # type: ignore[call-arg] |
| 474 | |
| 475 | @collection.remover # type: ignore[untyped-decorator] |
| 476 | @collection.internally_instrumented # type: ignore[untyped-decorator] |
nothing calls this directly
no test coverage detected