Don't inherit from Object

This commit is contained in:
Dan 2018-04-01 13:09:32 +02:00
parent 44a3a4d69b
commit c54730b8ab

View File

@ -144,8 +144,11 @@ def start():
open("{}/source/pyrogram.tl".format(HOME), encoding="utf-8") as pyrogram: open("{}/source/pyrogram.tl".format(HOME), encoding="utf-8") as pyrogram:
schema = (auth.read() + system.read() + api.read() + pyrogram.read()).splitlines() schema = (auth.read() + system.read() + api.read() + pyrogram.read()).splitlines()
with open("{}/template/class.txt".format(HOME), encoding="utf-8") as f: with open("{}/template/mtproto.txt".format(HOME), encoding="utf-8") as f:
template = f.read() mtproto_template = f.read()
with open("{}/template/pyrogram.txt".format(HOME), encoding="utf-8") as f:
pyrogram_template = f.read()
with open(NOTICE_PATH, encoding="utf-8") as f: with open(NOTICE_PATH, encoding="utf-8") as f:
notice = [] notice = []
@ -398,21 +401,33 @@ def start():
docstring_args = description + "\n\n " + docstring_args docstring_args = description + "\n\n " + docstring_args
with open("{}/{}.py".format(path, snek(c.name)), "w", encoding="utf-8") as f: with open("{}/{}.py".format(path, snek(c.name)), "w", encoding="utf-8") as f:
f.write( if c.docs:
template.format( f.write(
notice=notice, pyrogram_template.format(
class_name=capit(c.name), notice=notice,
docstring_args=docstring_args, class_name=capit(c.name),
object_id=c.id, docstring_args=docstring_args,
arguments=arguments, object_id=c.id,
fields=fields, arguments=arguments,
read_flags=read_flags, fields=fields
read_types=read_types, )
write_flags=write_flags, )
write_types=write_types, else:
return_arguments=", ".join([i[0] for i in sorted_args]) f.write(
mtproto_template.format(
notice=notice,
class_name=capit(c.name),
docstring_args=docstring_args,
object_id=c.id,
arguments=arguments,
fields=fields,
read_flags=read_flags,
read_types=read_types,
write_flags=write_flags,
write_types=write_types,
return_arguments=", ".join([i[0] for i in sorted_args])
)
) )
)
with open("{}/all.py".format(DESTINATION), "w", encoding="utf-8") as f: with open("{}/all.py".format(DESTINATION), "w", encoding="utf-8") as f:
f.write(notice + "\n\n") f.write(notice + "\n\n")