Skip to content

Fix mypy error: convert ConfigFlow domain from class parameter to attribute#24

Merged
Geek-MD merged 2 commits intomainfrom
copilot/fix-mypy-error-domain-argument
Dec 10, 2025
Merged

Fix mypy error: convert ConfigFlow domain from class parameter to attribute#24
Geek-MD merged 2 commits intomainfrom
copilot/fix-mypy-error-domain-argument

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

Mypy 1.10+ with Python 3.11 rejects domain as a class inheritance parameter in ConfigFlow definitions.

Changes

  • Converted domain from class parameter to class attribute in HADailyCounterConfigFlow

Before:

class HADailyCounterConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
    VERSION = 1

After:

class HADailyCounterConfigFlow(config_entries.ConfigFlow):
    VERSION = 1
    domain = DOMAIN

This follows the standard Home Assistant pattern for ConfigFlow domain declaration and resolves the [call-arg] error from __init_subclass__.

Original prompt

Corrige este error en mypy

Run mypy --config-file mypy.ini
custom_components/ha_daily_counter/config_flow.py:38: error: Unexpected keyword
argument "domain" for "init_subclass" of "object" [call-arg]
class HADailyCounterConfigFlow(config_entries.ConfigFlow, domain=DOMAI...
^
/opt/hostedtoolcache/Python/3.11.14/x64/lib/python3.11/site-packages/mypy/typeshed/stdlib/builtins.pyi:124: note: "init_subclass" of "object" defined here
Found 1 error in 1 file (checked 6 source files)
Error: Process completed with exit code 1.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Geek-MD <25725990+Geek-MD@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix mypy error for unexpected keyword argument 'domain' Fix mypy error: convert ConfigFlow domain from class parameter to attribute Dec 10, 2025
Copilot AI requested a review from Geek-MD December 10, 2025 02:06
@Geek-MD Geek-MD marked this pull request as ready for review December 10, 2025 02:08
@Geek-MD Geek-MD merged commit ea06078 into main Dec 10, 2025
4 checks passed
@Geek-MD Geek-MD deleted the copilot/fix-mypy-error-domain-argument branch December 10, 2025 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants