MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _serialize_path

Method _serialize_path

lib/sqlalchemy/orm/path_registry.py:253–269  ·  view source on GitHub ↗
(cls, path: _PathRepresentation)

Source from the content-addressed store, hash-verified

251
252 @classmethod
253 def _serialize_path(cls, path: _PathRepresentation) -> _SerializedPath:
254 _m_path = cast(_OddPathRepresentation, path)
255 _p_path = cast(_EvenPathRepresentation, path)
256
257 return list(
258 zip(
259 tuple(
260 m.class_ if (m.is_mapper or m.is_aliased_class) else str(m)
261 for m in [_m_path[i] for i in range(0, len(_m_path), 2)]
262 ),
263 tuple(
264 p.key if insp_is_mapper_property(p) else str(p)
265 for p in [_p_path[i] for i in range(1, len(_p_path), 2)]
266 )
267 + (None,),
268 )
269 )
270
271 @classmethod
272 def _deserialize_path(cls, path: _SerializedPath) -> _PathRepresentation:

Callers 1

serializeMethod · 0.95

Calls 2

insp_is_mapper_propertyFunction · 0.85
castFunction · 0.50

Tested by

no test coverage detected