f-strings instead of string.format

This commit is contained in:
Davte 2019-07-12 12:36:49 +02:00
parent ec877aa98a
commit d692744b5b

View File

@ -853,9 +853,7 @@ def get_user(record):
'id' in from_ 'id' in from_
and from_['id'] is not None and from_['id'] is not None
): ):
result = '<a href="tg://user?id={}">{{name}}</a>'.format( result = f"""<a href="tg://user?id={from_['id']}">{{name}}</a>"""
from_['id']
)
if 'username' in from_ and from_['username']: if 'username' in from_ and from_['username']:
result = result.format( result = result.format(
name=from_['username'] name=from_['username']
@ -867,10 +865,7 @@ def get_user(record):
and from_['last_name'] and from_['last_name']
): ):
result = result.format( result = result.format(
name='{} {}'.format( name=f"{from_['first_name']} {from_['last_name']}"
from_['first_name'],
from_['last_name']
)
) )
elif 'first_name' in from_ and from_['first_name']: elif 'first_name' in from_ and from_['first_name']:
result = result.format( result = result.format(