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

Method de_json

src/telegram/_chatfullinfo.py:628–674  ·  view source on GitHub ↗

See :meth:`telegram.TelegramObject.de_json`.

(cls, data: JSONDict, bot: "Bot | None" = None)

Source from the content-addressed store, hash-verified

626
627 @classmethod
628 def de_json(cls, data: JSONDict, bot: "Bot | None" = None) -> "ChatFullInfo":
629 """See :meth:`telegram.TelegramObject.de_json`."""
630 data = cls._parse_data(data)
631
632 # Get the local timezone from the bot if it has defaults
633 loc_tzinfo = extract_tzinfo_from_defaults(bot)
634
635 data["emoji_status_expiration_date"] = from_timestamp(
636 data.get("emoji_status_expiration_date"), tzinfo=loc_tzinfo
637 )
638
639 data["photo"] = de_json_optional(data.get("photo"), ChatPhoto, bot)
640 data["accepted_gift_types"] = de_json_optional(
641 data.get("accepted_gift_types"), AcceptedGiftTypes, bot
642 )
643
644 from telegram import ( # pylint: disable=import-outside-toplevel # noqa: PLC0415
645 BusinessIntro,
646 BusinessLocation,
647 BusinessOpeningHours,
648 Message,
649 )
650
651 data["pinned_message"] = de_json_optional(data.get("pinned_message"), Message, bot)
652 data["permissions"] = de_json_optional(data.get("permissions"), ChatPermissions, bot)
653 data["location"] = de_json_optional(data.get("location"), ChatLocation, bot)
654 data["available_reactions"] = de_list_optional(
655 data.get("available_reactions"), ReactionType, bot
656 )
657 data["birthdate"] = de_json_optional(data.get("birthdate"), Birthdate, bot)
658 data["personal_chat"] = de_json_optional(data.get("personal_chat"), Chat, bot)
659 data["business_intro"] = de_json_optional(data.get("business_intro"), BusinessIntro, bot)
660 data["business_location"] = de_json_optional(
661 data.get("business_location"), BusinessLocation, bot
662 )
663 data["business_opening_hours"] = de_json_optional(
664 data.get("business_opening_hours"), BusinessOpeningHours, bot
665 )
666 data["parent_chat"] = de_json_optional(data.get("parent_chat"), Chat, bot)
667
668 data["rating"] = de_json_optional(data.get("rating"), UserRating, bot)
669 data["unique_gift_colors"] = de_json_optional(
670 data.get("unique_gift_colors"), UniqueGiftColors, bot
671 )
672 data["first_profile_audio"] = de_json_optional(data.get("first_profile_audio"), Audio, bot)
673
674 return super().de_json(data=data, bot=bot)

Callers

nothing calls this directly

Calls 5

from_timestampFunction · 0.90
de_json_optionalFunction · 0.90
de_list_optionalFunction · 0.90
_parse_dataMethod · 0.80

Tested by

no test coverage detected