mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-31 14:25:55 +00:00
Deep rewrite: preparing for v1.0
- Pyrogram core is now fully asynchronous - Ditched Python 3.5, welcome 3.6 as minimum version. - Moved all types to pyrogram.types - Turned the Filters class into a module (filters) - Moved all filters to pyrogram.filters - Moved all handlers to pyrogram.handlers - Moved all emoji to pyrogram.emoji - Renamed pyrogram.api to pyrogram.raw - Clock is now synced with server's time - Telegram schema updated to Layer 117 - Greatly improved the TL compiler (proper type-constructor hierarchy) - Added "do not edit" warning in generated files - Crypto parts are executed in a thread pool to avoid blocking the event loop - idle() is now a separate function (it doesn't deal with Client instances) - Async storage, async filters and async progress callback (optional, can be sync too) - Added getpass back, for hidden password inputs
This commit is contained in:
@@ -25,11 +25,13 @@ HOME = "compiler/docs"
|
||||
DESTINATION = "docs/source/telegram"
|
||||
PYROGRAM_API_DEST = "docs/source/api"
|
||||
|
||||
FUNCTIONS_PATH = "pyrogram/api/functions"
|
||||
TYPES_PATH = "pyrogram/api/types"
|
||||
FUNCTIONS_PATH = "pyrogram/raw/functions"
|
||||
TYPES_PATH = "pyrogram/raw/types"
|
||||
BASE_PATH = "pyrogram/raw/base"
|
||||
|
||||
FUNCTIONS_BASE = "functions"
|
||||
TYPES_BASE = "types"
|
||||
BASE_BASE = "base"
|
||||
|
||||
|
||||
def snek(s: str):
|
||||
@@ -70,7 +72,7 @@ def generate(source_path, base):
|
||||
page_template.format(
|
||||
title=name,
|
||||
title_markup="=" * len(name),
|
||||
full_class_path="pyrogram.api.{}".format(
|
||||
full_class_path="pyrogram.raw.{}".format(
|
||||
".".join(full_path.split("/")[:-1]) + "." + name
|
||||
)
|
||||
)
|
||||
@@ -92,14 +94,14 @@ def generate(source_path, base):
|
||||
|
||||
if k != base:
|
||||
inner_path = base + "/" + k + "/index" + ".rst"
|
||||
module = "pyrogram.api.{}.{}".format(base, k)
|
||||
module = "pyrogram.raw.{}.{}".format(base, k)
|
||||
else:
|
||||
for i in sorted(list(all_entities), reverse=True):
|
||||
if i != base:
|
||||
entities.insert(0, "{0}/index".format(i))
|
||||
|
||||
inner_path = base + "/index" + ".rst"
|
||||
module = "pyrogram.api.{}".format(base)
|
||||
module = "pyrogram.raw.{}".format(base)
|
||||
|
||||
with open(DESTINATION + "/" + inner_path, "w", encoding="utf-8") as f:
|
||||
if k == base:
|
||||
@@ -128,7 +130,6 @@ def pyrogram_api():
|
||||
utilities="""
|
||||
Utilities
|
||||
start
|
||||
idle
|
||||
stop
|
||||
run
|
||||
restart
|
||||
@@ -264,6 +265,7 @@ def pyrogram_api():
|
||||
send_code
|
||||
resend_code
|
||||
sign_in
|
||||
sign_in_bot
|
||||
sign_up
|
||||
get_password_hint
|
||||
check_password
|
||||
@@ -302,6 +304,15 @@ def pyrogram_api():
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. automethod:: pyrogram.Client.{}()".format(method))
|
||||
|
||||
functions = ["idle"]
|
||||
|
||||
for func in functions:
|
||||
with open(root + "/{}.rst".format(func), "w") as f2:
|
||||
title = "{}()".format(func)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. autofunction:: pyrogram.{}()".format(func))
|
||||
|
||||
f.write(template.format(**fmt_keys))
|
||||
|
||||
# Types
|
||||
@@ -405,7 +416,7 @@ def pyrogram_api():
|
||||
title = "{}".format(type)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. autoclass:: pyrogram.{}()".format(type))
|
||||
f2.write(".. autoclass:: pyrogram.types.{}()".format(type))
|
||||
|
||||
f.write(template.format(**fmt_keys))
|
||||
|
||||
@@ -506,7 +517,7 @@ def pyrogram_api():
|
||||
title = "{}()".format(bm)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. automethod:: pyrogram.{}()".format(bm))
|
||||
f2.write(".. automethod:: pyrogram.types.{}()".format(bm))
|
||||
|
||||
f.write(template.format(**fmt_keys))
|
||||
|
||||
@@ -525,12 +536,14 @@ def start():
|
||||
|
||||
generate(TYPES_PATH, TYPES_BASE)
|
||||
generate(FUNCTIONS_PATH, FUNCTIONS_BASE)
|
||||
generate(BASE_PATH, BASE_BASE)
|
||||
pyrogram_api()
|
||||
|
||||
|
||||
if "__main__" == __name__:
|
||||
FUNCTIONS_PATH = "../../pyrogram/api/functions"
|
||||
TYPES_PATH = "../../pyrogram/api/types"
|
||||
FUNCTIONS_PATH = "../../pyrogram/raw/functions"
|
||||
TYPES_PATH = "../../pyrogram/raw/types"
|
||||
BASE_PATH = "../../pyrogram/raw/base"
|
||||
HOME = "."
|
||||
DESTINATION = "../../docs/source/telegram"
|
||||
PYROGRAM_API_DEST = "../../docs/source/api"
|
||||
|
2
compiler/docs/template/bound-methods.rst
vendored
2
compiler/docs/template/bound-methods.rst
vendored
@@ -26,7 +26,7 @@ some of the required arguments.
|
||||
|
||||
-----
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
.. currentmodule:: pyrogram.types
|
||||
|
||||
Message
|
||||
-------
|
||||
|
17
compiler/docs/template/methods.rst
vendored
17
compiler/docs/template/methods.rst
vendored
@@ -1,7 +1,8 @@
|
||||
Available Methods
|
||||
=================
|
||||
|
||||
This page is about Pyrogram methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance.
|
||||
This page is about Pyrogram methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance,
|
||||
except for :meth:`~pyrogram.idle()`, which is a special function that can be found in the main package directly.
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 6
|
||||
@@ -34,6 +35,20 @@ Utilities
|
||||
|
||||
{utilities}
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
idle
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
idle
|
||||
|
||||
.. currentmodule:: pyrogram.Client
|
||||
|
||||
Messages
|
||||
--------
|
||||
|
||||
|
2
compiler/docs/template/types.rst
vendored
2
compiler/docs/template/types.rst
vendored
@@ -19,7 +19,7 @@ This page is about Pyrogram types. All types listed here are accessible through
|
||||
|
||||
-----
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
.. currentmodule:: pyrogram.types
|
||||
|
||||
Users & Chats
|
||||
-------------
|
||||
|
Reference in New Issue
Block a user