Skip to content

Commit

Permalink
Convert strings to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed May 29, 2023
1 parent 6606a7a commit 3d77e08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 7 additions & 4 deletions custom_components/o365/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
from requests.exceptions import HTTPError, RetryError

from .const import (
ATTR_ALL_DAY,
ATTR_DATA,
ATTR_EVENT_ID,
ATTR_OFFSET,
CALENDAR_ENTITY_ID_FORMAT,
CONF_ACCOUNT,
CONF_ACCOUNT_NAME,
Expand Down Expand Up @@ -254,15 +257,15 @@ def extra_state_attributes(self):
"""Extra state attributes."""
if self._event:
return {
"all_day": self._event.all_day
ATTR_ALL_DAY: self._event.all_day
if self.data.event is not None
else False,
"offset_reached": self._offset_reached,
"data": self._data_attribute,
ATTR_OFFSET: self._offset_reached,
ATTR_DATA: self._data_attribute,
}

return {
"data": self._data_attribute,
ATTR_DATA: self._data_attribute,
}

@property
Expand Down
6 changes: 6 additions & 0 deletions custom_components/o365/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class EventResponse(Enum):
Decline = "decline" # pylint: disable=invalid-name


ATTR_ALL_DAY = "all_day"
ATTR_ALL_TASKS = "all_tasks"
ATTR_ATTACHMENTS = "attachments"
ATTR_ATTRIBUTES = "attributes"
Expand All @@ -18,9 +19,11 @@ class EventResponse(Enum):
ATTR_BODY = "body"
ATTR_CATEGORIES = "categories"
ATTR_CHAT_ID = "chat_id"
ATTR_CHAT_TYPE = "chat_type"
ATTR_COMPLETED = "completed"
ATTR_CREATED = "created"
ATTR_CONTENT = "content"
ATTR_DATA = "data"
ATTR_DESCRIPTION = "description"
ATTR_DUE = "due"
ATTR_EMAIL = "email"
Expand All @@ -34,7 +37,9 @@ class EventResponse(Enum):
ATTR_IMPORTANCE = "importance"
ATTR_INTERNALREPLY = "internal_reply"
ATTR_LOCATION = "location"
ATTR_MEMBERS = "members"
ATTR_MESSAGE_IS_HTML = "message_is_html"
ATTR_OFFSET = "offset_reached"
ATTR_OVERDUE_TASKS = "overdue_tasks"
ATTR_PHOTOS = "photos"
ATTR_REMINDER = "reminder"
Expand All @@ -49,6 +54,7 @@ class EventResponse(Enum):
ATTR_SUMMARY = "summary"
ATTR_TASKS = "tasks"
ATTR_TASK_ID = "task_id"
ATTR_TOPIC = "topic"
ATTR_TYPE = "type"
ATTR_ZIP_ATTACHMENTS = "zip_attachments"
ATTR_ZIP_NAME = "zip_name"
Expand Down

0 comments on commit 3d77e08

Please sign in to comment.