MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / BusinessOpeningHours

Class BusinessOpeningHours

src/telegram/_business.py:541–691  ·  view source on GitHub ↗

This object describes the opening hours of a business. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`time_zone_name` and :attr:`opening_hours` are equal. .. versionadded:: 21.1 Args: time

Source from the content-addressed store, hash-verified

539
540
541class BusinessOpeningHours(TelegramObject):
542 """
543 This object describes the opening hours of a business.
544
545 Objects of this class are comparable in terms of equality.
546 Two objects of this class are considered equal, if their
547 :attr:`time_zone_name` and :attr:`opening_hours` are equal.
548
549 .. versionadded:: 21.1
550
551 Args:
552 time_zone_name (:obj:`str`): Unique name of the time zone for which the opening
553 hours are defined.
554 opening_hours (Sequence[:class:`telegram.BusinessOpeningHoursInterval`]): List of
555 time intervals describing business opening hours.
556
557 Attributes:
558 time_zone_name (:obj:`str`): Unique name of the time zone for which the opening
559 hours are defined.
560 opening_hours (Sequence[:class:`telegram.BusinessOpeningHoursInterval`]): List of
561 time intervals describing business opening hours.
562 """
563
564 __slots__ = ("_cached_zone_info", "opening_hours", "time_zone_name")
565
566 def __init__(
567 self,
568 time_zone_name: str,
569 opening_hours: Sequence[BusinessOpeningHoursInterval],
570 *,
571 api_kwargs: JSONDict | None = None,
572 ):
573 super().__init__(api_kwargs=api_kwargs)
574 self.time_zone_name: str = time_zone_name
575 self.opening_hours: Sequence[BusinessOpeningHoursInterval] = parse_sequence_arg(
576 opening_hours
577 )
578
579 self._cached_zone_info: ZoneInfo | None = None
580
581 self._id_attrs = (self.time_zone_name, self.opening_hours)
582
583 self._freeze()
584
585 @property
586 def _zone_info(self) -> ZoneInfo:
587 if self._cached_zone_info is None:
588 self._cached_zone_info = get_zone_info(self.time_zone_name)
589 return self._cached_zone_info
590
591 def get_opening_hours_for_day(
592 self, date: dtm.date, time_zone: dtm.tzinfo | str | None = None
593 ) -> tuple[tuple[dtm.datetime, dtm.datetime], ...]:
594 """Returns the opening hours intervals for a specific day as datetime objects.
595
596 .. versionadded:: 22.5
597
598 Args:

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…