Skip to content

Commit ab0353f

Browse files
committed
Fixed Mypy errors
1 parent 3051e93 commit ab0353f

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ repos:
3737
- id: mypy
3838
additional_dependencies:
3939
- pytest
40-
- sqlalchemy
41-
- sqlalchemy2-stubs
40+
- sqlalchemy[mypy]
4241

4342
- repo: https://github.com/pre-commit/pygrep-hooks
4443
rev: v1.9.0

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ max_line_length = 99
7474
python_version = "3.7"
7575
strict = true
7676
ignore_missing_imports = true
77+
plugins = ["sqlalchemy.ext.mypy.plugin"]
7778

7879
[tool.pytest.ini_options]
7980
addopts = "-rsx --tb=short"

src/sqlacodegen/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import argparse
44
import sys
55
from contextlib import ExitStack
6+
from typing import TextIO
67

78
from sqlalchemy.engine import create_engine
89
from sqlalchemy.schema import MetaData
@@ -63,6 +64,7 @@ def main() -> None:
6364

6465
# Open the target file (if given)
6566
with ExitStack() as stack:
67+
outfile: TextIO
6668
if args.outfile:
6769
outfile = open(args.outfile, "w", encoding="utf-8")
6870
stack.enter_context(outfile)

src/sqlacodegen/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ def uses_default_name(constraint: Constraint | Index) -> bool:
7777
values.update(
7878
{
7979
"column_0_name": constraint.columns[0].name, # type: ignore[index]
80-
"column_0_label": constraint.columns[0]
80+
"column_0_label": constraint.columns[0] # type: ignore[index]
8181
.label(constraint.columns[0].name) # type: ignore[index]
82-
.name, # type: ignore[index]
82+
.name,
8383
"column_0_key": constraint.columns[0].key, # type: ignore[index]
8484
}
8585
)

0 commit comments

Comments
 (0)