| 2215 | |
| 2216 | @util.preload_module("sqlalchemy.orm.dependency") |
| 2217 | def _post_init(self) -> None: |
| 2218 | dependency = util.preloaded.orm_dependency |
| 2219 | |
| 2220 | if self.uselist is None: |
| 2221 | self.uselist = self.direction is not MANYTOONE |
| 2222 | if not self.viewonly: |
| 2223 | self._dependency_processor = ( # type: ignore |
| 2224 | dependency._DependencyProcessor.from_relationship |
| 2225 | )(self) |
| 2226 | |
| 2227 | if ( |
| 2228 | self.uselist |
| 2229 | and self._attribute_options.dataclasses_default |
| 2230 | is not _NoArg.NO_ARG |
| 2231 | ): |
| 2232 | raise sa_exc.ArgumentError( |
| 2233 | f"On relationship {self}, the dataclass default for " |
| 2234 | "relationship may only be set for " |
| 2235 | "a relationship that references a scalar value, i.e. " |
| 2236 | "many-to-one or explicitly uselist=False" |
| 2237 | ) |
| 2238 | |
| 2239 | @util.memoized_property |
| 2240 | def _use_get(self) -> bool: |