MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / new_instance

Method new_instance

lib/sqlalchemy/orm/instrumentation.py:493–502  ·  view source on GitHub ↗
(self, state: Optional[InstanceState[_O]] = None)

Source from the content-addressed store, hash-verified

491 # InstanceState management
492
493 def new_instance(self, state: Optional[InstanceState[_O]] = None) -> _O:
494 # here, we would prefer _O to be bound to "object"
495 # so that mypy sees that __new__ is present. currently
496 # it's bound to Any as there were other problems not having
497 # it that way but these can be revisited
498 instance = self.class_.__new__(self.class_)
499 if state is None:
500 state = self._state_constructor(instance, self)
501 self._state_setter(instance, state)
502 return instance
503
504 def setup_instance(
505 self, instance: _O, state: Optional[InstanceState[_O]] = None

Callers 2

_instanceFunction · 0.45
_mergeMethod · 0.45

Calls 2

_state_constructorMethod · 0.95
__new__Method · 0.45

Tested by

no test coverage detected