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
a01e7cd6
Unverified
Commit
a01e7cd6
authored
3 months ago
by
Robert Resch
Committed by
GitHub
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove deprecated number constants (#131810)
parent
3e0326dd
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/number/const.py
+0
-20
0 additions, 20 deletions
homeassistant/components/number/const.py
tests/components/number/test_const.py
+0
-21
0 additions, 21 deletions
tests/components/number/test_const.py
with
0 additions
and
41 deletions
homeassistant/components/number/const.py
+
0
−
20
View file @
a01e7cd6
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
from
__future__
import
annotations
from
__future__
import
annotations
from
enum
import
StrEnum
from
enum
import
StrEnum
from
functools
import
partial
from
typing
import
Final
from
typing
import
Final
import
voluptuous
as
vol
import
voluptuous
as
vol
...
@@ -41,12 +40,6 @@ from homeassistant.const import (
...
@@ -41,12 +40,6 @@ from homeassistant.const import (
UnitOfVolumeFlowRate
,
UnitOfVolumeFlowRate
,
UnitOfVolumetricFlux
,
UnitOfVolumetricFlux
,
)
)
from
homeassistant.helpers.deprecation
import
(
DeprecatedConstantEnum
,
all_with_deprecated_constants
,
check_if_deprecated_constant
,
dir_with_deprecated_constants
,
)
from
homeassistant.util.unit_conversion
import
(
from
homeassistant.util.unit_conversion
import
(
BaseUnitConverter
,
BaseUnitConverter
,
TemperatureConverter
,
TemperatureConverter
,
...
@@ -76,12 +69,6 @@ class NumberMode(StrEnum):
...
@@ -76,12 +69,6 @@ class NumberMode(StrEnum):
SLIDER
=
"
slider
"
SLIDER
=
"
slider
"
# MODE_* are deprecated as of 2021.12, use the NumberMode enum instead.
_DEPRECATED_MODE_AUTO
:
Final
=
DeprecatedConstantEnum
(
NumberMode
.
AUTO
,
"
2025.1
"
)
_DEPRECATED_MODE_BOX
:
Final
=
DeprecatedConstantEnum
(
NumberMode
.
BOX
,
"
2025.1
"
)
_DEPRECATED_MODE_SLIDER
:
Final
=
DeprecatedConstantEnum
(
NumberMode
.
SLIDER
,
"
2025.1
"
)
class
NumberDeviceClass
(
StrEnum
):
class
NumberDeviceClass
(
StrEnum
):
"""
Device class for numbers.
"""
"""
Device class for numbers.
"""
...
@@ -519,10 +506,3 @@ UNIT_CONVERTERS: dict[NumberDeviceClass, type[BaseUnitConverter]] = {
...
@@ -519,10 +506,3 @@ UNIT_CONVERTERS: dict[NumberDeviceClass, type[BaseUnitConverter]] = {
NumberDeviceClass
.
TEMPERATURE
:
TemperatureConverter
,
NumberDeviceClass
.
TEMPERATURE
:
TemperatureConverter
,
NumberDeviceClass
.
VOLUME_FLOW_RATE
:
VolumeFlowRateConverter
,
NumberDeviceClass
.
VOLUME_FLOW_RATE
:
VolumeFlowRateConverter
,
}
}
# These can be removed if no deprecated constant are in this module anymore
__getattr__
=
partial
(
check_if_deprecated_constant
,
module_globals
=
globals
())
__dir__
=
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/number/test_const.py
deleted
100644 → 0
+
0
−
21
View file @
3e0326dd
"""
Test the number const module.
"""
import
pytest
from
homeassistant.components.number
import
const
from
tests.common
import
help_test_all
,
import_and_test_deprecated_constant_enum
def
test_all
()
->
None
:
"""
Test module.__all__ is correctly set.
"""
help_test_all
(
const
)
@pytest.mark.parametrize
((
"
enum
"
),
list
(
const
.
NumberMode
))
def
test_deprecated_constants
(
caplog
:
pytest
.
LogCaptureFixture
,
enum
:
const
.
NumberMode
,
)
->
None
:
"""
Test deprecated constants.
"""
import_and_test_deprecated_constant_enum
(
caplog
,
const
,
enum
,
"
MODE_
"
,
"
2025.1
"
)
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