swh_set_db_module() takes a db_or_conninfo object, and passes it to execute_sqlfiles,
which only expects a conninfo.
This is detected by mypy when using a recent version of types-psycopg2.
@bchauvet This takes care of the other issue you had
Differential D7282
db_utils: Fix typing of db/conninfo objects vlorentz on Mar 3 2022, 1:43 PM. Authored by
Details
swh_set_db_module() takes a db_or_conninfo object, and passes it to execute_sqlfiles, This is detected by mypy when using a recent version of types-psycopg2. @bchauvet This takes care of the other issue you had
Diff Detail
Event TimelineComment Actions Build is green Patch application report for D7282 (id=26367)Could not rebase; Attempt merge onto 20da92e353... Updating 20da92e..d23e03c Fast-forward mypy.ini | 3 --- requirements-test.txt | 1 + swh/core/db/db_utils.py | 10 +++++++++- 3 files changed, 10 insertions(+), 4 deletions(-) Changes applied before testcommit d23e03ca4c3d911e6d63d529c9a9e11ed6369443 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 3 13:41:58 2022 +0100 db_utils: Fix typing of db/conninfo objects swh_set_db_module() takes a db_or_conninfo object, and passes it to execute_sqlfiles, which only expects a conninfo. This is detected by mypy when using a recent version of types-psycopg2. commit d58973501d0e9e8f7517db435c937fcd9408cfab Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 3 13:35:37 2022 +0100 db_utils: Add missing import of psycopg2.errors This may be needed depending on import order; but it makes mypy complain when types-psycopg2 is installed. See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/369/ for more details. Comment Actions Build is green Patch application report for D7282 (id=26368)Could not rebase; Attempt merge onto 20da92e353... Updating 20da92e..83fb36b Fast-forward mypy.ini | 3 --- requirements-test.txt | 1 + swh/core/db/db_utils.py | 14 +++++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) Changes applied before testcommit 83fb36b83fc5cb0a2dddb3eb312824f5beb3a754 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 3 13:41:58 2022 +0100 db_utils: Fix typing of db/conninfo objects swh_set_db_module() takes a db_or_conninfo object, and passes it to execute_sqlfiles, which only expects a conninfo. This is detected by mypy when using a recent version of types-psycopg2. commit d58973501d0e9e8f7517db435c937fcd9408cfab Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu Mar 3 13:35:37 2022 +0100 db_utils: Add missing import of psycopg2.errors This may be needed depending on import order; but it makes mypy complain when types-psycopg2 is installed. See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/370/ for more details. |