@@ -67,8 +67,8 @@ def get_docstring_arg_type(t: str, is_list: bool = False, is_pyrogram_type: bool
6767 n = len (t ) - 1
6868
6969 t = (("e" if is_list else "E" ) + "ither " if n else "" ) + ", " .join (
70- ":obj:`{1} <pyrogram.api.types. {0}{1}>`" .format (
71- "pyrogram." if is_pyrogram_type else "" ,
70+ ":obj:`{1} <{0}. {1}>`" .format (
71+ "pyrogram.types " if is_pyrogram_type else "pyrogram.api.types " ,
7272 i .replace ("pyrogram." , "" )
7373 )
7474 for i in t
@@ -274,32 +274,31 @@ def start():
274274 ) if c .args else "pass"
275275
276276 docstring_args = []
277- # docs = c.docs.split("|")[1:] if c.docs else None
277+ docs = c .docs .split ("|" )[1 :] if c .docs else None
278278
279279 for i , arg in enumerate (sorted_args ):
280280 arg_name , arg_type = arg
281281 is_optional = FLAGS_RE .match (arg_type )
282282 flag_number = is_optional .group (1 ) if is_optional else - 1
283283 arg_type = arg_type .split ("?" )[- 1 ]
284284
285- # if c.namespace == "pyrogram" :
286- # docstring_args.append(
287- # "{} ({}{}):\n {}\n".format(
288- # arg_name,
289- # get_docstring_arg_type(arg_type, is_pyrogram_type=True),
290- # ", optional" if "Optional" in docs[i] else "",
291- # re.sub("Optional\. ", "", docs[i].split("§")[1].rstrip(".") + ".")
292- # )
293- # )
294- # else:
295-
296- docstring_args . append (
297- "{}{}: {}" . format (
298- arg_name ,
299- " (optional)" . format ( flag_number ) if is_optional else "" ,
300- get_docstring_arg_type ( arg_type , is_pyrogram_type = c . namespace == "pyrogram" )
285+ if docs :
286+ docstring_args .append (
287+ "{} ({}{}):\n {}\n " .format (
288+ arg_name ,
289+ get_docstring_arg_type (arg_type , is_pyrogram_type = True ),
290+ ", optional" if "Optional" in docs [i ] else "" ,
291+ re .sub ("Optional\. " , "" , docs [i ].split ("§" )[1 ].rstrip ("." ) + "." )
292+ )
293+ )
294+ else :
295+ docstring_args . append (
296+ "{}{}: {}" . format (
297+ arg_name ,
298+ " (optional)" . format ( flag_number ) if is_optional else "" ,
299+ get_docstring_arg_type ( arg_type , is_pyrogram_type = c . namespace == "pyrogram" )
300+ )
301301 )
302- )
303302
304303 if docstring_args :
305304 docstring_args = "Args:\n " + "\n " .join (docstring_args )
@@ -442,17 +441,36 @@ def start():
442441
443442 for c in combinators :
444443 path = "." .join (filter (None , [c .section , c .namespace , capit (c .name )]))
445- f .write ("\n {}: \" {}\" ," .format (c .id , path ))
446-
447- f .write ("\n 0xbc799737: \" core.BoolFalse\" ," )
448- f .write ("\n 0x997275b5: \" core.BoolTrue\" ," )
449- f .write ("\n 0x56730bcc: \" core.Null\" ," )
450- f .write ("\n 0x1cb5c415: \" core.Vector\" ," )
451- f .write ("\n 0x73f1f8dc: \" core.MsgContainer\" ," )
452- f .write ("\n 0xae500895: \" core.FutureSalts\" ," )
453- f .write ("\n 0x0949d9dc: \" core.FutureSalt\" ," )
454- f .write ("\n 0x3072cfa1: \" core.GzipPacked\" ," )
455- f .write ("\n 0x5bb8e511: \" core.Message\" " )
444+ f .write ("\n {}: \" pyrogram.api.{}\" ," .format (c .id , path ))
445+
446+ f .write ("\n 0xbc799737: \" pyrogram.api.core.BoolFalse\" ," )
447+ f .write ("\n 0x997275b5: \" pyrogram.api.core.BoolTrue\" ," )
448+ f .write ("\n 0x56730bcc: \" pyrogram.api.core.Null\" ," )
449+ f .write ("\n 0x1cb5c415: \" pyrogram.api.core.Vector\" ," )
450+ f .write ("\n 0x73f1f8dc: \" pyrogram.api.core.MsgContainer\" ," )
451+ f .write ("\n 0xae500895: \" pyrogram.api.core.FutureSalts\" ," )
452+ f .write ("\n 0x0949d9dc: \" pyrogram.api.core.FutureSalt\" ," )
453+ f .write ("\n 0x3072cfa1: \" pyrogram.api.core.GzipPacked\" ," )
454+ f .write ("\n 0x5bb8e511: \" pyrogram.api.core.Message\" ," )
455+
456+ f .write ("\n 0xb0700000: \" pyrogram.client.types.Update\" ," )
457+ f .write ("\n 0xb0700001: \" pyrogram.client.types.User\" ," )
458+ f .write ("\n 0xb0700002: \" pyrogram.client.types.Chat\" ," )
459+ f .write ("\n 0xb0700003: \" pyrogram.client.types.Message\" ," )
460+ f .write ("\n 0xb0700004: \" pyrogram.client.types.MessageEntity\" ," )
461+ f .write ("\n 0xb0700005: \" pyrogram.client.types.PhotoSize\" ," )
462+ f .write ("\n 0xb0700006: \" pyrogram.client.types.Audio\" ," )
463+ f .write ("\n 0xb0700007: \" pyrogram.client.types.Document\" ," )
464+ f .write ("\n 0xb0700008: \" pyrogram.client.types.Video\" ," )
465+ f .write ("\n 0xb0700009: \" pyrogram.client.types.Voice\" ," )
466+ f .write ("\n 0xb0700010: \" pyrogram.client.types.VideoNote\" ," )
467+ f .write ("\n 0xb0700011: \" pyrogram.client.types.Contact\" ," )
468+ f .write ("\n 0xb0700012: \" pyrogram.client.types.Location\" ," )
469+ f .write ("\n 0xb0700013: \" pyrogram.client.types.Venue\" ," )
470+ f .write ("\n 0xb0700014: \" pyrogram.client.types.UserProfilePhotos\" ," )
471+ f .write ("\n 0xb0700015: \" pyrogram.client.types.ChatPhoto\" ," )
472+ f .write ("\n 0xb0700016: \" pyrogram.client.types.ChatMember\" ," )
473+ f .write ("\n 0xb0700017: \" pyrogram.client.types.Sticker\" " )
456474
457475 f .write ("\n }\n " )
458476
0 commit comments