Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
0c5c0939
Unverified
Commit
0c5c0939
authored
3 months ago
by
Robert Resch
Committed by
GitHub
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove deprecated fan constants (#131845)
parent
57b099c2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
homeassistant/components/fan/__init__.py
+0
-29
0 additions, 29 deletions
homeassistant/components/fan/__init__.py
tests/components/fan/test_init.py
+0
-20
0 additions, 20 deletions
tests/components/fan/test_init.py
with
0 additions
and
49 deletions
homeassistant/components/fan/__init__.py
+
0
−
29
View file @
0c5c0939
...
@@ -23,12 +23,6 @@ from homeassistant.const import (
...
@@ -23,12 +23,6 @@ from homeassistant.const import (
from
homeassistant.core
import
HomeAssistant
,
callback
from
homeassistant.core
import
HomeAssistant
,
callback
from
homeassistant.exceptions
import
ServiceValidationError
from
homeassistant.exceptions
import
ServiceValidationError
from
homeassistant.helpers
import
config_validation
as
cv
from
homeassistant.helpers
import
config_validation
as
cv
from
homeassistant.helpers.deprecation
import
(
DeprecatedConstantEnum
,
all_with_deprecated_constants
,
check_if_deprecated_constant
,
dir_with_deprecated_constants
,
)
from
homeassistant.helpers.entity
import
ToggleEntity
,
ToggleEntityDescription
from
homeassistant.helpers.entity
import
ToggleEntity
,
ToggleEntityDescription
from
homeassistant.helpers.entity_component
import
EntityComponent
from
homeassistant.helpers.entity_component
import
EntityComponent
from
homeassistant.helpers.entity_platform
import
EntityPlatform
from
homeassistant.helpers.entity_platform
import
EntityPlatform
...
@@ -61,21 +55,6 @@ class FanEntityFeature(IntFlag):
...
@@ -61,21 +55,6 @@ class FanEntityFeature(IntFlag):
TURN_ON
=
32
TURN_ON
=
32
# These SUPPORT_* constants are deprecated as of Home Assistant 2022.5.
# Please use the FanEntityFeature enum instead.
_DEPRECATED_SUPPORT_SET_SPEED
=
DeprecatedConstantEnum
(
FanEntityFeature
.
SET_SPEED
,
"
2025.1
"
)
_DEPRECATED_SUPPORT_OSCILLATE
=
DeprecatedConstantEnum
(
FanEntityFeature
.
OSCILLATE
,
"
2025.1
"
)
_DEPRECATED_SUPPORT_DIRECTION
=
DeprecatedConstantEnum
(
FanEntityFeature
.
DIRECTION
,
"
2025.1
"
)
_DEPRECATED_SUPPORT_PRESET_MODE
=
DeprecatedConstantEnum
(
FanEntityFeature
.
PRESET_MODE
,
"
2025.1
"
)
SERVICE_INCREASE_SPEED
=
"
increase_speed
"
SERVICE_INCREASE_SPEED
=
"
increase_speed
"
SERVICE_DECREASE_SPEED
=
"
decrease_speed
"
SERVICE_DECREASE_SPEED
=
"
decrease_speed
"
SERVICE_OSCILLATE
=
"
oscillate
"
SERVICE_OSCILLATE
=
"
oscillate
"
...
@@ -543,11 +522,3 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
...
@@ -543,11 +522,3 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
Requires FanEntityFeature.SET_SPEED.
Requires FanEntityFeature.SET_SPEED.
"""
"""
return
self
.
_attr_preset_modes
return
self
.
_attr_preset_modes
# These can be removed if no deprecated constant are in this module anymore
__getattr__
=
ft
.
partial
(
check_if_deprecated_constant
,
module_globals
=
globals
())
__dir__
=
ft
.
partial
(
dir_with_deprecated_constants
,
module_globals_keys
=
[
*
globals
().
keys
()]
)
__all__
=
all_with_deprecated_constants
(
globals
())
This diff is collapsed.
Click to expand it.
tests/components/fan/test_init.py
+
0
−
20
View file @
0c5c0939
...
@@ -4,7 +4,6 @@ from unittest.mock import patch
...
@@ -4,7 +4,6 @@ from unittest.mock import patch
import
pytest
import
pytest
from
homeassistant.components
import
fan
from
homeassistant.components.fan
import
(
from
homeassistant.components.fan
import
(
ATTR_PRESET_MODE
,
ATTR_PRESET_MODE
,
ATTR_PRESET_MODES
,
ATTR_PRESET_MODES
,
...
@@ -27,8 +26,6 @@ from tests.common import (
...
@@ -27,8 +26,6 @@ from tests.common import (
MockConfigEntry
,
MockConfigEntry
,
MockModule
,
MockModule
,
MockPlatform
,
MockPlatform
,
help_test_all
,
import_and_test_deprecated_constant_enum
,
mock_integration
,
mock_integration
,
mock_platform
,
mock_platform
,
setup_test_component_platform
,
setup_test_component_platform
,
...
@@ -166,23 +163,6 @@ async def test_preset_mode_validation(
...
@@ -166,23 +163,6 @@ async def test_preset_mode_validation(
assert
exc
.
value
.
translation_key
==
"
not_valid_preset_mode
"
assert
exc
.
value
.
translation_key
==
"
not_valid_preset_mode
"
def
test_all
()
->
None
:
"""
Test module.__all__ is correctly set.
"""
help_test_all
(
fan
)
@pytest.mark.parametrize
((
"
enum
"
),
list
(
fan
.
FanEntityFeature
))
def
test_deprecated_constants
(
caplog
:
pytest
.
LogCaptureFixture
,
enum
:
fan
.
FanEntityFeature
,
)
->
None
:
"""
Test deprecated constants.
"""
if
not
FanEntityFeature
.
TURN_OFF
and
not
FanEntityFeature
.
TURN_ON
:
import_and_test_deprecated_constant_enum
(
caplog
,
fan
,
enum
,
"
SUPPORT_
"
,
"
2025.1
"
)
def
test_deprecated_supported_features_ints
(
caplog
:
pytest
.
LogCaptureFixture
)
->
None
:
def
test_deprecated_supported_features_ints
(
caplog
:
pytest
.
LogCaptureFixture
)
->
None
:
"""
Test deprecated supported features ints.
"""
"""
Test deprecated supported features ints.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment