1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

send_poll revised to standart signature

This commit is contained in:
Badiboy
2020-05-02 13:09:52 +03:00
parent ef81868ebc
commit 6e1cf24946
4 changed files with 75 additions and 26 deletions

View File

@ -5,6 +5,8 @@ import string
import sys
import threading
import traceback
import warnings
import functools
import six
from six import string_types
@ -258,4 +260,20 @@ def per_thread(key, construct_value, reset=False):
def generate_random_token():
return ''.join(random.sample(string.ascii_letters, 16))
return ''.join(random.sample(string.ascii_letters, 16))
def deprecated(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used."""
# https://stackoverflow.com/a/30253848/441814
@functools.wraps(func)
def new_func(*args, **kwargs):
warnings.simplefilter('always', DeprecationWarning) # turn off filter
warnings.warn("Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning,
stacklevel=2)
warnings.simplefilter('default', DeprecationWarning) # reset filter
return func(*args, **kwargs)
return new_func