main commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-16 16:30:25 +09:00
parent 91c7e04474
commit 537e7b363f
1146 changed files with 45926 additions and 77196 deletions

View File

@@ -1,5 +1,5 @@
# engine/row.py
# Copyright (C) 2005-2025 the SQLAlchemy authors and contributors
# Copyright (C) 2005-2023 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
@@ -213,12 +213,15 @@ class Row(BaseRow, Sequence[Any], Generic[_TP]):
if TYPE_CHECKING:
@overload
def __getitem__(self, index: int) -> Any: ...
def __getitem__(self, index: int) -> Any:
...
@overload
def __getitem__(self, index: slice) -> Sequence[Any]: ...
def __getitem__(self, index: slice) -> Sequence[Any]:
...
def __getitem__(self, index: Union[int, slice]) -> Any: ...
def __getitem__(self, index: Union[int, slice]) -> Any:
...
def __lt__(self, other: Any) -> bool:
return self._op(other, operator.lt)
@@ -293,8 +296,8 @@ class ROMappingView(ABC):
def __init__(
self, mapping: Mapping["_KeyType", Any], items: Sequence[Any]
):
self._mapping = mapping # type: ignore[misc]
self._items = items # type: ignore[misc]
self._mapping = mapping
self._items = items
def __len__(self) -> int:
return len(self._items)
@@ -318,11 +321,11 @@ class ROMappingView(ABC):
class ROMappingKeysValuesView(
ROMappingView, typing.KeysView["_KeyType"], typing.ValuesView[Any]
):
__slots__ = ("_items",) # mapping slot is provided by KeysView
__slots__ = ("_items",)
class ROMappingItemsView(ROMappingView, typing.ItemsView["_KeyType", Any]):
__slots__ = ("_items",) # mapping slot is provided by ItemsView
__slots__ = ("_items",)
class RowMapping(BaseRow, typing.Mapping["_KeyType", Any]):
@@ -340,11 +343,12 @@ class RowMapping(BaseRow, typing.Mapping["_KeyType", Any]):
as iteration of keys, values, and items::
for row in result:
if "a" in row._mapping:
print("Column 'a': %s" % row._mapping["a"])
if 'a' in row._mapping:
print("Column 'a': %s" % row._mapping['a'])
print("Column b: %s" % row._mapping[table.c.b])
.. versionadded:: 1.4 The :class:`.RowMapping` object replaces the
mapping-like access previously provided by a database result row,
which now seeks to behave mostly like a named tuple.
@@ -355,7 +359,8 @@ class RowMapping(BaseRow, typing.Mapping["_KeyType", Any]):
if TYPE_CHECKING:
def __getitem__(self, key: _KeyType) -> Any: ...
def __getitem__(self, key: _KeyType) -> Any:
...
else:
__getitem__ = BaseRow._get_by_key_impl_mapping