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

Commit

Permalink
Add note about how we could use ParamSpec in _do_execute
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre committed Mar 28, 2022
1 parent 4df10d3 commit 252a71e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions synapse/storage/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,16 @@ def _make_sql_one_line(self, sql: str) -> str:
"Strip newlines out of SQL so that the loggers in the DB are on one line"
return " ".join(line.strip() for line in sql.splitlines() if line.strip())

# TODO(ParamSpec):
# Once Mypy supports Concatenate, this could be written as
# def _do_execute(
# self,
# func: Callable[Concatenate[str, P], R],
# sql: str,
# *args: P.args,
# **kwargs: P.kwargs,
# ) -> R:
# so long as we also pass kwargs.
def _do_execute(self, func: Callable[..., R], sql: str, *args: Any) -> R:
sql = self._make_sql_one_line(sql)

Expand Down

0 comments on commit 252a71e

Please sign in to comment.