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

Class ReadOnlyColumnCollection

lib/sqlalchemy/sql/base.py:2202–2228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2200
2201
2202class ReadOnlyColumnCollection(
2203 util.ReadOnlyContainer, ColumnCollection[_COLKEY, _COL_co]
2204):
2205 __slots__ = ("_parent",)
2206
2207 def __init__(self, collection: ColumnCollection[_COLKEY, _COL_co]):
2208 object.__setattr__(self, "_parent", collection)
2209 object.__setattr__(self, "_colset", collection._colset)
2210 object.__setattr__(self, "_index", collection._index)
2211 object.__setattr__(self, "_collection", collection._collection)
2212 object.__setattr__(self, "_proxy_index", collection._proxy_index)
2213
2214 def __getstate__(self) -> Dict[str, _COL_co]:
2215 return {"_parent": self._parent}
2216
2217 def __setstate__(self, state: Dict[str, Any]) -> None:
2218 parent = state["_parent"]
2219 self.__init__(parent) # type: ignore
2220
2221 def add(self, column: Any, key: Any = ...) -> Any:
2222 self._readonly()
2223
2224 def extend(self, elements: Any) -> NoReturn:
2225 self._readonly()
2226
2227 def remove(self, item: Any) -> NoReturn:
2228 self._readonly()
2229
2230
2231class ColumnSet(util.OrderedSet["ColumnClause[Any]"]):

Callers 1

as_readonlyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected