MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / replace

Method replace

lib/sqlalchemy/orm/relationships.py:2511–2523  ·  view source on GitHub ↗
(element: _CE, **kw: Any)

Source from the content-addressed store, hash-verified

2509 if self._has_remote_annotations:
2510
2511 def replace(element: _CE, **kw: Any) -> Optional[_CE]:
2512 if "remote" in element._annotations:
2513 v = dict(element._annotations)
2514 del v["remote"]
2515 v["local"] = True
2516 return element._with_annotations(v)
2517 elif "local" in element._annotations:
2518 v = dict(element._annotations)
2519 del v["local"]
2520 v["remote"] = True
2521 return element._with_annotations(v)
2522
2523 return None
2524
2525 return visitors.replacement_traverse(self.primaryjoin, {}, replace)
2526 else:

Callers

nothing calls this directly

Calls 1

_with_annotationsMethod · 0.45

Tested by

no test coverage detected