Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use IntFlag for EntityFeature #81903

Merged
merged 8 commits into from Nov 16, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/alarm_control_panel/const.py
@@ -1,5 +1,5 @@
"""Provides the constants needed for component."""
from enum import IntEnum
from enum import IntFlag
from typing import Final

from homeassistant.backports.enum import StrEnum
Expand All @@ -23,7 +23,7 @@ class CodeFormat(StrEnum):
FORMAT_NUMBER: Final = "number"


class AlarmControlPanelEntityFeature(IntEnum):
class AlarmControlPanelEntityFeature(IntFlag):
"""Supported features of the alarm control panel entity."""

ARM_HOME = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/camera/__init__.py
Expand Up @@ -7,7 +7,7 @@
from contextlib import suppress
from dataclasses import dataclass
from datetime import datetime, timedelta
from enum import IntEnum
from enum import IntFlag
from functools import partial
import logging
import os
Expand Down Expand Up @@ -95,7 +95,7 @@
STATE_IDLE: Final = "idle"


class CameraEntityFeature(IntEnum):
class CameraEntityFeature(IntFlag):
"""Supported features of the camera entity."""

ON_OFF = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/climate/const.py
@@ -1,6 +1,6 @@
"""Provides the constants needed for component."""

from enum import IntEnum
from enum import IntFlag

from homeassistant.backports.enum import StrEnum

Expand Down Expand Up @@ -146,7 +146,7 @@ class HVACAction(StrEnum):
SERVICE_SET_TEMPERATURE = "set_temperature"


class ClimateEntityFeature(IntEnum):
class ClimateEntityFeature(IntFlag):
"""Supported features of the climate entity."""

TARGET_TEMPERATURE = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/cover/__init__.py
Expand Up @@ -4,7 +4,7 @@
from collections.abc import Callable
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
from typing import Any, TypeVar, final
Expand Down Expand Up @@ -86,7 +86,7 @@ class CoverDeviceClass(StrEnum):
# mypy: disallow-any-generics


class CoverEntityFeature(IntEnum):
class CoverEntityFeature(IntFlag):
"""Supported features of the cover entity."""

OPEN = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/fan/__init__.py
Expand Up @@ -3,7 +3,7 @@

from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
import math
Expand Down Expand Up @@ -41,7 +41,7 @@
ENTITY_ID_FORMAT = DOMAIN + ".{}"


class FanEntityFeature(IntEnum):
class FanEntityFeature(IntFlag):
"""Supported features of the fan entity."""

SET_SPEED = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/humidifier/const.py
@@ -1,5 +1,5 @@
"""Provides the constants needed for component."""
from enum import IntEnum
from enum import IntFlag

MODE_NORMAL = "normal"
MODE_ECO = "eco"
Expand Down Expand Up @@ -30,7 +30,7 @@
SERVICE_SET_HUMIDITY = "set_humidity"


class HumidifierEntityFeature(IntEnum):
class HumidifierEntityFeature(IntFlag):
"""Supported features of the alarm control panel entity."""

MODES = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/light/__init__.py
Expand Up @@ -5,7 +5,7 @@
import csv
import dataclasses
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import logging
import os
from typing import Any, cast, final
Expand Down Expand Up @@ -41,7 +41,7 @@
ENTITY_ID_FORMAT = DOMAIN + ".{}"


class LightEntityFeature(IntEnum):
class LightEntityFeature(IntFlag):
"""Supported features of the light entity."""

EFFECT = 4
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/lock/__init__.py
Expand Up @@ -3,7 +3,7 @@

from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
from typing import Any, final
Expand Down Expand Up @@ -48,7 +48,7 @@
LOCK_SERVICE_SCHEMA = make_entity_service_schema({vol.Optional(ATTR_CODE): cv.string})


class LockEntityFeature(IntEnum):
class LockEntityFeature(IntFlag):
"""Supported features of the lock entity."""

OPEN = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/media_player/const.py
@@ -1,5 +1,5 @@
"""Provides the constants needed for component."""
from enum import IntEnum
from enum import IntFlag

from homeassistant.backports.enum import StrEnum

Expand Down Expand Up @@ -176,7 +176,7 @@ class RepeatMode(StrEnum):
REPEAT_MODES = [REPEAT_MODE_OFF, REPEAT_MODE_ALL, REPEAT_MODE_ONE]


class MediaPlayerEntityFeature(IntEnum):
class MediaPlayerEntityFeature(IntFlag):
"""Supported features of the media player entity."""

PAUSE = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/remote/__init__.py
Expand Up @@ -4,7 +4,7 @@
from collections.abc import Iterable
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
from typing import Any, final
Expand Down Expand Up @@ -61,7 +61,7 @@
DEFAULT_HOLD_SECS = 0


class RemoteEntityFeature(IntEnum):
class RemoteEntityFeature(IntFlag):
"""Supported features of the remote entity."""

LEARN_COMMAND = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/siren/const.py
@@ -1,6 +1,6 @@
"""Constants for the siren component."""

from enum import IntEnum
from enum import IntFlag
from typing import Final

DOMAIN: Final = "siren"
Expand All @@ -12,7 +12,7 @@
ATTR_VOLUME_LEVEL: Final = "volume_level"


class SirenEntityFeature(IntEnum):
class SirenEntityFeature(IntFlag):
"""Supported features of the siren entity."""

TURN_ON = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/update/const.py
@@ -1,13 +1,13 @@
"""Constants for the update component."""
from __future__ import annotations

from enum import IntEnum
from enum import IntFlag
from typing import Final

DOMAIN: Final = "update"


class UpdateEntityFeature(IntEnum):
class UpdateEntityFeature(IntFlag):
"""Supported features of the update entity."""

INSTALL = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/vacuum/__init__.py
Expand Up @@ -4,7 +4,7 @@
from collections.abc import Mapping
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
from functools import partial
import logging
from typing import Any, final
Expand Down Expand Up @@ -74,7 +74,7 @@
DEFAULT_NAME = "Vacuum cleaner robot"


class VacuumEntityFeature(IntEnum):
class VacuumEntityFeature(IntFlag):
"""Supported features of the vacuum entity."""

TURN_ON = 1
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/water_heater/__init__.py
Expand Up @@ -4,7 +4,7 @@
from collections.abc import Mapping
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
from typing import Any, final
Expand Down Expand Up @@ -56,7 +56,7 @@
STATE_GAS = "gas"


class WaterHeaterEntityFeature(IntEnum):
class WaterHeaterEntityFeature(IntFlag):
"""Supported features of the fan entity."""

TARGET_TEMPERATURE = 1
Expand Down