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

switch to using StrEnum #102

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions custom_components/hdhomerun/pyhdhr/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import asyncio
import logging
import struct
from enum import Enum, unique
from enum import Enum, StrEnum, unique
from typing import Any, Dict, List
from urllib.parse import urlparse

Expand All @@ -31,9 +31,8 @@

_LOGGER = logging.getLogger(__name__)

# TODO: Python 3.11 includes StrEnum by default.
# switch to using that at some point in the future.
class DevicePaths(str, Enum):

class DevicePaths(str, StrEnum):
"""Available paths on the device."""

DISCOVER = "discover.json"
Expand Down Expand Up @@ -290,7 +289,9 @@ async def _async_get_tuner_status_udp(self) -> None:
tag, value = tuple(map(str, detail.split("=")))
try:
value = int(value)
except ValueError: # we're only interested in the items that are numbers
except (
ValueError
): # we're only interested in the items that are numbers
pass
else:
if value != 0: # if the value is 0 don't include it
Expand Down