Skip to content

Commit

Permalink
Chore: Add and validate type hinting using mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Aug 28, 2024
1 parent 99ee4cc commit cec506e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ lint = [
{ cmd = "ruff format --check" },
{ cmd = "ruff check" },
{ cmd = "validate-pyproject pyproject.toml" },
# { cmd = "mypy" },
{ cmd = "mypy" },
]

release = [
Expand Down
9 changes: 5 additions & 4 deletions src/sqlalchemy_cratedb/compat/api13.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"""

import collections.abc as collections_abc
import typing as t

from sqlalchemy import exc
from sqlalchemy.sql import Select
Expand All @@ -42,7 +43,7 @@

# `_distill_params_20` copied from SA14's `sqlalchemy.engine.{base,util}`.
_no_tuple = ()
_no_kw = immutabledict()
_no_kw: immutabledict = immutabledict()


def _distill_params_20(params):
Expand Down Expand Up @@ -87,11 +88,11 @@ def monkeypatch_add_exec_driver_sql():
from sqlalchemy.engine.base import Connection, Engine

# Add `exec_driver_sql` method to SA's `Connection` and `Engine` classes.
Connection.exec_driver_sql = exec_driver_sql
Engine.exec_driver_sql = exec_driver_sql
Connection.exec_driver_sql = exec_driver_sql # type: ignore[method-assign]
Engine.exec_driver_sql = exec_driver_sql # type: ignore[attr-defined]


def select_sa14(*columns, **kw) -> Select:
def select_sa14(*columns, **kw) -> Select[t.Any]:
"""
Adapt SA14/SA20's calling semantics of `sql.select()` to SA13.
Expand Down

0 comments on commit cec506e

Please sign in to comment.