MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _calc_owner

Method _calc_owner

lib/sqlalchemy/ext/associationproxy.py:524–537  ·  view source on GitHub ↗
(self, target_cls: Any)

Source from the content-addressed store, hash-verified

522 return inst # type: ignore # TODO
523
524 def _calc_owner(self, target_cls: Any) -> Any:
525 # we might be getting invoked for a subclass
526 # that is not mapped yet, in some declarative situations.
527 # save until we are mapped
528 try:
529 insp = inspect(target_cls)
530 except exc.NoInspectionAvailable:
531 # can't find a mapper, don't set owner. if we are a not-yet-mapped
532 # subclass, we can also scan through __mro__ to find a mapped
533 # class, but instead just wait for us to be called again against a
534 # mapped class normally.
535 return None
536 else:
537 return insp.mapper.class_manager.class_
538
539 def _default_getset(
540 self, collection_class: Any

Callers 3

_as_instanceMethod · 0.95
deleteMethod · 0.80

Calls 1

inspectFunction · 0.90

Tested by 1