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

Merge branch 'master' into analyzer-fixes

This commit is contained in:
Ramzan Bekbulatov
2018-09-07 18:07:37 +03:00
committed by GitHub
6 changed files with 40 additions and 820 deletions

View File

@ -249,13 +249,12 @@ def extract_arguments(text):
return result.group(2) if is_command(text) else None
def per_thread(key, construct_value):
try:
return getattr(thread_local, key)
except AttributeError:
def per_thread(key, construct_value, reset=False):
if reset or not hasattr(thread_local, key):
value = construct_value()
setattr(thread_local, key, value)
return value
return getattr(thread_local, key)
def generate_random_token():