← Back to issue list

fix: silence ty invalid-assignment for the Debian templater pattern

View original Github issue

Metadata

Project
debcraft
Number
#202
Type
pull request
State
merged
Author
lengau
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #202 that silences a `ty` type checker warning on `_DebianTemplater.pattern` by adding `# ty: ignore[invalid-assignment]`, addressing a typeshed/Python 3.12 inconsistency.

Resolution: closed resolved

Reason: PR #202 was merged, adding a targeted `# ty: ignore[invalid-assignment]` to silence the type checker warning caused by a typeshed/Python 3.12 inconsistency with `string.Template.pattern`.

Evaluated by: mr-cal-bot

No scores available.

Issue body

🤖 [BEEP BOOP, A BOT WROTE THIS PR - Mistral Large 4, opencode] Pre-existing latent issue, split into a preparation PR per the Starbase merge policy (unrelated/pre-existing fix; it also blocks the lint job for any branch until fixed). ty 0.0.85 (released 2026-10-06, after debcraft's last green lint run on 2026-10-05) flags `debcraft/helpers/helpers.py:231`: the `_DebianTemplater.pattern` class attribute is assigned a raw f-string, but typeshed declares `string.Template.pattern` as `re.Pattern[str]`. The str assignment is intentional: `string.Template.__init_subclass__` compiles the subclass-provided pattern itself (with `re.IGNORECASE | re.VERBOSE`), so the attribute is a str at definition time and a compiled pattern afterwards. Pre-compiling explicitly is not an option: Python 3.12's `__init_subclass__` unconditionally calls `re.compile(pattern, cls.flags | re.VERBOSE)`, which raises `ValueError: cannot process flags argument with a compiled pattern` for a pre-compiled pattern. Fix: a targeted `# ty: ignore[invalid-assignment]` on the assignment. No runtime change (verified: ty, ruff, and the full fast test suite pass; the templater tests exercise `safe_substitute`, which requires the base-class-compiled pattern).

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b — closed resolved Merged PR #202 that silences a `ty` type checker warning on `_DebianTemplater.pattern` by adding `# ty: ignore[invalid-assignment]`, addressing a typeshed/Python 3.12 inconsistency.
~deepseek/deepseek-pro-latest
Impact: 30
Quick Win: 19
Complexity: 5
Confidence: 75
Actionability: 65
needs review Adds a targeted ty ignore for the _DebianTemplater.pattern str assignment; no runtime change. Approved by 1 reviewer, but OSV-scanner and minimum-deps CI checks are failing.
~deepseek/deepseek-pro-latest
Impact: 30
Quick Win: 24
Complexity: 5
Confidence: 92
Actionability: 85
needs review Adds a targeted `# ty: ignore[invalid-assignment]` on the Debian templater's raw f-string pattern assignment to unblock the lint job. Approved, CI green except unrelated OSV-scanner.
~deepseek/deepseek-pro-latest
Impact: 25
Quick Win: 17
Complexity: 5
Confidence: 85
Actionability: 70
needs review Adds a targeted `# ty: ignore[invalid-assignment]` on `_DebianTemplater.pattern` to silence ty 0.0.85; no runtime change. CI mostly green except OSV-scanner.

Update history

Date Change
merged
updated
updated
updated
updated
created

Related issues

No related issues found above the similarity threshold.