This file contains 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
from math import ceil | |
from random import randint | |
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton | |
from telebot.apihelper import ApiException | |
class InlinePaginator(): | |
def __init__(self, msg, data, items_per_row=5, max_rows=5): | |
self.data = data | |
self.current_page = 1 | |
self.items_per_row = items_per_row |
This file contains 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 cherrypy, requests | |
WEBHOOK_LISTEN = '127.0.0.1' | |
WEBHOOK_PORT = 12345 | |
WEBHOOK_URL_PATH = "/test/" | |
cherrypy.config.update({ | |
'server.socket_host': WEBHOOK_LISTEN, | |
'server.socket_port': WEBHOOK_PORT, | |
'engine.autoreload.on': False |
This file contains 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 StateMachine: | |
states = ["NO STATE"] | |
user_states = {} | |
def __init__(self,states): | |
if states: | |
self.states.extend(states) | |
else: | |
raise ValueError("StateMachine must have at least one state") | |
def next(self,user_id): |
This file contains 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
vk.com##div[data-ad-view] | |
vk.com##div[data-ad] | |
vk.com##div[data-ads] | |
vk.com##.ads_ads_box | |
vk.com##.ads_ads_news_wrap |
This file contains 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 pytest, random | |
# Константные фикстуры | |
@pytest.fixture # фикстура выполняется 1 раз (при каждом обращении - результат фиксирован) | |
def rnd(): | |
return random.random() | |
@pytest.fixture | |
def fixture_a(rnd): # имена аргументов должны совпадать с фикстурами |