Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Legend: `[ ]` open · `[x]` resolved · `[~]` won't fix / by design.

## P5 — Typing

- [ ] **T1 · Bare `list`/`tuple` generics in public signatures.**
- [x] **T1 · Bare `list`/`tuple` generics in public signatures.**
`Dialect.format_params(params: list)`, `Engine._insert_rows(rows: list[tuple])`,
`Engine.create(rows: list[tuple] | None)`. A `py.typed` package leaks these.
*Fix:* parameterize (`list[Any]`, `list[tuple[Any, ...]]`).
Expand Down
6 changes: 3 additions & 3 deletions coddpiece/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def quote_identifier(self, name: str) -> str:
escaped = name.replace(q, q + q)
return f"{q}{escaped}{q}"

def format_params(self, params: list) -> Any:
def format_params(self, params: list[Any]) -> Any:
"""Format params for the connection's paramstyle."""
# named/pyformat styles require a dict keyed by placeholder name (p0, p1, ...),
# matching the keys generated by placeholder(). All other styles use a list.
Expand Down Expand Up @@ -179,7 +179,7 @@ def create(
self,
name: str,
attrs: dict[str, type],
rows: list[tuple] | None = None,
rows: list[tuple[Any, ...]] | None = None,
) -> Relation:
"""Create a new table, optionally populating it with data.

Expand Down Expand Up @@ -363,7 +363,7 @@ def _create_table(self, name: str, schema: Schema) -> None:
cursor.execute(f"CREATE TABLE {table} ({col_defs})")
self.connection.commit()

def _insert_rows(self, name: str, schema: Schema, rows: list[tuple]) -> None:
def _insert_rows(self, name: str, schema: Schema, rows: list[tuple[Any, ...]]) -> None:
"""Insert rows into a table."""
# Row values are always parameterized (upholding the no-literal
# invariant). Rows are executed one at a time rather than via
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@ warn_redundant_casts = true
warn_unreachable = true
no_implicit_optional = true
check_untyped_defs = true
# A py.typed package should not leak bare `list`/`dict`/`tuple` (implicit
# Any element types) to consumers. The whole package is clean under this,
# so enforce it in CI to stop the generics from silently regressing.
disallow_any_generics = true
Loading