Misleading docstring

This commit is contained in:
Lonami 2018-02-20 16:45:23 +01:00 committed by GitHub
parent ad74926e33
commit aade36dbd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,8 +34,10 @@ VALID_USERNAME_RE = re.compile(r'^[a-zA-Z][\w\d]{3,30}[a-zA-Z\d]$')
def get_display_name(entity):
"""Gets the input peer for the given "entity" (user, chat or channel)
Returns None if it was not found"""
"""
Gets the display name for the given entity, if it's an ``User``,
``Chat`` or ``Channel``. Returns an empty string otherwise.
"""
if isinstance(entity, User):
if entity.last_name and entity.first_name:
return '{} {}'.format(entity.first_name, entity.last_name)