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

Commit

Permalink
Fix type signature in simple_select_one_onecol and friends (#8241)
Browse files Browse the repository at this point in the history
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
  • Loading branch information
reivilibre and clokep authored Sep 4, 2020
1 parent c619253 commit e351298
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
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,
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

0 comments on commit e351298

Please sign in to comment.