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
| class Singleton: | |
| _instance = None | |
| def __new__(cls): | |
| if cls._instance is None: | |
| print("Создание экземпляра") | |
| cls._instance = super(Singleton, cls).__new__(cls) | |
| return cls._instance |
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
| COUNT_ON_PAGE = 10 | |
| COUNT_ON_LINE = 2 | |
| def get_paged_keyboard(data: list[str], page=1): | |
| pages_count = math.ceil(len(data) / COUNT_ON_PAGE) | |
| page = page % pages_count | |
| cluster = data[(page - 1) * COUNT_ON_PAGE:page * COUNT_ON_PAGE] | |
| builder = InlineKeyboardBuilder() | |
| for i, el in enumerate(cluster): |
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
| RUS_MORSE = {'А': '.-', 'Б': '-...', 'В': '.--', 'Г': '--.', 'Д': '-..', 'Е': '.', 'Ё': '.', 'Ж': '...-', | |
| 'З': '--..', 'И': '..', 'Й': '.---', 'К': '-.-', 'Л': '.-..', 'М': '--', 'Н': '-.', | |
| 'О': '---', | |
| 'П': '.--.', 'Р': '.-.', 'С': '...', 'Т': '-', 'У': '..-', 'Ф': '..-.', 'Х': '....', | |
| 'Ц': '-.-.', | |
| 'Ч': '---.', 'Ш': '----', 'Щ': '--.-', 'Ъ': '--.--', 'Ы': '-.--', 'Ь': '-..-', | |
| 'Э': '..-..', | |
| 'Ю': '..--', 'Я': '.-.-'} |