Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix type signature in simple_select_one_onecol and friends #8241

Merged
merged 3 commits into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8241.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add type hints to `synapse.storage.database`.
17 changes: 7 additions & 10 deletions synapse/storage/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ async def simple_select_one_onecol(
self,
table: str,
keyvalues: Dict[str, Any],
retcol: Iterable[str],
retcol: str,
allow_none: Literal[False] = False,
desc: str = "simple_select_one_onecol",
) -> Any:
Expand All @@ -1115,7 +1115,7 @@ async def simple_select_one_onecol(
self,
table: str,
keyvalues: Dict[str, Any],
retcol: Iterable[str],
retcol: str,
allow_none: Literal[True] = True,
desc: str = "simple_select_one_onecol",
) -> Optional[Any]:
Expand All @@ -1125,7 +1125,7 @@ async def simple_select_one_onecol(
self,
table: str,
keyvalues: Dict[str, Any],
retcol: Iterable[str],
retcol: str,
clokep marked this conversation as resolved.
Show resolved Hide resolved
allow_none: bool = False,
desc: str = "simple_select_one_onecol",
) -> Optional[Any]:
Expand Down Expand Up @@ -1156,7 +1156,7 @@ def simple_select_one_onecol_txn(
txn: LoggingTransaction,
table: str,
keyvalues: Dict[str, Any],
retcol: Iterable[str],
retcol: str,
allow_none: Literal[False] = False,
) -> Any:
...
Expand All @@ -1168,7 +1168,7 @@ def simple_select_one_onecol_txn(
txn: LoggingTransaction,
table: str,
keyvalues: Dict[str, Any],
retcol: Iterable[str],
retcol: str,
allow_none: Literal[True] = True,
) -> Optional[Any]:
...
Expand All @@ -1179,7 +1179,7 @@ def simple_select_one_onecol_txn(
txn: LoggingTransaction,
table: str,
keyvalues: Dict[str, Any],
retcol: Iterable[str],
retcol: str,
allow_none: bool = False,
) -> Optional[Any]:
ret = cls.simple_select_onecol_txn(
Expand All @@ -1196,10 +1196,7 @@ def simple_select_one_onecol_txn(

@staticmethod
def simple_select_onecol_txn(
txn: LoggingTransaction,
table: str,
keyvalues: Dict[str, Any],
retcol: Iterable[str],
txn: LoggingTransaction, table: str, keyvalues: Dict[str, Any], retcol: str,
) -> List[Any]:
sql = ("SELECT %(retcol)s FROM %(table)s") % {"retcol": retcol, "table": table}

Expand Down