27
27
# from black import format_str, FileMode
28
28
29
29
HOME_PATH = Path ("compiler/api" )
30
- DESTINATION_PATH = Path ("pyrogram /raw" )
30
+ DESTINATION_PATH = Path ("pyrogramv1 /raw" )
31
31
NOTICE_PATH = "NOTICE"
32
32
33
33
SECTION_RE = re .compile (r"---(\w+)---" )
@@ -149,7 +149,7 @@ def remove_whitespaces(source: str) -> str:
149
149
return "\n " .join (lines )
150
150
151
151
152
- def get_docstring_arg_type (t : str , is_list : bool = False , is_pyrogram_type : bool = False ):
152
+ def get_docstring_arg_type (t : str , is_list : bool = False , is_pyrogramv1_type : bool = False ):
153
153
if t in CORE_TYPES :
154
154
if t == "long" :
155
155
return "``int`` ``64-bit``"
@@ -165,13 +165,13 @@ def get_docstring_arg_type(t: str, is_list: bool = False, is_pyrogram_type: bool
165
165
else :
166
166
return f"``{ t .lower ()} ``"
167
167
elif t == "TLObject" or t == "X" :
168
- return "Any object from :obj:`~pyrogram .raw.types`"
168
+ return "Any object from :obj:`~pyrogramv1 .raw.types`"
169
169
elif t == "!X" :
170
- return "Any method from :obj:`~pyrogram .raw.functions`"
170
+ return "Any method from :obj:`~pyrogramv1 .raw.functions`"
171
171
elif t .lower ().startswith ("vector" ):
172
172
return "List of " + get_docstring_arg_type (t .split ("<" , 1 )[1 ][:- 1 ], True )
173
173
else :
174
- return f":obj:`{ t } <pyrogram .raw.base.{ t } >`"
174
+ return f":obj:`{ t } <pyrogramv1 .raw.base.{ t } >`"
175
175
176
176
177
177
def get_references (t : str , kind : str ):
@@ -184,7 +184,7 @@ def get_references(t: str, kind: str):
184
184
185
185
if t :
186
186
return "\n " .join (
187
- f"- :obj:`{ i } <pyrogram .raw.functions.{ i } >`"
187
+ f"- :obj:`{ i } <pyrogramv1 .raw.functions.{ i } >`"
188
188
for i in t
189
189
), len (t )
190
190
@@ -315,7 +315,7 @@ def start(format: bool = False):
315
315
316
316
constructors = sorted (types_to_constructors [qualtype ])
317
317
constr_count = len (constructors )
318
- items = "\n " .join ([f"- :obj:`{ c } <pyrogram .raw.types.{ c } >`" for c in constructors ])
318
+ items = "\n " .join ([f"- :obj:`{ c } <pyrogramv1 .raw.types.{ c } >`" for c in constructors ])
319
319
320
320
docstring = f"This base type has { constr_count } constructor{ 's' if constr_count > 1 else '' } available.\n \n "
321
321
docstring += f" Constructors:\n .. hlist::\n :columns: 2\n \n { items } "
@@ -369,12 +369,12 @@ def start(format: bool = False):
369
369
"{}{}: {}" .format (
370
370
arg_name ,
371
371
" (optional)" .format (flag_number ) if is_optional else "" ,
372
- get_docstring_arg_type (arg_type , is_pyrogram_type = c .namespace == "pyrogram " )
372
+ get_docstring_arg_type (arg_type , is_pyrogramv1_type = c .namespace == "pyrogramv1 " )
373
373
)
374
374
)
375
375
376
376
if c .section == "types" :
377
- docstring += f"This object is a constructor of the base type :obj:`~pyrogram .raw.base.{ c .qualtype } `.\n \n "
377
+ docstring += f"This object is a constructor of the base type :obj:`~pyrogramv1 .raw.base.{ c .qualtype } `.\n \n "
378
378
else :
379
379
docstring += f"Telegram API method.\n \n "
380
380
@@ -580,23 +580,23 @@ def start(format: bool = False):
580
580
f .write ("objects = {" )
581
581
582
582
for c in combinators :
583
- f .write (f'\n { c .id } : "pyrogram .raw.{ c .section } .{ c .qualname } ",' )
583
+ f .write (f'\n { c .id } : "pyrogramv1 .raw.{ c .section } .{ c .qualname } ",' )
584
584
585
- f .write ('\n 0xbc799737: "pyrogram .raw.core.BoolFalse",' )
586
- f .write ('\n 0x997275b5: "pyrogram .raw.core.BoolTrue",' )
587
- f .write ('\n 0x1cb5c415: "pyrogram .raw.core.Vector",' )
588
- f .write ('\n 0x73f1f8dc: "pyrogram .raw.core.MsgContainer",' )
589
- f .write ('\n 0xae500895: "pyrogram .raw.core.FutureSalts",' )
590
- f .write ('\n 0x0949d9dc: "pyrogram .raw.core.FutureSalt",' )
591
- f .write ('\n 0x3072cfa1: "pyrogram .raw.core.GzipPacked",' )
592
- f .write ('\n 0x5bb8e511: "pyrogram .raw.core.Message",' )
585
+ f .write ('\n 0xbc799737: "pyrogramv1 .raw.core.BoolFalse",' )
586
+ f .write ('\n 0x997275b5: "pyrogramv1 .raw.core.BoolTrue",' )
587
+ f .write ('\n 0x1cb5c415: "pyrogramv1 .raw.core.Vector",' )
588
+ f .write ('\n 0x73f1f8dc: "pyrogramv1 .raw.core.MsgContainer",' )
589
+ f .write ('\n 0xae500895: "pyrogramv1 .raw.core.FutureSalts",' )
590
+ f .write ('\n 0x0949d9dc: "pyrogramv1 .raw.core.FutureSalt",' )
591
+ f .write ('\n 0x3072cfa1: "pyrogramv1 .raw.core.GzipPacked",' )
592
+ f .write ('\n 0x5bb8e511: "pyrogramv1 .raw.core.Message",' )
593
593
594
594
f .write ("\n }\n " )
595
595
596
596
597
597
if "__main__" == __name__ :
598
598
HOME_PATH = Path ("." )
599
- DESTINATION_PATH = Path ("../../pyrogram /raw" )
599
+ DESTINATION_PATH = Path ("../../pyrogramv1 /raw" )
600
600
NOTICE_PATH = Path ("../../NOTICE" )
601
601
602
602
start (format = False )
0 commit comments