1
mirror of https://github.com/home-assistant/core synced 2024-08-28 03:36:46 +02:00

Adjust Calendar doc strings and comments (#101655)

This commit is contained in:
Robert Hillis 2023-10-08 10:16:59 -04:00 committed by GitHub
parent 7c85d84133
commit 5087f0056c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -813,7 +813,7 @@ def _validate_timespan(
This converts the input service arguments into a `start` and `end` date or date time. This
exists because service calls use `start_date` and `start_date_time` whereas the
normal entity methods can take either a `datetim` or `date` as a single `start` argument.
normal entity methods can take either a `datetime` or `date` as a single `start` argument.
It also handles the other service call variations like "in days" as well.
"""
@ -849,7 +849,7 @@ async def async_create_event(entity: CalendarEntity, call: ServiceCall) -> None:
async def async_list_events_service(
calendar: CalendarEntity, service_call: ServiceCall
) -> ServiceResponse:
"""List events on a calendar during a time drange."""
"""List events on a calendar during a time range."""
start = service_call.data.get(EVENT_START_DATETIME, dt_util.now())
if EVENT_DURATION in service_call.data:
end = start + service_call.data[EVENT_DURATION]

View File

@ -75,15 +75,15 @@ class Timespan:
This effectively gives us a cursor like interface for advancing through
time using the interval as a hint. The returned span may have a
different interval than the one specified. For example, time span may
different interval than the one specified. For example, time span may
be longer during a daylight saving time transition, or may extend due to
drift if the current interval is old. The returned time span is
drift if the current interval is old. The returned time span is
adjacent and non-overlapping.
"""
return Timespan(self.end, max(self.end, now) + interval)
def __str__(self) -> str:
"""Return a string representing the half open interval timespan."""
"""Return a string representing the half open interval time span."""
return f"[{self.start}, {self.end})"
@ -118,7 +118,7 @@ def queued_event_fetcher(
offset_timespan = timespan.with_offset(-1 * offset)
active_events = await fetcher(offset_timespan)
# Determine the trigger eligibilty of events during this time span.
# Determine the trigger eligibility of events during this time span.
# Example: For an EVENT_END trigger the event may start during this
# time span, but need to be triggered later when the end happens.
results = []
@ -130,7 +130,7 @@ def queued_event_fetcher(
results.append(QueuedCalendarEvent(trigger_time + offset, event))
_LOGGER.debug(
"Scan events @ %s%s found %s eligble of %s active",
"Scan events @ %s%s found %s eligible of %s active",
offset_timespan,
f" (offset={offset})" if offset else "",
len(results),