This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# circular import: | |
# node.py | |
from typing import Iterable | |
from nodeset import NodeSet | |
from typing import Iterable | |
from abstract_node import AbstractNode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contextlib | |
import json | |
from django.db import connection | |
from django import template | |
register = template.Library() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def api_dict_with_extensions(message: FBMessage) -> dict: | |
""" | |
Хелпер, который генерирует api_dict и в зависимости от урлов, | |
подложенных в кнопки, добавляет им messenger_extensions перед отправкой. | |
Это живет здесь, а не в state_objects, | |
потому что state_objects ничего не знают о настройках джанго | |
и о списке безопасных доменов. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_buttons( | |
api_dict: dict, | |
message: Union[FBThreeButtonMessage, FBCarouselMessage] | |
) -> Iterable[dict]: | |
""" | |
Достать кнопки из api_dict. | |
Путь для доставания определяется типом сообщения. | |
Кнопки бывают только у двух типов сообщения, для остальных типов ничего не делаем | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from random import randint | |
from time import sleep | |
number = randint(0, 3) | |
print('Бросаю монетку...') | |
sleep(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12321313 |