mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-16 19:41:07 +03:00
Make generated description on the docs more friendly
This commit is contained in:
parent
3c7dd25982
commit
f39d8f132f
|
@ -199,14 +199,27 @@ def generate_index(folder, original_paths):
|
||||||
def get_description(arg):
|
def get_description(arg):
|
||||||
"""Generates a proper description for the given argument"""
|
"""Generates a proper description for the given argument"""
|
||||||
desc = []
|
desc = []
|
||||||
|
otherwise = False
|
||||||
if arg.can_be_inferred:
|
if arg.can_be_inferred:
|
||||||
desc.append('If left to None, it will be inferred automatically.')
|
desc.append('If left unspecified, it will be inferred automatically.')
|
||||||
if arg.is_vector:
|
otherwise = True
|
||||||
desc.append('A list must be supplied for this argument.')
|
elif arg.is_flag:
|
||||||
if arg.is_generic:
|
|
||||||
desc.append('A different Request must be supplied for this argument.')
|
|
||||||
if arg.is_flag:
|
|
||||||
desc.append('This argument can be omitted.')
|
desc.append('This argument can be omitted.')
|
||||||
|
otherwise = True
|
||||||
|
|
||||||
|
if arg.is_vector:
|
||||||
|
if arg.is_generic:
|
||||||
|
desc.append('A list of other Requests must be supplied.')
|
||||||
|
else:
|
||||||
|
desc.append('A list must be supplied.')
|
||||||
|
elif arg.is_generic:
|
||||||
|
desc.append('A different Request must be supplied for this argument.')
|
||||||
|
else:
|
||||||
|
otherwise = False # Always reset to false if no other text is added
|
||||||
|
|
||||||
|
if otherwise:
|
||||||
|
desc.insert(1, 'Otherwise,')
|
||||||
|
desc[-1] = desc[-1][:1].lower() + desc[-1][1:]
|
||||||
|
|
||||||
return ' '.join(desc)
|
return ' '.join(desc)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user