From def7f79de11739cbd9ade6421946931c750078b9 Mon Sep 17 00:00:00 2001 From: pseusys Date: Thu, 27 Apr 2023 14:29:43 +0200 Subject: [PATCH 01/21] versions frozen --- setup.py | 92 +++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 48 deletions(-) diff --git a/setup.py b/setup.py index ed6f1f58c..20a503158 100644 --- a/setup.py +++ b/setup.py @@ -27,57 +27,56 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: core = [ - "pydantic>=1.8.2", - "nest_asyncio>=1.5.5", - "typing_extensions>=4.0.0", + "pydantic~=1.10.7", + "nest-asyncio~=1.5.6", + "typing-extensions~=4.5.0", ] async_files_dependencies = [ - "aiofiles>=22.1.0", + "aiofiles~=23.1.0", ] redis_dependencies = [ - "aioredis>=2.0.1", + "aioredis~=2.0.1", ] mongodb_dependencies = [ - "motor>=3.1.1", + "motor~=3.1.2", ] _sql_dependencies = [ - "sqlalchemy[asyncio]>=2.0.2", + "sqlalchemy[asyncio]~=2.0.10", ] sqlite_dependencies = merge_req_lists( _sql_dependencies, [ - "aiosqlite>=0.18.0", - "sqlalchemy[asyncio]>=1.4.27", + "aiosqlite~=0.19.0", ], ) mysql_dependencies = merge_req_lists( _sql_dependencies, [ - "asyncmy>=0.2.5", - "cryptography>=36.0.2", + "asyncmy~=0.2.7", + "cryptography~=40.0.2", ], ) postgresql_dependencies = merge_req_lists( _sql_dependencies, [ - "asyncpg>=0.27.0", + "asyncpg~=0.27.0", ], ) ydb_dependencies = [ "ydb~=2.5.0", - "six>=1.16.0", + "six~=1.16.0", ] telegram_dependencies = [ - "pytelegrambotapi==4.5.1", + "pytelegrambotapi~=4.5.1", ] full = merge_req_lists( @@ -93,21 +92,21 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: ) requests_requirements = [ - "requests>=2.28.1", + "requests~=2.28.2", ] test_requirements = merge_req_lists( [ - "pytest >=7.2.1,<8.0.0", - "pytest-cov >=4.0.0,<5.0.0", - "pytest-asyncio >=0.14.0,<0.15.0", - "flake8 >=3.8.3,<4.0.0", - "click<=8.0.4", - "black ==20.8b1", - "isort >=5.0.6,<6.0.0", - "flask[async]>=2.1.2", - "psutil>=5.9.1", - "telethon>=1.27.0,<2.0", + "pytest~=7.3.1", + "pytest-cov~=4.0.0", + "pytest-asyncio~=0.14.0", + "flake8~=3.9.2", + "click~=8.0.4", + "black~=20.8b1", + "isort~=5.12.0", + "flask[async]~=2.2.3", + "psutil~=5.9.5", + "telethon~=1.28.5", ], requests_requirements, ) @@ -119,30 +118,30 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: doc = merge_req_lists( [ - "sphinx<6", - "pydata_sphinx_theme>=0.12.0", - "sphinxcontrib-apidoc==0.3.0", - "sphinxcontrib-httpdomain>=1.8.0", - "sphinxcontrib-katex==0.9.0", - "sphinx-favicon>=1.0.1", - "sphinx_copybutton>=0.5", - "sphinx_gallery==0.7.0", - "sphinx-autodoc-typehints>=1.19.4", - "nbsphinx>=0.8.9", - "jupytext>=1.14.1", - "jupyter>=1.0.0", + "sphinx~=5.3.0", + "pydata-sphinx-theme~=0.13.3", + "sphinxcontrib-apidoc~=0.3.0", + "sphinxcontrib-httpdomain~=1.8.0", + "sphinxcontrib-katex~=0.9.0", + "sphinx-favicon~=1.0.1", + "sphinx-copybutton~=0.5.2", + "sphinx-gallery~=0.7.0", + "sphinx-autodoc-typehints~=1.23.0", + "nbsphinx~=0.9.1", + "jupytext~=1.14.5", + "jupyter~=1.0.0", ], requests_requirements, ) devel = [ - "bump2version>=1.0.1", - "build==0.7.0", - "twine==4.0.0", + "bump2version~=1.0.1", + "build~=0.7.0", + "twine~=4.0.0", ] mypy_dependencies = [ - "mypy==0.950", + "mypy~=0.950", ] devel_full = merge_req_lists( @@ -181,10 +180,7 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: url="https://github.com/deeppavlov/dialog_flow_framework", author="Denis Kuznetsov", author_email="kuznetsov.den.p@gmail.com", - classifiers=[ # Optional - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable + classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Topic :: Software Development :: Build Tools", @@ -196,11 +192,11 @@ def merge_req_lists(*req_lists: List[str]) -> List[str]: "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3 :: Only", ], - keywords="chatbots", # Optional - packages=find_packages(where="."), # Required + keywords="chatbots", + packages=find_packages(where="."), include_package_data=True, python_requires=">=3.7, <4", - install_requires=core, # Optional + install_requires=core, test_suite="tests", extras_require=EXTRA_DEPENDENCIES, ) From 299145de68ec28112e1bb7472d8408dbb40c9ba0 Mon Sep 17 00:00:00 2001 From: pseusys Date: Sat, 27 May 2023 02:55:20 +0200 Subject: [PATCH 02/21] documentation links added to some of the examples --- docs/source/utils/notebook.py | 21 +++++++------------ tutorials/context_storages/1_basics.py | 5 +++++ tutorials/context_storages/2_postgresql.py | 6 ++++++ tutorials/context_storages/3_mongodb.py | 5 +++++ tutorials/context_storages/4_redis.py | 5 +++++ tutorials/context_storages/5_mysql.py | 6 ++++++ tutorials/context_storages/6_sqlite.py | 8 +++++++ .../context_storages/7_yandex_database.py | 5 +++++ tutorials/messengers/telegram/1_basic.py | 5 +++++ tutorials/messengers/telegram/2_buttons.py | 10 ++++++++- .../telegram/3_buttons_with_callback.py | 10 ++++++++- tutorials/messengers/telegram/4_conditions.py | 9 ++++++++ .../telegram/5_conditions_with_media.py | 9 ++++++++ .../telegram/6_conditions_extras.py | 13 ++++++++++++ .../messengers/telegram/7_polling_setup.py | 2 ++ .../messengers/telegram/8_webhook_setup.py | 3 +++ .../messengers/web_api_interface/1_fastapi.py | 6 ++++++ .../web_api_interface/2_websocket_chat.py | 6 ++++++ tutorials/pipeline/1_basics.py | 3 +++ .../pipeline/2_pre_and_post_processors.py | 3 +++ .../3_pipeline_dict_with_services_basic.py | 3 +++ .../3_pipeline_dict_with_services_full.py | 3 +++ 22 files changed, 131 insertions(+), 15 deletions(-) diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index c1d5d442a..fd0af3636 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -22,23 +22,18 @@ def inner(tutorial_text: str): # %% [markdown] \"\"\" __Installing dependencies__ + +The cell below installs dff with dependencies for running tutorials +To install the minimal version of dff, use `pip install dff` +To install other options of dff, use `pip install dff[OPTION_NAME1,OPTION_NAME2]` +where OPTION_NAME can be one of the options from EXTRA_DEPENDENCIES. +e.g `pip install dff[ydb, mysql]` installs dff with dependencies for using Yandex Database and MySQL +EXTRA_DEPENDENCIES can be found in +[here](https://github.com/deeppavlov/dialog_flow_framework/blob/dev/setup.py#L{get_extra_deps_line_number()}) \"\"\" # %% !python3 -m pip install -q dff[tutorials] -# Installs dff with dependencies for running tutorials -# To install the minimal version of dff, use `pip install dff` -# To install other options of dff, use `pip install dff[OPTION_NAME1,OPTION_NAME2]` -# where OPTION_NAME can be one of the options from EXTRA_DEPENDENCIES. -# e.g `pip install dff[ydb, mysql]` installs dff with dependencies for using Yandex Database and MySQL -# EXTRA_DEPENDENCIES can be found in -# https://github.com/deeppavlov/dialog_flow_framework/blob/dev/setup.py#L{get_extra_deps_line_number()} - - -# %% [markdown] -\"\"\" -__Running tutorial__ -\"\"\" {tutorial_text[second_cell:]} """, diff --git a/tutorials/context_storages/1_basics.py b/tutorials/context_storages/1_basics.py index c688586af..cfbc6035f 100644 --- a/tutorials/context_storages/1_basics.py +++ b/tutorials/context_storages/1_basics.py @@ -3,6 +3,11 @@ # 1. Basics The following tutorial shows the basic use of the database connection. + +See [context_storage_factory](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.database.html#dff.context_storages.database.context_storage_factory) function +for creating a context storage factory by path. + +In this example JSON file is used as a storage. """ diff --git a/tutorials/context_storages/2_postgresql.py b/tutorials/context_storages/2_postgresql.py index 09aa949cf..aade8a494 100644 --- a/tutorials/context_storages/2_postgresql.py +++ b/tutorials/context_storages/2_postgresql.py @@ -3,6 +3,12 @@ # 2. PostgreSQL This is a tutorial on using PostgreSQL. + +See [SQLContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class +for storing you users' contexts in SQL databases. + +The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncpg](https://magicstack.github.io/asyncpg/current/) +libraries for asynchronous access to PostgreSQL DB. """ diff --git a/tutorials/context_storages/3_mongodb.py b/tutorials/context_storages/3_mongodb.py index a6ff2ec9d..30f5651c6 100644 --- a/tutorials/context_storages/3_mongodb.py +++ b/tutorials/context_storages/3_mongodb.py @@ -3,6 +3,11 @@ # 3. MongoDB This is a tutorial on using MongoDB. + +See [MongoContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.mongo.html#mongo) class +for storing you users' contexts in Mongo database. + +The DFF uses [motor](https://motor.readthedocs.io/en/stable/) library for asynchronous access to MongoDB. """ diff --git a/tutorials/context_storages/4_redis.py b/tutorials/context_storages/4_redis.py index 28d6ba816..f40ee745e 100644 --- a/tutorials/context_storages/4_redis.py +++ b/tutorials/context_storages/4_redis.py @@ -3,6 +3,11 @@ # 4. Redis This is a tutorial on using Redis. + +See [RedisContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.redis.html#redis) class +for storing you users' contexts in Redis database. + +The DFF uses [redis.asyncio](https://redis.readthedocs.io/en/latest/) library for asynchronous access to Redis DB. """ diff --git a/tutorials/context_storages/5_mysql.py b/tutorials/context_storages/5_mysql.py index b1f8e8a54..1c8350248 100644 --- a/tutorials/context_storages/5_mysql.py +++ b/tutorials/context_storages/5_mysql.py @@ -3,6 +3,12 @@ # 5. MySQL This is a tutorial on using MySQL. + +See [MySQL](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class +for storing you users' contexts in SQL databases. + +The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncmy](https://github.com/long2ice/asyncmy) +libraries for asynchronous access to MySQL DB. """ diff --git a/tutorials/context_storages/6_sqlite.py b/tutorials/context_storages/6_sqlite.py index ccc472b99..1a46d0ecf 100644 --- a/tutorials/context_storages/6_sqlite.py +++ b/tutorials/context_storages/6_sqlite.py @@ -3,6 +3,14 @@ # 6. SQLite This is a tutorial on using SQLite. + +See [SQLite](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class +for storing you users' contexts in SQL databases. + +The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [aiosqlite](https://readthedocs.org/projects/aiosqlite/) +libraries for asynchronous access to SQLite DB. + +Note that protocol separator for windows differs from one for linux. """ diff --git a/tutorials/context_storages/7_yandex_database.py b/tutorials/context_storages/7_yandex_database.py index 2a32f724c..51f8c05f3 100644 --- a/tutorials/context_storages/7_yandex_database.py +++ b/tutorials/context_storages/7_yandex_database.py @@ -3,6 +3,11 @@ # 7. Yandex DataBase This is a tutorial on how to use Yandex DataBase. + +See [YDB](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.ydb.html#yandex-db) class +for storing you users' contexts in Yandex database. + +The DFF uses [ydb.aio](https://ydb.tech/en/docs/) library for asynchronous access to Yandex DB. """ diff --git a/tutorials/messengers/telegram/1_basic.py b/tutorials/messengers/telegram/1_basic.py index db3c07c41..695c862c6 100644 --- a/tutorials/messengers/telegram/1_basic.py +++ b/tutorials/messengers/telegram/1_basic.py @@ -4,6 +4,11 @@ The following tutorial shows how to run a regular DFF script in Telegram. It asks users for the '/start' command and then loops in one place. + +Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface) +class and [telebot](https://pytba.readthedocs.io/en/latest/index.html) library are used for accessing telegram API in polling mode. + +Telegram API token is used for access telegram API. """ diff --git a/tutorials/messengers/telegram/2_buttons.py b/tutorials/messengers/telegram/2_buttons.py index 2d536dbe3..108f37b5e 100644 --- a/tutorials/messengers/telegram/2_buttons.py +++ b/tutorials/messengers/telegram/2_buttons.py @@ -2,10 +2,18 @@ """ # Telegram: 2. Buttons - This tutorial shows how to display and hide a basic keyboard in Telegram. + +Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) +class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and +[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) +classes are used for configuring additional telegram message features. + +Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) +classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. """ + # %% import os diff --git a/tutorials/messengers/telegram/3_buttons_with_callback.py b/tutorials/messengers/telegram/3_buttons_with_callback.py index d3a469a2d..0f53fdf05 100644 --- a/tutorials/messengers/telegram/3_buttons_with_callback.py +++ b/tutorials/messengers/telegram/3_buttons_with_callback.py @@ -2,11 +2,19 @@ """ # Telegram: 3. Buttons with Callback - This tutorial demonstrates, how to add an inline keyboard and utilize inline queries. + +Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) +class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and +[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) +classes are used for configuring additional telegram message features. + +Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) +classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. """ + # %% import os diff --git a/tutorials/messengers/telegram/4_conditions.py b/tutorials/messengers/telegram/4_conditions.py index f6546ef47..252d6d7cf 100644 --- a/tutorials/messengers/telegram/4_conditions.py +++ b/tutorials/messengers/telegram/4_conditions.py @@ -4,8 +4,17 @@ This tutorial shows how to process Telegram updates in your script and reuse handler triggers from the `pytelegrambotapi` library. + +Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) +class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and +[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) +classes are used for configuring additional telegram message features. + +Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) +classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. """ + # %% import os diff --git a/tutorials/messengers/telegram/5_conditions_with_media.py b/tutorials/messengers/telegram/5_conditions_with_media.py index 06c8d68fc..f78fd5158 100644 --- a/tutorials/messengers/telegram/5_conditions_with_media.py +++ b/tutorials/messengers/telegram/5_conditions_with_media.py @@ -3,8 +3,17 @@ # Telegram: 5. Conditions with Media This tutorial shows how to use media-related logic in your script. + +Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) +class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and +[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) +classes are used for configuring additional telegram message features. + +Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) +classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. """ + # %% import os diff --git a/tutorials/messengers/telegram/6_conditions_extras.py b/tutorials/messengers/telegram/6_conditions_extras.py index 1131d29b6..1e9345050 100644 --- a/tutorials/messengers/telegram/6_conditions_extras.py +++ b/tutorials/messengers/telegram/6_conditions_extras.py @@ -4,8 +4,21 @@ This tutorial shows how to use additional update filters inherited from the `pytelegrambotapi` library. + +Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) +class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and +[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) +classes are used for configuring additional telegram message features. + +Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) +classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. + +[telegram_condition](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.telegram_condition) +function and different types of [UpdateType](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.UpdateType) +can be used for telegram message type checking. """ + # %% import os diff --git a/tutorials/messengers/telegram/7_polling_setup.py b/tutorials/messengers/telegram/7_polling_setup.py index 5496cebf6..b8d88c1af 100644 --- a/tutorials/messengers/telegram/7_polling_setup.py +++ b/tutorials/messengers/telegram/7_polling_setup.py @@ -4,6 +4,8 @@ The following tutorial shows how to configure `PollingTelegramInterface`. +Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface) +and its' different parameters are shown. """ diff --git a/tutorials/messengers/telegram/8_webhook_setup.py b/tutorials/messengers/telegram/8_webhook_setup.py index 7f65fced9..1d6bcf9e1 100644 --- a/tutorials/messengers/telegram/8_webhook_setup.py +++ b/tutorials/messengers/telegram/8_webhook_setup.py @@ -4,6 +4,9 @@ The following tutorial shows how to use `CallbackTelegramInterface` that makes your bot accessible through a public webhook. + +Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.CallbackMessengerInterface) +is used for accessing telegram API in callback mode. """ diff --git a/tutorials/messengers/web_api_interface/1_fastapi.py b/tutorials/messengers/web_api_interface/1_fastapi.py index c4256521f..144b7c24b 100644 --- a/tutorials/messengers/web_api_interface/1_fastapi.py +++ b/tutorials/messengers/web_api_interface/1_fastapi.py @@ -5,6 +5,12 @@ This tutorial shows how to create an API for DFF using FastAPI. You can see the result at http://127.0.0.1:8000/docs. + +Here, `_run_pipeline` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run)) +method is used to execute pipeline once. + +[Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) +is used to represent incoming to pipeline data. """ diff --git a/tutorials/messengers/web_api_interface/2_websocket_chat.py b/tutorials/messengers/web_api_interface/2_websocket_chat.py index dd8010e9e..2f1de8c1f 100644 --- a/tutorials/messengers/web_api_interface/2_websocket_chat.py +++ b/tutorials/messengers/web_api_interface/2_websocket_chat.py @@ -14,6 +14,12 @@ > ... for this example, we'll use a very simple HTML document with some JavaScript, > all inside a long string. > This, of course, is not optimal and you wouldn't use it for production. + +Here, `_run_pipeline` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run)) +method is used to execute pipeline once. + +[Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) +is used to represent incoming to pipeline data. """ diff --git a/tutorials/pipeline/1_basics.py b/tutorials/pipeline/1_basics.py index 7abc82d8e..76ea8fa4f 100644 --- a/tutorials/pipeline/1_basics.py +++ b/tutorials/pipeline/1_basics.py @@ -4,6 +4,9 @@ The following tutorial shows basic usage of `pipeline` module as an extension to `dff.script.core`. + +Here, `__call__` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run)) +method is used to execute pipeline once. """ diff --git a/tutorials/pipeline/2_pre_and_post_processors.py b/tutorials/pipeline/2_pre_and_post_processors.py index 75bc8942e..901265426 100644 --- a/tutorials/pipeline/2_pre_and_post_processors.py +++ b/tutorials/pipeline/2_pre_and_post_processors.py @@ -4,6 +4,9 @@ The following tutorial shows more advanced usage of `pipeline` module as an extension to `dff.script.core`. + +Here, [MISC](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.context.html#dff.script.core.context.Context.misc) +dictionary of context is used for storing message additional data. """ diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py index 8b6ad9b2c..ca7c1c65d 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py @@ -4,6 +4,9 @@ The following tutorial shows `pipeline` creation from dict and most important pipeline components. + +Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#service) +class, that can be used for pre- and postprocessing of messages is shown. """ diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_full.py b/tutorials/pipeline/3_pipeline_dict_with_services_full.py index b92f4bc22..69e57e496 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_full.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_full.py @@ -4,6 +4,9 @@ The following tutorial shows `pipeline` creation from dict and most important pipeline components. + +Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#service) +class, that can be used for some more complex pre- and postprocessing of messages is shown. """ From 590f6a88bf5706c4b78d002a4e126c2c2bc30719 Mon Sep 17 00:00:00 2001 From: pseusys Date: Sun, 28 May 2023 06:46:19 +0200 Subject: [PATCH 03/21] caches left undocumented only --- tutorials/pipeline/3_pipeline_dict_with_services_basic.py | 3 +++ tutorials/pipeline/3_pipeline_dict_with_services_full.py | 3 +++ tutorials/pipeline/4_groups_and_conditions_basic.py | 4 ++++ tutorials/pipeline/4_groups_and_conditions_full.py | 4 ++++ .../pipeline/5_asynchronous_groups_and_services_basic.py | 3 +++ .../pipeline/5_asynchronous_groups_and_services_full.py | 3 +++ tutorials/pipeline/6_custom_messenger_interface.py | 4 ++++ tutorials/pipeline/7_extra_handlers_basic.py | 4 ++++ tutorials/pipeline/7_extra_handlers_full.py | 4 ++++ tutorials/pipeline/8_extra_handlers_and_extensions.py | 3 +++ tutorials/script/core/1_basics.py | 8 ++++++++ tutorials/script/core/2_conditions.py | 4 ++++ tutorials/script/core/3_responses.py | 4 ++++ tutorials/script/core/4_transitions.py | 7 +++++++ tutorials/script/core/5_global_transitions.py | 5 +++++ tutorials/script/core/7_pre_response_processing.py | 4 ++++ tutorials/script/core/8_misc.py | 4 ++++ tutorials/script/core/9_pre_transitions_processing.py | 4 ++++ tutorials/script/responses/1_basics.py | 5 +++++ tutorials/script/responses/2_buttons.py | 5 +++++ tutorials/script/responses/3_media.py | 7 +++++++ tutorials/script/responses/4_multi_message.py | 4 ++++ tutorials/utils/1_cache.py | 2 ++ tutorials/utils/2_lru_cache.py | 2 ++ 24 files changed, 100 insertions(+) diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py index ca7c1c65d..7203d0270 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py @@ -7,6 +7,9 @@ Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#service) class, that can be used for pre- and postprocessing of messages is shown. + +Pipeline [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict) +static method can be used for pipeline creation (from dictionary). """ diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_full.py b/tutorials/pipeline/3_pipeline_dict_with_services_full.py index 69e57e496..060fccb61 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_full.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_full.py @@ -7,6 +7,9 @@ Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#service) class, that can be used for some more complex pre- and postprocessing of messages is shown. + +Pipeline [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict) +static method can be used for pipeline creation (from dictionary). """ diff --git a/tutorials/pipeline/4_groups_and_conditions_basic.py b/tutorials/pipeline/4_groups_and_conditions_basic.py index 171aaa63b..195d772bb 100644 --- a/tutorials/pipeline/4_groups_and_conditions_basic.py +++ b/tutorials/pipeline/4_groups_and_conditions_basic.py @@ -3,6 +3,10 @@ # 4. Groups and conditions (basic) The following example shows `pipeline` service group usage and start conditions. + +Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#dff.pipeline.service.service.Service)s +and [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s +are shown for advanced data pre- and postprocessing based on conditions. """ diff --git a/tutorials/pipeline/4_groups_and_conditions_full.py b/tutorials/pipeline/4_groups_and_conditions_full.py index a6953aa8e..2770d336a 100644 --- a/tutorials/pipeline/4_groups_and_conditions_full.py +++ b/tutorials/pipeline/4_groups_and_conditions_full.py @@ -3,6 +3,10 @@ # 4. Groups and conditions (full) The following tutorial shows `pipeline` service group usage and start conditions. + +Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#dff.pipeline.service.service.Service)s +and [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s +are shown for advanced data pre- and postprocessing based on conditions. """ diff --git a/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py b/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py index 4fb494b33..de471514f 100644 --- a/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py +++ b/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py @@ -4,6 +4,9 @@ The following tutorial shows `pipeline` asynchronous service and service group usage. + +Here, [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s +are shown for advanced and asynchronous data pre- and postprocessing. """ diff --git a/tutorials/pipeline/5_asynchronous_groups_and_services_full.py b/tutorials/pipeline/5_asynchronous_groups_and_services_full.py index 44b5d96f7..418ee69b3 100644 --- a/tutorials/pipeline/5_asynchronous_groups_and_services_full.py +++ b/tutorials/pipeline/5_asynchronous_groups_and_services_full.py @@ -4,6 +4,9 @@ The following tutorial shows `pipeline` asynchronous service and service group usage. + +Here, [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s +are shown for advanced and asynchronous data pre- and postprocessing. """ diff --git a/tutorials/pipeline/6_custom_messenger_interface.py b/tutorials/pipeline/6_custom_messenger_interface.py index 9ace91e29..09b076d14 100644 --- a/tutorials/pipeline/6_custom_messenger_interface.py +++ b/tutorials/pipeline/6_custom_messenger_interface.py @@ -3,6 +3,10 @@ # 6. Custom messenger interface The following tutorial shows messenger interfaces usage. + +Here, [CallbackMessengerInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.interface.html#dff.messengers.telegram.interface.CallbackTelegramInterface) +and [PollingMessengerInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.interface.html#dff.messengers.telegram.interface.PollingTelegramInterface) +are shown as alternatives for connection to custom user messenger backends. """ diff --git a/tutorials/pipeline/7_extra_handlers_basic.py b/tutorials/pipeline/7_extra_handlers_basic.py index 410632ce7..7feac7468 100644 --- a/tutorials/pipeline/7_extra_handlers_basic.py +++ b/tutorials/pipeline/7_extra_handlers_basic.py @@ -3,6 +3,10 @@ # 7. Extra Handlers (basic) The following tutorial shows extra handlers possibilities and use cases. + +Here, extra handlers [BeforeHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.BeforeHandler) +and [AfterHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.AfterHandler) +are shown as additional means of data processing, attached to services. """ diff --git a/tutorials/pipeline/7_extra_handlers_full.py b/tutorials/pipeline/7_extra_handlers_full.py index e7962efc4..4c1d56d59 100644 --- a/tutorials/pipeline/7_extra_handlers_full.py +++ b/tutorials/pipeline/7_extra_handlers_full.py @@ -3,6 +3,10 @@ # 7. Extra Handlers (basic) The following tutorial shows extra handlers possibilities and use cases. + +Here, extra handlers [BeforeHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.BeforeHandler) +and [AfterHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.AfterHandler) +are shown as additional means of data processing, attached to services. """ diff --git a/tutorials/pipeline/8_extra_handlers_and_extensions.py b/tutorials/pipeline/8_extra_handlers_and_extensions.py index 1bb85be9f..e8a846e93 100644 --- a/tutorials/pipeline/8_extra_handlers_and_extensions.py +++ b/tutorials/pipeline/8_extra_handlers_and_extensions.py @@ -4,6 +4,9 @@ The following tutorial shows how pipeline can be extended by global extra handlers and custom functions. + +Here, [add_global_handler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.add_global_handler) +function is shown, that can be used to add extra handlers before and/or after all pipeline services. """ diff --git a/tutorials/script/core/1_basics.py b/tutorials/script/core/1_basics.py index 968c1f599..d04b0f750 100644 --- a/tutorials/script/core/1_basics.py +++ b/tutorials/script/core/1_basics.py @@ -3,6 +3,14 @@ # Core: 1. Basics This notebook shows basic tutorial of creating a simple dialog bot (agent). + +Here, basic usege of [Pipeline](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline) +primitive is shown: its' creation with [from_script](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_script) +and execution. + +Additionally, function [check_happy_path](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.utils.testing.common.html#dff.utils.testing.common.check_happy_path) +that can be used for Pipeline testing is presented. + Let's do all the necessary imports from DFF: """ diff --git a/tutorials/script/core/2_conditions.py b/tutorials/script/core/2_conditions.py index 6ff1d5ed5..edbaf2047 100644 --- a/tutorials/script/core/2_conditions.py +++ b/tutorials/script/core/2_conditions.py @@ -4,6 +4,10 @@ This tutorial shows different options for setting transition conditions from one node to another. + +Here, [conditions](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.conditions.std_conditions.html#conditions) +for script transitions are shown. + First of all, let's do all the necessary imports from DFF. """ diff --git a/tutorials/script/core/3_responses.py b/tutorials/script/core/3_responses.py index 62112701b..13a1f3a5e 100644 --- a/tutorials/script/core/3_responses.py +++ b/tutorials/script/core/3_responses.py @@ -3,6 +3,10 @@ # Core: 3. Responses This tutorial shows different options for setting responses. + +Here, [responses](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.responses.std_responses.html#responses) +that allow returning answers to user from script are shown. + Let's do all the necessary imports from DFF. """ diff --git a/tutorials/script/core/4_transitions.py b/tutorials/script/core/4_transitions.py index 6de30f6f4..7d0a657c3 100644 --- a/tutorials/script/core/4_transitions.py +++ b/tutorials/script/core/4_transitions.py @@ -3,9 +3,16 @@ # Core: 4. Transitions This tutorial shows settings for transitions between flows and nodes. + +Here, [conditions](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.conditions.std_conditions.html#conditions) +for transition between many different script steps are shown. + +Some of the destination steps can be set using [labels](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.labels.std_labels.html#labels). + First of all, let's do all the necessary imports from DFF. """ + # %% import re diff --git a/tutorials/script/core/5_global_transitions.py b/tutorials/script/core/5_global_transitions.py index c26b9d301..e72437404 100644 --- a/tutorials/script/core/5_global_transitions.py +++ b/tutorials/script/core/5_global_transitions.py @@ -3,9 +3,14 @@ # Core: 5. Global transitions This tutorial shows the global setting of transitions. + +Here, global [conditions](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.conditions.std_conditions.html#conditions) +for default transition between many different script steps are shown. + First of all, let's do all the necessary imports from DFF. """ + # %% import re diff --git a/tutorials/script/core/7_pre_response_processing.py b/tutorials/script/core/7_pre_response_processing.py index 5b498a7bf..e78d86f34 100644 --- a/tutorials/script/core/7_pre_response_processing.py +++ b/tutorials/script/core/7_pre_response_processing.py @@ -3,6 +3,10 @@ # Core: 7. Pre-response processing This tutorial shows pre-response processing feature. + +Here, [PRE_RESPONSE_PROCESSING](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.PRE_RESPONSE_PROCESSING) +that can be used for additional context processing before response is shown. + First of all, let's do all the necessary imports from DFF. """ diff --git a/tutorials/script/core/8_misc.py b/tutorials/script/core/8_misc.py index 73e423460..29198af1e 100644 --- a/tutorials/script/core/8_misc.py +++ b/tutorials/script/core/8_misc.py @@ -3,6 +3,10 @@ # Core: 8. Misc This tutorial shows `MISC` (miscellaneous) keyword usage. + +Here, [MISC](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.MISC) +that can be used for user data storage inside of a context is shown. + First of all, let's do all the necessary imports from DFF. """ diff --git a/tutorials/script/core/9_pre_transitions_processing.py b/tutorials/script/core/9_pre_transitions_processing.py index a16bfcaeb..c06c8f148 100644 --- a/tutorials/script/core/9_pre_transitions_processing.py +++ b/tutorials/script/core/9_pre_transitions_processing.py @@ -3,6 +3,10 @@ # Core: 9. Pre-transitions processing This tutorial shows pre-transitions processing feature. + +Here, [PRE_TRANSITIONS_PROCESSING](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.PRE_TRANSITIONS_PROCESSING) +that can be used for additional context processing before transitioning to the next step is shown. + First of all, let's do all the necessary imports from DFF. """ diff --git a/tutorials/script/responses/1_basics.py b/tutorials/script/responses/1_basics.py index d4307a8d2..bcb1d9129 100644 --- a/tutorials/script/responses/1_basics.py +++ b/tutorials/script/responses/1_basics.py @@ -2,6 +2,11 @@ """ # Responses: 1. Basics +Here, the process of response forming is shown. +Special keywords [RESPONSE](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.RESPONSE) +and [TRANSITIONS](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.TRANSITIONS) +are used for that. + """ diff --git a/tutorials/script/responses/2_buttons.py b/tutorials/script/responses/2_buttons.py index ae6f17dc4..9e81c1f0f 100644 --- a/tutorials/script/responses/2_buttons.py +++ b/tutorials/script/responses/2_buttons.py @@ -2,8 +2,13 @@ """ # Responses: 2. Buttons +Here, [Button](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Button) +class is shown. Buttons are special response decorations (just like other [element](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message)s) +They can be attached to any message and will have different forms in differend messengers (implementation-defined). + """ + # %% import dff.script.conditions as cnd import dff.script.labels as lbl diff --git a/tutorials/script/responses/3_media.py b/tutorials/script/responses/3_media.py index a27512dee..6f8b7df7d 100644 --- a/tutorials/script/responses/3_media.py +++ b/tutorials/script/responses/3_media.py @@ -2,6 +2,13 @@ """ # Responses: 3. Media +Here, [Attachments](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Attachments) +class is shown. Attachments can be used for attaching different media elements +(such as [Image](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Image), +[Document](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Document) +or [Audio](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Audio)) +can be used. They can be attached to any message and will have different forms in differend messengers (implementation-defined). + """ diff --git a/tutorials/script/responses/4_multi_message.py b/tutorials/script/responses/4_multi_message.py index 6ddef9742..f35c76e1c 100644 --- a/tutorials/script/responses/4_multi_message.py +++ b/tutorials/script/responses/4_multi_message.py @@ -3,6 +3,10 @@ # Responses: 4. Multi Message This tutorial shows Multi Message usage. + +The [MultiMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.MultiMessage) +represents a combination of several messages. + Let's do all the necessary imports from DFF. """ diff --git a/tutorials/utils/1_cache.py b/tutorials/utils/1_cache.py index 9c814e733..06512ae78 100644 --- a/tutorials/utils/1_cache.py +++ b/tutorials/utils/1_cache.py @@ -2,6 +2,8 @@ """ # 1. Cache +# TODO: no entry in documentation! + """ diff --git a/tutorials/utils/2_lru_cache.py b/tutorials/utils/2_lru_cache.py index 4e3f41c91..6a1e4a5bc 100644 --- a/tutorials/utils/2_lru_cache.py +++ b/tutorials/utils/2_lru_cache.py @@ -2,6 +2,8 @@ """ # 2. LRU Cache +# TODO: no entry in documentation! + """ # %% From 387229662a9c5a0811cebb819ab74ba6eb7f3620 Mon Sep 17 00:00:00 2001 From: pseusys Date: Fri, 16 Jun 2023 05:36:45 +0200 Subject: [PATCH 04/21] merge artifact removed --- docs/source/utils/notebook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index f533f4fd2..28fcc39b3 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -23,7 +23,7 @@ def inner(tutorial_text: str): where OPTION_NAME can be one of the options from EXTRA_DEPENDENCIES. e.g `pip install dff[ydb, mysql]` installs dff with dependencies for using Yandex Database and MySQL EXTRA_DEPENDENCIES can be found in -[here](https://github.com/deeppavlov/dialog_flow_framework/blob/dev/setup.py#L{get_extra_deps_line_number()}) +[here](https://github.com/deeppavlov/dialog_flow_framework/blob/dev/README.md#installation) \"\"\" # %% From 78329b8715b1ce832065242d111265c9e76d2c17 Mon Sep 17 00:00:00 2001 From: pseusys Date: Fri, 23 Jun 2023 12:54:11 +0200 Subject: [PATCH 05/21] link llength fixing comments added --- tutorials/context_storages/1_basics.py | 2 +- tutorials/context_storages/2_postgresql.py | 2 +- tutorials/context_storages/3_mongodb.py | 2 +- tutorials/context_storages/4_redis.py | 2 +- tutorials/context_storages/5_mysql.py | 2 +- tutorials/context_storages/6_sqlite.py | 2 +- tutorials/context_storages/7_yandex_database.py | 2 +- tutorials/messengers/telegram/1_basic.py | 2 +- tutorials/messengers/telegram/2_buttons.py | 2 +- tutorials/messengers/telegram/3_buttons_with_callback.py | 2 +- tutorials/messengers/telegram/4_conditions.py | 2 +- tutorials/messengers/telegram/5_conditions_with_media.py | 2 +- tutorials/messengers/telegram/6_conditions_extras.py | 2 +- tutorials/messengers/telegram/7_polling_setup.py | 2 +- tutorials/messengers/telegram/8_webhook_setup.py | 2 +- tutorials/messengers/web_api_interface/1_fastapi.py | 2 +- tutorials/messengers/web_api_interface/2_websocket_chat.py | 2 +- tutorials/pipeline/1_basics.py | 2 +- tutorials/pipeline/2_pre_and_post_processors.py | 2 +- tutorials/pipeline/3_pipeline_dict_with_services_basic.py | 2 +- tutorials/pipeline/3_pipeline_dict_with_services_full.py | 2 +- tutorials/pipeline/4_groups_and_conditions_basic.py | 2 +- tutorials/pipeline/4_groups_and_conditions_full.py | 2 +- .../pipeline/5_asynchronous_groups_and_services_basic.py | 2 +- tutorials/pipeline/5_asynchronous_groups_and_services_full.py | 2 +- tutorials/pipeline/6_custom_messenger_interface.py | 2 +- tutorials/pipeline/7_extra_handlers_basic.py | 2 +- tutorials/pipeline/7_extra_handlers_full.py | 2 +- tutorials/pipeline/8_extra_handlers_and_extensions.py | 2 +- tutorials/script/core/1_basics.py | 2 +- tutorials/script/core/2_conditions.py | 4 ++-- tutorials/script/core/3_responses.py | 4 ++-- tutorials/script/core/4_transitions.py | 2 +- tutorials/script/core/5_global_transitions.py | 2 +- tutorials/script/core/6_context_serialization.py | 2 +- tutorials/script/core/7_pre_response_processing.py | 2 +- tutorials/script/core/8_misc.py | 2 +- tutorials/script/core/9_pre_transitions_processing.py | 2 +- tutorials/script/responses/1_basics.py | 3 +-- tutorials/script/responses/2_buttons.py | 3 +-- tutorials/script/responses/3_media.py | 3 +-- tutorials/script/responses/4_multi_message.py | 2 +- 42 files changed, 44 insertions(+), 47 deletions(-) diff --git a/tutorials/context_storages/1_basics.py b/tutorials/context_storages/1_basics.py index cfbc6035f..555048ed6 100644 --- a/tutorials/context_storages/1_basics.py +++ b/tutorials/context_storages/1_basics.py @@ -8,7 +8,7 @@ for creating a context storage factory by path. In this example JSON file is used as a storage. -""" +""" # noqa: E501 # %% diff --git a/tutorials/context_storages/2_postgresql.py b/tutorials/context_storages/2_postgresql.py index aade8a494..3b15f33e8 100644 --- a/tutorials/context_storages/2_postgresql.py +++ b/tutorials/context_storages/2_postgresql.py @@ -9,7 +9,7 @@ The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncpg](https://magicstack.github.io/asyncpg/current/) libraries for asynchronous access to PostgreSQL DB. -""" +""" # noqa: E501 # %% diff --git a/tutorials/context_storages/3_mongodb.py b/tutorials/context_storages/3_mongodb.py index 30f5651c6..6a9dc51cd 100644 --- a/tutorials/context_storages/3_mongodb.py +++ b/tutorials/context_storages/3_mongodb.py @@ -8,7 +8,7 @@ for storing you users' contexts in Mongo database. The DFF uses [motor](https://motor.readthedocs.io/en/stable/) library for asynchronous access to MongoDB. -""" +""" # noqa: E501 # %% diff --git a/tutorials/context_storages/4_redis.py b/tutorials/context_storages/4_redis.py index f40ee745e..a75656b61 100644 --- a/tutorials/context_storages/4_redis.py +++ b/tutorials/context_storages/4_redis.py @@ -8,7 +8,7 @@ for storing you users' contexts in Redis database. The DFF uses [redis.asyncio](https://redis.readthedocs.io/en/latest/) library for asynchronous access to Redis DB. -""" +""" # noqa: E501 # %% diff --git a/tutorials/context_storages/5_mysql.py b/tutorials/context_storages/5_mysql.py index 1c8350248..7d4111442 100644 --- a/tutorials/context_storages/5_mysql.py +++ b/tutorials/context_storages/5_mysql.py @@ -9,7 +9,7 @@ The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncmy](https://github.com/long2ice/asyncmy) libraries for asynchronous access to MySQL DB. -""" +""" # noqa: E501 # %% diff --git a/tutorials/context_storages/6_sqlite.py b/tutorials/context_storages/6_sqlite.py index 1a46d0ecf..cef3a091d 100644 --- a/tutorials/context_storages/6_sqlite.py +++ b/tutorials/context_storages/6_sqlite.py @@ -11,7 +11,7 @@ libraries for asynchronous access to SQLite DB. Note that protocol separator for windows differs from one for linux. -""" +""" # noqa: E501 # %% diff --git a/tutorials/context_storages/7_yandex_database.py b/tutorials/context_storages/7_yandex_database.py index 51f8c05f3..30f6a9468 100644 --- a/tutorials/context_storages/7_yandex_database.py +++ b/tutorials/context_storages/7_yandex_database.py @@ -8,7 +8,7 @@ for storing you users' contexts in Yandex database. The DFF uses [ydb.aio](https://ydb.tech/en/docs/) library for asynchronous access to Yandex DB. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/telegram/1_basic.py b/tutorials/messengers/telegram/1_basic.py index 695c862c6..d0828d854 100644 --- a/tutorials/messengers/telegram/1_basic.py +++ b/tutorials/messengers/telegram/1_basic.py @@ -9,7 +9,7 @@ class and [telebot](https://pytba.readthedocs.io/en/latest/index.html) library are used for accessing telegram API in polling mode. Telegram API token is used for access telegram API. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/telegram/2_buttons.py b/tutorials/messengers/telegram/2_buttons.py index 108f37b5e..fef104e30 100644 --- a/tutorials/messengers/telegram/2_buttons.py +++ b/tutorials/messengers/telegram/2_buttons.py @@ -11,7 +11,7 @@ class is used to represent telegram message, [TelegramUI](https://deeppavlov.git Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/telegram/3_buttons_with_callback.py b/tutorials/messengers/telegram/3_buttons_with_callback.py index 0f53fdf05..cd517b927 100644 --- a/tutorials/messengers/telegram/3_buttons_with_callback.py +++ b/tutorials/messengers/telegram/3_buttons_with_callback.py @@ -12,7 +12,7 @@ class is used to represent telegram message, [TelegramUI](https://deeppavlov.git Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/telegram/4_conditions.py b/tutorials/messengers/telegram/4_conditions.py index 252d6d7cf..d3fa711d2 100644 --- a/tutorials/messengers/telegram/4_conditions.py +++ b/tutorials/messengers/telegram/4_conditions.py @@ -12,7 +12,7 @@ class is used to represent telegram message, [TelegramUI](https://deeppavlov.git Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/telegram/5_conditions_with_media.py b/tutorials/messengers/telegram/5_conditions_with_media.py index f78fd5158..35cc32671 100644 --- a/tutorials/messengers/telegram/5_conditions_with_media.py +++ b/tutorials/messengers/telegram/5_conditions_with_media.py @@ -11,7 +11,7 @@ class is used to represent telegram message, [TelegramUI](https://deeppavlov.git Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/telegram/6_conditions_extras.py b/tutorials/messengers/telegram/6_conditions_extras.py index 1e9345050..9224cf956 100644 --- a/tutorials/messengers/telegram/6_conditions_extras.py +++ b/tutorials/messengers/telegram/6_conditions_extras.py @@ -16,7 +16,7 @@ class is used to represent telegram message, [TelegramUI](https://deeppavlov.git [telegram_condition](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.telegram_condition) function and different types of [UpdateType](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.UpdateType) can be used for telegram message type checking. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/telegram/7_polling_setup.py b/tutorials/messengers/telegram/7_polling_setup.py index b8d88c1af..661af8d6a 100644 --- a/tutorials/messengers/telegram/7_polling_setup.py +++ b/tutorials/messengers/telegram/7_polling_setup.py @@ -6,7 +6,7 @@ Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface) and its' different parameters are shown. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/telegram/8_webhook_setup.py b/tutorials/messengers/telegram/8_webhook_setup.py index 1d6bcf9e1..ebef8e500 100644 --- a/tutorials/messengers/telegram/8_webhook_setup.py +++ b/tutorials/messengers/telegram/8_webhook_setup.py @@ -7,7 +7,7 @@ Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.CallbackMessengerInterface) is used for accessing telegram API in callback mode. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/web_api_interface/1_fastapi.py b/tutorials/messengers/web_api_interface/1_fastapi.py index 55b1fdc9d..237ef92f0 100644 --- a/tutorials/messengers/web_api_interface/1_fastapi.py +++ b/tutorials/messengers/web_api_interface/1_fastapi.py @@ -11,7 +11,7 @@ [Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) is used to represent incoming to pipeline data. -""" +""" # noqa: E501 # %% diff --git a/tutorials/messengers/web_api_interface/2_websocket_chat.py b/tutorials/messengers/web_api_interface/2_websocket_chat.py index 2f1de8c1f..29341caeb 100644 --- a/tutorials/messengers/web_api_interface/2_websocket_chat.py +++ b/tutorials/messengers/web_api_interface/2_websocket_chat.py @@ -20,7 +20,7 @@ [Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) is used to represent incoming to pipeline data. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/1_basics.py b/tutorials/pipeline/1_basics.py index 76ea8fa4f..136dd02e3 100644 --- a/tutorials/pipeline/1_basics.py +++ b/tutorials/pipeline/1_basics.py @@ -7,7 +7,7 @@ Here, `__call__` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run)) method is used to execute pipeline once. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/2_pre_and_post_processors.py b/tutorials/pipeline/2_pre_and_post_processors.py index 901265426..16bff81d6 100644 --- a/tutorials/pipeline/2_pre_and_post_processors.py +++ b/tutorials/pipeline/2_pre_and_post_processors.py @@ -7,7 +7,7 @@ Here, [MISC](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.context.html#dff.script.core.context.Context.misc) dictionary of context is used for storing message additional data. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py index 7203d0270..e81c4bddd 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py @@ -10,7 +10,7 @@ Pipeline [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict) static method can be used for pipeline creation (from dictionary). -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_full.py b/tutorials/pipeline/3_pipeline_dict_with_services_full.py index 060fccb61..2f800fca8 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_full.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_full.py @@ -10,7 +10,7 @@ Pipeline [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict) static method can be used for pipeline creation (from dictionary). -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/4_groups_and_conditions_basic.py b/tutorials/pipeline/4_groups_and_conditions_basic.py index 195d772bb..34b63d682 100644 --- a/tutorials/pipeline/4_groups_and_conditions_basic.py +++ b/tutorials/pipeline/4_groups_and_conditions_basic.py @@ -7,7 +7,7 @@ Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#dff.pipeline.service.service.Service)s and [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s are shown for advanced data pre- and postprocessing based on conditions. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/4_groups_and_conditions_full.py b/tutorials/pipeline/4_groups_and_conditions_full.py index 2770d336a..b0a6b5562 100644 --- a/tutorials/pipeline/4_groups_and_conditions_full.py +++ b/tutorials/pipeline/4_groups_and_conditions_full.py @@ -7,7 +7,7 @@ Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#dff.pipeline.service.service.Service)s and [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s are shown for advanced data pre- and postprocessing based on conditions. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py b/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py index de471514f..a1e3ca701 100644 --- a/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py +++ b/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py @@ -7,7 +7,7 @@ Here, [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s are shown for advanced and asynchronous data pre- and postprocessing. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/5_asynchronous_groups_and_services_full.py b/tutorials/pipeline/5_asynchronous_groups_and_services_full.py index 418ee69b3..d8c0dfda2 100644 --- a/tutorials/pipeline/5_asynchronous_groups_and_services_full.py +++ b/tutorials/pipeline/5_asynchronous_groups_and_services_full.py @@ -7,7 +7,7 @@ Here, [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s are shown for advanced and asynchronous data pre- and postprocessing. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/6_custom_messenger_interface.py b/tutorials/pipeline/6_custom_messenger_interface.py index 09b076d14..7a39cf079 100644 --- a/tutorials/pipeline/6_custom_messenger_interface.py +++ b/tutorials/pipeline/6_custom_messenger_interface.py @@ -7,7 +7,7 @@ Here, [CallbackMessengerInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.interface.html#dff.messengers.telegram.interface.CallbackTelegramInterface) and [PollingMessengerInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.interface.html#dff.messengers.telegram.interface.PollingTelegramInterface) are shown as alternatives for connection to custom user messenger backends. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/7_extra_handlers_basic.py b/tutorials/pipeline/7_extra_handlers_basic.py index 7feac7468..895576e20 100644 --- a/tutorials/pipeline/7_extra_handlers_basic.py +++ b/tutorials/pipeline/7_extra_handlers_basic.py @@ -7,7 +7,7 @@ Here, extra handlers [BeforeHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.BeforeHandler) and [AfterHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.AfterHandler) are shown as additional means of data processing, attached to services. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/7_extra_handlers_full.py b/tutorials/pipeline/7_extra_handlers_full.py index 4c1d56d59..419207229 100644 --- a/tutorials/pipeline/7_extra_handlers_full.py +++ b/tutorials/pipeline/7_extra_handlers_full.py @@ -7,7 +7,7 @@ Here, extra handlers [BeforeHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.BeforeHandler) and [AfterHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.AfterHandler) are shown as additional means of data processing, attached to services. -""" +""" # noqa: E501 # %% diff --git a/tutorials/pipeline/8_extra_handlers_and_extensions.py b/tutorials/pipeline/8_extra_handlers_and_extensions.py index e8a846e93..b1ba4ec7b 100644 --- a/tutorials/pipeline/8_extra_handlers_and_extensions.py +++ b/tutorials/pipeline/8_extra_handlers_and_extensions.py @@ -7,7 +7,7 @@ Here, [add_global_handler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.add_global_handler) function is shown, that can be used to add extra handlers before and/or after all pipeline services. -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/core/1_basics.py b/tutorials/script/core/1_basics.py index d04b0f750..01a96f3f0 100644 --- a/tutorials/script/core/1_basics.py +++ b/tutorials/script/core/1_basics.py @@ -12,7 +12,7 @@ that can be used for Pipeline testing is presented. Let's do all the necessary imports from DFF: -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/core/2_conditions.py b/tutorials/script/core/2_conditions.py index edbaf2047..3481ae847 100644 --- a/tutorials/script/core/2_conditions.py +++ b/tutorials/script/core/2_conditions.py @@ -6,10 +6,10 @@ setting transition conditions from one node to another. Here, [conditions](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.conditions.std_conditions.html#conditions) -for script transitions are shown. +for script transitions are shown. First of all, let's do all the necessary imports from DFF. -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/core/3_responses.py b/tutorials/script/core/3_responses.py index 13a1f3a5e..10c724539 100644 --- a/tutorials/script/core/3_responses.py +++ b/tutorials/script/core/3_responses.py @@ -5,10 +5,10 @@ This tutorial shows different options for setting responses. Here, [responses](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.responses.std_responses.html#responses) -that allow returning answers to user from script are shown. +that allow returning answers to user from script are shown. Let's do all the necessary imports from DFF. -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/core/4_transitions.py b/tutorials/script/core/4_transitions.py index 7d0a657c3..419ca1c3e 100644 --- a/tutorials/script/core/4_transitions.py +++ b/tutorials/script/core/4_transitions.py @@ -10,7 +10,7 @@ Some of the destination steps can be set using [labels](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.labels.std_labels.html#labels). First of all, let's do all the necessary imports from DFF. -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/core/5_global_transitions.py b/tutorials/script/core/5_global_transitions.py index e72437404..dd22b8dd6 100644 --- a/tutorials/script/core/5_global_transitions.py +++ b/tutorials/script/core/5_global_transitions.py @@ -8,7 +8,7 @@ for default transition between many different script steps are shown. First of all, let's do all the necessary imports from DFF. -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/core/6_context_serialization.py b/tutorials/script/core/6_context_serialization.py index 87a7fcca0..df5cdf4d3 100644 --- a/tutorials/script/core/6_context_serialization.py +++ b/tutorials/script/core/6_context_serialization.py @@ -4,7 +4,7 @@ This tutorial shows context serialization. First of all, let's do all the necessary imports from DFF. -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/core/7_pre_response_processing.py b/tutorials/script/core/7_pre_response_processing.py index e78d86f34..14bb9a1b6 100644 --- a/tutorials/script/core/7_pre_response_processing.py +++ b/tutorials/script/core/7_pre_response_processing.py @@ -8,7 +8,7 @@ that can be used for additional context processing before response is shown. First of all, let's do all the necessary imports from DFF. -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/core/8_misc.py b/tutorials/script/core/8_misc.py index 29198af1e..531b9dfaf 100644 --- a/tutorials/script/core/8_misc.py +++ b/tutorials/script/core/8_misc.py @@ -8,7 +8,7 @@ that can be used for user data storage inside of a context is shown. First of all, let's do all the necessary imports from DFF. -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/core/9_pre_transitions_processing.py b/tutorials/script/core/9_pre_transitions_processing.py index c06c8f148..82e9a7506 100644 --- a/tutorials/script/core/9_pre_transitions_processing.py +++ b/tutorials/script/core/9_pre_transitions_processing.py @@ -8,7 +8,7 @@ that can be used for additional context processing before transitioning to the next step is shown. First of all, let's do all the necessary imports from DFF. -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/responses/1_basics.py b/tutorials/script/responses/1_basics.py index bcb1d9129..bf89e0503 100644 --- a/tutorials/script/responses/1_basics.py +++ b/tutorials/script/responses/1_basics.py @@ -6,8 +6,7 @@ Special keywords [RESPONSE](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.RESPONSE) and [TRANSITIONS](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.TRANSITIONS) are used for that. - -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/responses/2_buttons.py b/tutorials/script/responses/2_buttons.py index 9e81c1f0f..ced6e2f66 100644 --- a/tutorials/script/responses/2_buttons.py +++ b/tutorials/script/responses/2_buttons.py @@ -5,8 +5,7 @@ Here, [Button](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Button) class is shown. Buttons are special response decorations (just like other [element](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message)s) They can be attached to any message and will have different forms in differend messengers (implementation-defined). - -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/responses/3_media.py b/tutorials/script/responses/3_media.py index 6f8b7df7d..df597325b 100644 --- a/tutorials/script/responses/3_media.py +++ b/tutorials/script/responses/3_media.py @@ -8,8 +8,7 @@ class is shown. Attachments can be used for attaching different media elements [Document](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Document) or [Audio](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Audio)) can be used. They can be attached to any message and will have different forms in differend messengers (implementation-defined). - -""" +""" # noqa: E501 # %% diff --git a/tutorials/script/responses/4_multi_message.py b/tutorials/script/responses/4_multi_message.py index f35c76e1c..6f078353e 100644 --- a/tutorials/script/responses/4_multi_message.py +++ b/tutorials/script/responses/4_multi_message.py @@ -8,7 +8,7 @@ represents a combination of several messages. Let's do all the necessary imports from DFF. -""" +""" # noqa: E501 # %% From a14a87aadd3decb54081eb060b51f5706171caf2 Mon Sep 17 00:00:00 2001 From: pseusys Date: Fri, 23 Jun 2023 13:26:09 +0200 Subject: [PATCH 06/21] tutorial format test fixed --- tests/tutorials/test_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tutorials/test_format.py b/tests/tutorials/test_format.py index 8ac0c11fe..acf7b778c 100644 --- a/tests/tutorials/test_format.py +++ b/tests/tutorials/test_format.py @@ -13,7 +13,7 @@ re.compile(r"# %%\n"), # check python block ] -start_pattern = re.compile(r'# %% \[markdown\]\n"""\n#(?: .*:)? \d+\. .*\n\n(?:[\S\s]*\n)?"""\n') +start_pattern = re.compile(r'# %% \[markdown\]\n"""\n#(?: .*:)? \d+\. .*\n\n(?:[\S\s]*\n)?""".*\n') def regexp_format_checker(dff_tutorial_py_file: pathlib.Path): From 8f6b5673374472d287a81adb5c2521b6d8db8ec7 Mon Sep 17 00:00:00 2001 From: pseusys Date: Wed, 26 Jul 2023 16:09:00 +0200 Subject: [PATCH 07/21] tests fixed --- tests/tutorials/test_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tutorials/test_format.py b/tests/tutorials/test_format.py index 29bbbd639..772a059bd 100644 --- a/tests/tutorials/test_format.py +++ b/tests/tutorials/test_format.py @@ -13,7 +13,7 @@ re.compile(r"# %%\n"), # check python block ] -docstring_start_pattern = re.compile(r'# %% \[markdown\]\n"""\n#(?: .*:)? \d+\. .*\n(?:\n[\S\s]*)?"""\n') +docstring_start_pattern = re.compile(r'# %% \[markdown\]\n"""\n#(?: .*:)? \d+\. .*\n(?:\n[\S\s]*)?"""(?: # .*)?\n') comment_start_pattern = re.compile(r'# %% \[markdown\]\n# #(?: .*:)? \d+\. .*\n#(?:\n# [\S\s]*)?') From 1d233d02547c7ec411627b3f35ccd131b4c84103 Mon Sep 17 00:00:00 2001 From: pseusys Date: Wed, 2 Aug 2023 19:30:14 +0200 Subject: [PATCH 08/21] problems mentioned in review (partly) fixed --- docs/source/utils/notebook.py | 10 +++++----- tutorials/context_storages/1_basics.py | 2 +- tutorials/context_storages/2_postgresql.py | 4 ++-- tutorials/messengers/telegram/1_basic.py | 2 +- tutorials/messengers/telegram/4_conditions.py | 9 ++------- .../messengers/telegram/5_conditions_with_media.py | 6 ++---- tutorials/messengers/telegram/6_conditions_extras.py | 10 +--------- tutorials/messengers/telegram/7_polling_setup.py | 4 ++-- tutorials/messengers/web_api_interface/1_fastapi.py | 2 +- .../messengers/web_api_interface/2_websocket_chat.py | 2 +- tutorials/pipeline/2_pre_and_post_processors.py | 4 ++-- .../pipeline/3_pipeline_dict_with_services_basic.py | 4 ++-- .../pipeline/3_pipeline_dict_with_services_full.py | 6 +----- tutorials/pipeline/7_extra_handlers_full.py | 2 +- tutorials/script/core/3_responses.py | 2 +- tutorials/script/core/6_context_serialization.py | 2 +- tutorials/script/core/7_pre_response_processing.py | 2 +- tutorials/script/core/8_misc.py | 4 ++-- tutorials/script/core/9_pre_transitions_processing.py | 2 +- tutorials/script/responses/2_buttons.py | 7 ++++--- tutorials/script/responses/3_media.py | 4 ++-- tutorials/utils/1_cache.py | 4 ++-- 22 files changed, 38 insertions(+), 56 deletions(-) diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index 28fcc39b3..f2ccbe6b2 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -17,13 +17,13 @@ def inner(tutorial_text: str): \"\"\" __Installing dependencies__ -The cell below installs dff with dependencies for running tutorials -To install the minimal version of dff, use `pip install dff` +The cell below installs dff with dependencies for running tutorials. +To install the minimal version of dff, use `pip install dff`. To install other options of dff, use `pip install dff[OPTION_NAME1,OPTION_NAME2]` where OPTION_NAME can be one of the options from EXTRA_DEPENDENCIES. -e.g `pip install dff[ydb, mysql]` installs dff with dependencies for using Yandex Database and MySQL -EXTRA_DEPENDENCIES can be found in -[here](https://github.com/deeppavlov/dialog_flow_framework/blob/dev/README.md#installation) +e.g `pip install dff[ydb, mysql]` installs dff with dependencies for using Yandex Database and MySQL. +EXTRA_DEPENDENCIES can be found +[here](https://github.com/deeppavlov/dialog_flow_framework/blob/dev/README.md#installation). \"\"\" # %% diff --git a/tutorials/context_storages/1_basics.py b/tutorials/context_storages/1_basics.py index 555048ed6..288c914de 100644 --- a/tutorials/context_storages/1_basics.py +++ b/tutorials/context_storages/1_basics.py @@ -5,7 +5,7 @@ The following tutorial shows the basic use of the database connection. See [context_storage_factory](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.database.html#dff.context_storages.database.context_storage_factory) function -for creating a context storage factory by path. +for creating a context storage by path. In this example JSON file is used as a storage. """ # noqa: E501 diff --git a/tutorials/context_storages/2_postgresql.py b/tutorials/context_storages/2_postgresql.py index 3b15f33e8..fc41193d6 100644 --- a/tutorials/context_storages/2_postgresql.py +++ b/tutorials/context_storages/2_postgresql.py @@ -5,9 +5,9 @@ This is a tutorial on using PostgreSQL. See [SQLContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class -for storing you users' contexts in SQL databases. +for storing your users' contexts in SQL databases. -The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncpg](https://magicstack.github.io/asyncpg/current/) +DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncpg](https://magicstack.github.io/asyncpg/current/) libraries for asynchronous access to PostgreSQL DB. """ # noqa: E501 diff --git a/tutorials/messengers/telegram/1_basic.py b/tutorials/messengers/telegram/1_basic.py index d0828d854..e27ee0677 100644 --- a/tutorials/messengers/telegram/1_basic.py +++ b/tutorials/messengers/telegram/1_basic.py @@ -8,7 +8,7 @@ Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface) class and [telebot](https://pytba.readthedocs.io/en/latest/index.html) library are used for accessing telegram API in polling mode. -Telegram API token is used for access telegram API. +Telegram API token is required to access telegram API. """ # noqa: E501 diff --git a/tutorials/messengers/telegram/4_conditions.py b/tutorials/messengers/telegram/4_conditions.py index d3fa711d2..89934fd25 100644 --- a/tutorials/messengers/telegram/4_conditions.py +++ b/tutorials/messengers/telegram/4_conditions.py @@ -5,13 +5,8 @@ This tutorial shows how to process Telegram updates in your script and reuse handler triggers from the `pytelegrambotapi` library. -Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) -class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and -[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) -classes are used for configuring additional telegram message features. - -Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) -classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. +Here, [telegram_condition](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.telegram_condition) +function is used for graph navigation according to Telegram events. """ # noqa: E501 diff --git a/tutorials/messengers/telegram/5_conditions_with_media.py b/tutorials/messengers/telegram/5_conditions_with_media.py index 35cc32671..ed600c1c2 100644 --- a/tutorials/messengers/telegram/5_conditions_with_media.py +++ b/tutorials/messengers/telegram/5_conditions_with_media.py @@ -4,10 +4,8 @@ This tutorial shows how to use media-related logic in your script. -Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) -class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and -[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) -classes are used for configuring additional telegram message features. +Here, [telegram_condition](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.telegram_condition) +function is used for graph navigation according to Telegram events. Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. diff --git a/tutorials/messengers/telegram/6_conditions_extras.py b/tutorials/messengers/telegram/6_conditions_extras.py index 9224cf956..1cbed23c1 100644 --- a/tutorials/messengers/telegram/6_conditions_extras.py +++ b/tutorials/messengers/telegram/6_conditions_extras.py @@ -5,17 +5,9 @@ This tutorial shows how to use additional update filters inherited from the `pytelegrambotapi` library. -Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) -class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and -[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) -classes are used for configuring additional telegram message features. - -Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) -classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. - [telegram_condition](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.telegram_condition) function and different types of [UpdateType](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.UpdateType) -can be used for telegram message type checking. +are used for telegram message type checking. """ # noqa: E501 diff --git a/tutorials/messengers/telegram/7_polling_setup.py b/tutorials/messengers/telegram/7_polling_setup.py index 661af8d6a..c19107e7d 100644 --- a/tutorials/messengers/telegram/7_polling_setup.py +++ b/tutorials/messengers/telegram/7_polling_setup.py @@ -4,8 +4,8 @@ The following tutorial shows how to configure `PollingTelegramInterface`. -Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface) -and its' different parameters are shown. +See [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface) +for more information. """ # noqa: E501 diff --git a/tutorials/messengers/web_api_interface/1_fastapi.py b/tutorials/messengers/web_api_interface/1_fastapi.py index 237ef92f0..af713dd20 100644 --- a/tutorials/messengers/web_api_interface/1_fastapi.py +++ b/tutorials/messengers/web_api_interface/1_fastapi.py @@ -10,7 +10,7 @@ method is used to execute pipeline once. [Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) -is used to represent incoming to pipeline data. +is used in creating a JSON Schema for the endpoint. """ # noqa: E501 diff --git a/tutorials/messengers/web_api_interface/2_websocket_chat.py b/tutorials/messengers/web_api_interface/2_websocket_chat.py index 29341caeb..bc23a444b 100644 --- a/tutorials/messengers/web_api_interface/2_websocket_chat.py +++ b/tutorials/messengers/web_api_interface/2_websocket_chat.py @@ -19,7 +19,7 @@ method is used to execute pipeline once. [Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) -is used to represent incoming to pipeline data. +is used to represent text messages. """ # noqa: E501 diff --git a/tutorials/pipeline/2_pre_and_post_processors.py b/tutorials/pipeline/2_pre_and_post_processors.py index 16bff81d6..216bc4f68 100644 --- a/tutorials/pipeline/2_pre_and_post_processors.py +++ b/tutorials/pipeline/2_pre_and_post_processors.py @@ -5,8 +5,8 @@ The following tutorial shows more advanced usage of `pipeline` module as an extension to `dff.script.core`. -Here, [MISC](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.context.html#dff.script.core.context.Context.misc) -dictionary of context is used for storing message additional data. +Here, [misc](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.context.html#dff.script.core.context.Context.misc) +dictionary of context is used for storing additional data. """ # noqa: E501 diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py index e81c4bddd..bc92486d2 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py @@ -8,8 +8,8 @@ Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#service) class, that can be used for pre- and postprocessing of messages is shown. -Pipeline [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict) -static method can be used for pipeline creation (from dictionary). +Pipeline's [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict) +static method is used for pipeline creation (from dictionary). """ # noqa: E501 diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_full.py b/tutorials/pipeline/3_pipeline_dict_with_services_full.py index ac6ce11fa..16c03eaa9 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_full.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_full.py @@ -5,11 +5,7 @@ The following tutorial shows `pipeline` creation from dict and most important pipeline components. -Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#service) -class, that can be used for some more complex pre- and postprocessing of messages is shown. - -Pipeline [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict) -static method can be used for pipeline creation (from dictionary). +This tutorial is a more advanced version of the [previous tutorial](./tutorials.pipeline.3_pipeline_dict_with_services_basic.html). """ # noqa: E501 diff --git a/tutorials/pipeline/7_extra_handlers_full.py b/tutorials/pipeline/7_extra_handlers_full.py index 6e3154831..9bd3c63ab 100644 --- a/tutorials/pipeline/7_extra_handlers_full.py +++ b/tutorials/pipeline/7_extra_handlers_full.py @@ -1,6 +1,6 @@ # %% [markdown] """ -# 7. Extra Handlers (basic) +# 7. Extra Handlers (full) The following tutorial shows extra handlers possibilities and use cases. diff --git a/tutorials/script/core/3_responses.py b/tutorials/script/core/3_responses.py index 10c724539..f5936c672 100644 --- a/tutorials/script/core/3_responses.py +++ b/tutorials/script/core/3_responses.py @@ -5,7 +5,7 @@ This tutorial shows different options for setting responses. Here, [responses](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.responses.std_responses.html#responses) -that allow returning answers to user from script are shown. +that allow giving custom answers to users are shown. Let's do all the necessary imports from DFF. """ # noqa: E501 diff --git a/tutorials/script/core/6_context_serialization.py b/tutorials/script/core/6_context_serialization.py index df5cdf4d3..87a7fcca0 100644 --- a/tutorials/script/core/6_context_serialization.py +++ b/tutorials/script/core/6_context_serialization.py @@ -4,7 +4,7 @@ This tutorial shows context serialization. First of all, let's do all the necessary imports from DFF. -""" # noqa: E501 +""" # %% diff --git a/tutorials/script/core/7_pre_response_processing.py b/tutorials/script/core/7_pre_response_processing.py index 14bb9a1b6..5f6ff5c04 100644 --- a/tutorials/script/core/7_pre_response_processing.py +++ b/tutorials/script/core/7_pre_response_processing.py @@ -5,7 +5,7 @@ This tutorial shows pre-response processing feature. Here, [PRE_RESPONSE_PROCESSING](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.PRE_RESPONSE_PROCESSING) -that can be used for additional context processing before response is shown. +is demonstrated which can be used for additional context processing before response handlers. First of all, let's do all the necessary imports from DFF. """ # noqa: E501 diff --git a/tutorials/script/core/8_misc.py b/tutorials/script/core/8_misc.py index 531b9dfaf..69c4d2ab3 100644 --- a/tutorials/script/core/8_misc.py +++ b/tutorials/script/core/8_misc.py @@ -4,8 +4,8 @@ This tutorial shows `MISC` (miscellaneous) keyword usage. -Here, [MISC](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.MISC) -that can be used for user data storage inside of a context is shown. +See [MISC](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.MISC) +for more information. First of all, let's do all the necessary imports from DFF. """ # noqa: E501 diff --git a/tutorials/script/core/9_pre_transitions_processing.py b/tutorials/script/core/9_pre_transitions_processing.py index 82e9a7506..606cf3cd2 100644 --- a/tutorials/script/core/9_pre_transitions_processing.py +++ b/tutorials/script/core/9_pre_transitions_processing.py @@ -5,7 +5,7 @@ This tutorial shows pre-transitions processing feature. Here, [PRE_TRANSITIONS_PROCESSING](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.PRE_TRANSITIONS_PROCESSING) -that can be used for additional context processing before transitioning to the next step is shown. +is demonstrated which can be used for additional context processing before transitioning to the next step. First of all, let's do all the necessary imports from DFF. """ # noqa: E501 diff --git a/tutorials/script/responses/2_buttons.py b/tutorials/script/responses/2_buttons.py index ced6e2f66..30ce59da4 100644 --- a/tutorials/script/responses/2_buttons.py +++ b/tutorials/script/responses/2_buttons.py @@ -2,9 +2,10 @@ """ # Responses: 2. Buttons -Here, [Button](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Button) -class is shown. Buttons are special response decorations (just like other [element](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message)s) -They can be attached to any message and will have different forms in differend messengers (implementation-defined). +In this tutorial [Button](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Button) +class is demonstrated. +Buttons are one of [Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) fields. +They can be attached to any message but will only work if the chosen [messenger interface](https://deeppavlov.github.io/dialog_flow_framework/apiref/index_messenger_interfaces.html) supports them. """ # noqa: E501 diff --git a/tutorials/script/responses/3_media.py b/tutorials/script/responses/3_media.py index df597325b..3c55416ec 100644 --- a/tutorials/script/responses/3_media.py +++ b/tutorials/script/responses/3_media.py @@ -6,8 +6,8 @@ class is shown. Attachments can be used for attaching different media elements (such as [Image](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Image), [Document](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Document) -or [Audio](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Audio)) -can be used. They can be attached to any message and will have different forms in differend messengers (implementation-defined). +or [Audio](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Audio)). +They can be attached to any message but will only work if the chosen [messenger interface](https://deeppavlov.github.io/dialog_flow_framework/apiref/index_messenger_interfaces.html) supports them. """ # noqa: E501 diff --git a/tutorials/utils/1_cache.py b/tutorials/utils/1_cache.py index 06512ae78..27f8f1909 100644 --- a/tutorials/utils/1_cache.py +++ b/tutorials/utils/1_cache.py @@ -2,10 +2,10 @@ """ # 1. Cache -# TODO: no entry in documentation! - """ +# TODO: no entry in documentation! + # %% from dff.script.conditions import true From b35b6ed6be5ce6772ecddd305dd0b156c0e1241f Mon Sep 17 00:00:00 2001 From: pseusys Date: Wed, 2 Aug 2023 19:41:01 +0200 Subject: [PATCH 09/21] two more fixes --- tutorials/messengers/telegram/8_webhook_setup.py | 4 ++-- tutorials/script/core/7_pre_response_processing.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tutorials/messengers/telegram/8_webhook_setup.py b/tutorials/messengers/telegram/8_webhook_setup.py index ebef8e500..737b6e9b9 100644 --- a/tutorials/messengers/telegram/8_webhook_setup.py +++ b/tutorials/messengers/telegram/8_webhook_setup.py @@ -5,8 +5,8 @@ The following tutorial shows how to use `CallbackTelegramInterface` that makes your bot accessible through a public webhook. -Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.CallbackMessengerInterface) -is used for accessing telegram API in callback mode. +See [CallbackMessengerInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.CallbackMessengerInterface) +for more information. """ # noqa: E501 diff --git a/tutorials/script/core/7_pre_response_processing.py b/tutorials/script/core/7_pre_response_processing.py index 5f6ff5c04..09ac13de0 100644 --- a/tutorials/script/core/7_pre_response_processing.py +++ b/tutorials/script/core/7_pre_response_processing.py @@ -7,6 +7,10 @@ Here, [PRE_RESPONSE_PROCESSING](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.PRE_RESPONSE_PROCESSING) is demonstrated which can be used for additional context processing before response handlers. +There are also some other +[Keywords](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords) +worth attention used in this tutorial. + First of all, let's do all the necessary imports from DFF. """ # noqa: E501 From 3f33130310e5ff99949be03eb1e8ccaa77ea849c Mon Sep 17 00:00:00 2001 From: pseusys Date: Fri, 18 Aug 2023 09:40:47 +0200 Subject: [PATCH 10/21] added to merge --- tutorials/utils/2_lru_cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/utils/2_lru_cache.py b/tutorials/utils/2_lru_cache.py index 6bc31328b..1e0c94ca3 100644 --- a/tutorials/utils/2_lru_cache.py +++ b/tutorials/utils/2_lru_cache.py @@ -2,10 +2,10 @@ """ # 2. LRU Cache -# TODO: no entry in documentation! - """ +# TODO: no entry in documentation! + # %pip install dff # %% From 2921fb7f50a85793284a5978584b7956ad0fa1ca Mon Sep 17 00:00:00 2001 From: pseusys Date: Fri, 18 Aug 2023 13:58:28 +0200 Subject: [PATCH 11/21] correct and unbroken links added to documentation --- docs/source/utils/notebook.py | 45 +++++++++++++++++-- tutorials/context_storages/1_basics.py | 4 +- tutorials/context_storages/2_postgresql.py | 7 +-- tutorials/context_storages/3_mongodb.py | 7 +-- tutorials/context_storages/4_redis.py | 7 +-- tutorials/context_storages/5_mysql.py | 7 +-- tutorials/context_storages/6_sqlite.py | 7 +-- .../context_storages/7_yandex_database.py | 7 +-- tutorials/messengers/telegram/1_basic.py | 7 +-- tutorials/messengers/telegram/2_buttons.py | 14 +++--- .../telegram/3_buttons_with_callback.py | 14 +++--- tutorials/messengers/telegram/4_conditions.py | 4 +- .../telegram/5_conditions_with_media.py | 9 ++-- .../telegram/6_conditions_extras.py | 6 +-- .../messengers/telegram/7_polling_setup.py | 4 +- .../messengers/telegram/8_webhook_setup.py | 4 +- .../messengers/web_api_interface/1_fastapi.py | 7 ++- .../web_api_interface/2_websocket_chat.py | 7 ++- tutorials/pipeline/1_basics.py | 4 +- .../pipeline/2_pre_and_post_processors.py | 4 +- .../3_pipeline_dict_with_services_basic.py | 6 +-- .../3_pipeline_dict_with_services_full.py | 5 ++- .../pipeline/4_groups_and_conditions_basic.py | 6 +-- .../pipeline/4_groups_and_conditions_full.py | 7 ++- ..._asynchronous_groups_and_services_basic.py | 4 +- ...5_asynchronous_groups_and_services_full.py | 6 +-- .../pipeline/6_custom_messenger_interface.py | 6 +-- tutorials/pipeline/7_extra_handlers_basic.py | 6 +-- tutorials/pipeline/7_extra_handlers_full.py | 7 ++- .../8_extra_handlers_and_extensions.py | 7 +-- tutorials/script/core/1_basics.py | 9 ++-- tutorials/script/core/2_conditions.py | 4 +- tutorials/script/core/3_responses.py | 4 +- tutorials/script/core/4_transitions.py | 7 +-- tutorials/script/core/5_global_transitions.py | 4 +- .../script/core/7_pre_response_processing.py | 7 ++- tutorials/script/core/8_misc.py | 4 +- .../core/9_pre_transitions_processing.py | 7 +-- tutorials/script/responses/1_basics.py | 6 +-- tutorials/script/responses/2_buttons.py | 9 ++-- tutorials/script/responses/3_media.py | 15 ++++--- tutorials/script/responses/4_multi_message.py | 5 +-- tutorials/utils/1_cache.py | 3 +- tutorials/utils/2_lru_cache.py | 3 +- 44 files changed, 186 insertions(+), 136 deletions(-) diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index 587faeba1..6acb347eb 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -59,7 +59,7 @@ def replacement_string(matchobj: re.Match) -> str: return f""" # %% # installing dependencies -%pip install -q {matchobj.group(1)} +!pip install -q {matchobj.group(1)} """ @@ -129,7 +129,8 @@ def link_to_doc_page( A link to the corresponding documentation part. """ if page_type == "api": - return f"../apiref/dff.{page}.rst" + (f"#dff.{page}.{anchor}" if anchor is not None else "") + prefix = "" if page.startswith("index") else "dff." + return f"../apiref/{prefix}{page}.rst" + (f"#{prefix}{page}.{anchor}" if anchor is not None else "") elif page_type == "tutorial": return f"../tutorials/tutorials.{page}.py" + (f"#{anchor}" if anchor is not None else "") elif page_type == "guide": @@ -141,8 +142,46 @@ def replacement_string(matchobj: re.Match) -> str: return DocumentationLink.link_to_doc_page(*args) +class MarkdownDocumentationLink(DocumentationLink): + """ + Replace documentation linking directives with markdown-style links. + + Replace strings of the `%mddoclink({args})` format with corresponding links to local files. + + `args` is a comma-separated string of arguments to pass to the :py:meth:`.DocumentationLink.link_to_doc_page`. + + So, `%mddoclink(arg1,arg2,arg3)` will be replaced with `[text](link_to_doc_page(arg1, arg2, arg3))`, and + `%doclink(arg1,arg2)` will be replaced with `[text](link_to_doc_page(arg1, arg2))` with `text` being the last + path segment of `arg2` or `arg3` (if present). + + USAGE EXAMPLES + -------------- + + [script](%doclink(api,script.core.script)) + + [Node](%doclink(api,script.core.script,Node)) + + [4_streamlit_chat](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) + + [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration)) + + [basic_conceptions](%doclink(guide,basic_conceptions)) + + [example-conversational-chat-bot](%doclink(guide,basic_conceptions,example-conversational-chat-bot)) + + """ + + pattern: ClassVar[re.Pattern] = re.compile(r"%mddoclink\((.+?)\)") + + @staticmethod + def replacement_string(matchobj: re.Match) -> str: + args = matchobj.group(1).split(",") + link_text = args[-1].split(".")[-1] + return f"[{link_text}]({DocumentationLink.link_to_doc_page(*args)})" + + def apply_replace_patterns(text: str) -> str: - for cls in (InstallationCell, DocumentationLink): + for cls in (InstallationCell, DocumentationLink, MarkdownDocumentationLink): text = cls.replace(text) return text diff --git a/tutorials/context_storages/1_basics.py b/tutorials/context_storages/1_basics.py index 418100bf8..08cb4aee4 100644 --- a/tutorials/context_storages/1_basics.py +++ b/tutorials/context_storages/1_basics.py @@ -4,11 +4,11 @@ The following tutorial shows the basic use of the database connection. -See [context_storage_factory](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.database.html#dff.context_storages.database.context_storage_factory) function +See %mddoclink(api,context_storages.database,context_storage_factory) function for creating a context storage by path. In this example JSON file is used as a storage. -""" # noqa: E501 +""" # %pip install dff[json,pickle] diff --git a/tutorials/context_storages/2_postgresql.py b/tutorials/context_storages/2_postgresql.py index ae2d1101f..b7e7a547f 100644 --- a/tutorials/context_storages/2_postgresql.py +++ b/tutorials/context_storages/2_postgresql.py @@ -4,12 +4,13 @@ This is a tutorial on using PostgreSQL. -See [SQLContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class +See %mddoclink(api,context_storages.sql,SQLContextStorage) class for storing your users' contexts in SQL databases. -DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncpg](https://magicstack.github.io/asyncpg/current/) +DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) +and [asyncpg](https://magicstack.github.io/asyncpg/current/) libraries for asynchronous access to PostgreSQL DB. -""" # noqa: E501 +""" # %pip install dff[postgresql] diff --git a/tutorials/context_storages/3_mongodb.py b/tutorials/context_storages/3_mongodb.py index cb145ae3d..0221657bc 100644 --- a/tutorials/context_storages/3_mongodb.py +++ b/tutorials/context_storages/3_mongodb.py @@ -4,11 +4,12 @@ This is a tutorial on using MongoDB. -See [MongoContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.mongo.html#mongo) class +See %mddoclink(api,context_storages.mongo,MongoContextStorage) class for storing you users' contexts in Mongo database. -The DFF uses [motor](https://motor.readthedocs.io/en/stable/) library for asynchronous access to MongoDB. -""" # noqa: E501 +The DFF uses [motor](https://motor.readthedocs.io/en/stable/) +library for asynchronous access to MongoDB. +""" # %pip install dff[mongodb] diff --git a/tutorials/context_storages/4_redis.py b/tutorials/context_storages/4_redis.py index 7e248c333..2ea96eec7 100644 --- a/tutorials/context_storages/4_redis.py +++ b/tutorials/context_storages/4_redis.py @@ -4,11 +4,12 @@ This is a tutorial on using Redis. -See [RedisContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.redis.html#redis) class +See %mddoclink(api,context_storages.redis,RedisContextStorage) class for storing you users' contexts in Redis database. -The DFF uses [redis.asyncio](https://redis.readthedocs.io/en/latest/) library for asynchronous access to Redis DB. -""" # noqa: E501 +The DFF uses [redis.asyncio](https://redis.readthedocs.io/en/latest/) +library for asynchronous access to Redis DB. +""" # %pip install dff[redis] diff --git a/tutorials/context_storages/5_mysql.py b/tutorials/context_storages/5_mysql.py index 69f7bafa7..8c63208af 100644 --- a/tutorials/context_storages/5_mysql.py +++ b/tutorials/context_storages/5_mysql.py @@ -4,12 +4,13 @@ This is a tutorial on using MySQL. -See [MySQL](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class +See %mddoclink(api,context_storages.sql,SQLContextStorage) class for storing you users' contexts in SQL databases. -The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncmy](https://github.com/long2ice/asyncmy) +The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) +and [asyncmy](https://github.com/long2ice/asyncmy) libraries for asynchronous access to MySQL DB. -""" # noqa: E501 +""" # %pip install dff[mysql] diff --git a/tutorials/context_storages/6_sqlite.py b/tutorials/context_storages/6_sqlite.py index 4bc184d7d..f7d47a13d 100644 --- a/tutorials/context_storages/6_sqlite.py +++ b/tutorials/context_storages/6_sqlite.py @@ -4,14 +4,15 @@ This is a tutorial on using SQLite. -See [SQLite](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class +See %mddoclink(api,context_storages.sql,SQLContextStorage) class for storing you users' contexts in SQL databases. -The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [aiosqlite](https://readthedocs.org/projects/aiosqlite/) +The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) +and [aiosqlite](https://readthedocs.org/projects/aiosqlite/) libraries for asynchronous access to SQLite DB. Note that protocol separator for windows differs from one for linux. -""" # noqa: E501 +""" # %pip install dff[sqlite] diff --git a/tutorials/context_storages/7_yandex_database.py b/tutorials/context_storages/7_yandex_database.py index 8dd13e6e6..3099b86db 100644 --- a/tutorials/context_storages/7_yandex_database.py +++ b/tutorials/context_storages/7_yandex_database.py @@ -4,11 +4,12 @@ This is a tutorial on how to use Yandex DataBase. -See [YDB](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.ydb.html#yandex-db) class +See %mddoclink(api,context_storages.ydb,YDBContextStorage) class for storing you users' contexts in Yandex database. -The DFF uses [ydb.aio](https://ydb.tech/en/docs/) library for asynchronous access to Yandex DB. -""" # noqa: E501 +The DFF uses [ydb.aio](https://ydb.tech/en/docs/) +library for asynchronous access to Yandex DB. +""" # %pip install dff[ydb] diff --git a/tutorials/messengers/telegram/1_basic.py b/tutorials/messengers/telegram/1_basic.py index 6c20ba7bc..8f124e4ed 100644 --- a/tutorials/messengers/telegram/1_basic.py +++ b/tutorials/messengers/telegram/1_basic.py @@ -5,11 +5,12 @@ The following tutorial shows how to run a regular DFF script in Telegram. It asks users for the '/start' command and then loops in one place. -Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface) -class and [telebot](https://pytba.readthedocs.io/en/latest/index.html) library are used for accessing telegram API in polling mode. +Here, %mddoclink(api,messengers.telegram.interface,PollingTelegramInterface) +class and [telebot](https://pytba.readthedocs.io/en/latest/index.html) +library are used for accessing telegram API in polling mode. Telegram API token is required to access telegram API. -""" # noqa: E501 +""" # %pip install dff[telegram] diff --git a/tutorials/messengers/telegram/2_buttons.py b/tutorials/messengers/telegram/2_buttons.py index da93efb5e..9520bba12 100644 --- a/tutorials/messengers/telegram/2_buttons.py +++ b/tutorials/messengers/telegram/2_buttons.py @@ -4,14 +4,16 @@ This tutorial shows how to display and hide a basic keyboard in Telegram. -Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) -class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and -[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) +Here, %mddoclink(api,messengers.telegram.message,TelegramMessage) +class is used to represent telegram message, +%mddoclink(api,messengers.telegram.message,TelegramUI) and +%mddoclink(api,messengers.telegram.message,RemoveKeyboard) classes are used for configuring additional telegram message features. -Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) -classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. -""" # noqa: E501 +Different %mddoclink(api,script.core.message,message) +classes are used for representing different common message features, +like Attachment, Audio, Button, Image, etc. +""" # %pip install dff[telegram] diff --git a/tutorials/messengers/telegram/3_buttons_with_callback.py b/tutorials/messengers/telegram/3_buttons_with_callback.py index eafc0eec7..effd8320a 100644 --- a/tutorials/messengers/telegram/3_buttons_with_callback.py +++ b/tutorials/messengers/telegram/3_buttons_with_callback.py @@ -5,14 +5,16 @@ This tutorial demonstrates, how to add an inline keyboard and utilize inline queries. -Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message) -class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and -[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard) +Here, %mddoclink(api,messengers.telegram.message,TelegramMessage) +class is used to represent telegram message, +%mddoclink(api,messengers.telegram.message,TelegramUI) and +%mddoclink(api,messengers.telegram.message,RemoveKeyboard) classes are used for configuring additional telegram message features. -Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) -classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. -""" # noqa: E501 +Different %mddoclink(api,script.core.message,message) +classes are used for representing different common message features, +like Attachment, Audio, Button, Image, etc. +""" # %pip install dff[telegram] diff --git a/tutorials/messengers/telegram/4_conditions.py b/tutorials/messengers/telegram/4_conditions.py index 8b652c2f7..0490e4aae 100644 --- a/tutorials/messengers/telegram/4_conditions.py +++ b/tutorials/messengers/telegram/4_conditions.py @@ -5,9 +5,9 @@ This tutorial shows how to process Telegram updates in your script and reuse handler triggers from the `pytelegrambotapi` library. -Here, [telegram_condition](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.telegram_condition) +Here, %mddoclink(api,messengers.telegram.messenger,telegram_condition) function is used for graph navigation according to Telegram events. -""" # noqa: E501 +""" # %pip install dff[telegram] diff --git a/tutorials/messengers/telegram/5_conditions_with_media.py b/tutorials/messengers/telegram/5_conditions_with_media.py index e9f3b29ef..d49af7ca8 100644 --- a/tutorials/messengers/telegram/5_conditions_with_media.py +++ b/tutorials/messengers/telegram/5_conditions_with_media.py @@ -4,12 +4,13 @@ This tutorial shows how to use media-related logic in your script. -Here, [telegram_condition](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.telegram_condition) +Here, %mddoclink(api,messengers.telegram.messenger,telegram_condition) function is used for graph navigation according to Telegram events. -Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message) -classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc. -""" # noqa: E501 +Different %mddoclink(api,script.core.message,message) +classes are used for representing different common message features, +like Attachment, Audio, Button, Image, etc. +""" # %pip install dff[telegram] diff --git a/tutorials/messengers/telegram/6_conditions_extras.py b/tutorials/messengers/telegram/6_conditions_extras.py index 59136ea02..e1bbe7069 100644 --- a/tutorials/messengers/telegram/6_conditions_extras.py +++ b/tutorials/messengers/telegram/6_conditions_extras.py @@ -5,10 +5,10 @@ This tutorial shows how to use additional update filters inherited from the `pytelegrambotapi` library. -[telegram_condition](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.telegram_condition) -function and different types of [UpdateType](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.UpdateType) +%mddoclink(api,messengers.telegram.messenger,telegram_condition) +function and different types of %mddoclink(api,messengers.telegram.messenger,UpdateType) are used for telegram message type checking. -""" # noqa: E501 +""" # %pip install dff[telegram] diff --git a/tutorials/messengers/telegram/7_polling_setup.py b/tutorials/messengers/telegram/7_polling_setup.py index 0ff60d593..9cc08df87 100644 --- a/tutorials/messengers/telegram/7_polling_setup.py +++ b/tutorials/messengers/telegram/7_polling_setup.py @@ -4,9 +4,9 @@ The following tutorial shows how to configure `PollingTelegramInterface`. -See [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface) +See %mddoclink(api,messengers.telegram.interface,PollingTelegramInterface) for more information. -""" # noqa: E501 +""" # %pip install dff[telegram] diff --git a/tutorials/messengers/telegram/8_webhook_setup.py b/tutorials/messengers/telegram/8_webhook_setup.py index aa49fec2c..e08790a0a 100644 --- a/tutorials/messengers/telegram/8_webhook_setup.py +++ b/tutorials/messengers/telegram/8_webhook_setup.py @@ -5,9 +5,9 @@ The following tutorial shows how to use `CallbackTelegramInterface` that makes your bot accessible through a public webhook. -See [CallbackMessengerInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.CallbackMessengerInterface) +See %mddoclink(api,messengers.common.interface,CallbackMessengerInterface) for more information. -""" # noqa: E501 +""" # %pip install dff[telegram] flask diff --git a/tutorials/messengers/web_api_interface/1_fastapi.py b/tutorials/messengers/web_api_interface/1_fastapi.py index eb75a89c7..73df867a1 100644 --- a/tutorials/messengers/web_api_interface/1_fastapi.py +++ b/tutorials/messengers/web_api_interface/1_fastapi.py @@ -6,12 +6,11 @@ You can see the result at http://127.0.0.1:8000/docs. -Here, `_run_pipeline` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run)) +Here, `_run_pipeline` (same as %mddoclink(api,pipeline.pipeline.pipeline,Pipeline.run)) method is used to execute pipeline once. -[Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) -is used in creating a JSON Schema for the endpoint. -""" # noqa: E501 +%mddoclink(api,script.core.message,Message) is used in creating a JSON Schema for the endpoint. +""" # %pip install dff uvicorn fastapi diff --git a/tutorials/messengers/web_api_interface/2_websocket_chat.py b/tutorials/messengers/web_api_interface/2_websocket_chat.py index 8c34b4050..3153d77ce 100644 --- a/tutorials/messengers/web_api_interface/2_websocket_chat.py +++ b/tutorials/messengers/web_api_interface/2_websocket_chat.py @@ -15,12 +15,11 @@ > all inside a long string. > This, of course, is not optimal and you wouldn't use it for production. -Here, `_run_pipeline` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run)) +Here, `_run_pipeline` (same as %mddoclink(api,pipeline.pipeline.pipeline,Pipeline.run)) method is used to execute pipeline once. -[Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) -is used to represent text messages. -""" # noqa: E501 +%mddoclink(api,script.core.message,Message) is used to represent text messages. +""" # %pip install dff uvicorn fastapi diff --git a/tutorials/pipeline/1_basics.py b/tutorials/pipeline/1_basics.py index 3247c677d..d2919b27e 100644 --- a/tutorials/pipeline/1_basics.py +++ b/tutorials/pipeline/1_basics.py @@ -5,9 +5,9 @@ The following tutorial shows basic usage of `pipeline` module as an extension to `dff.script.core`. -Here, `__call__` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run)) +Here, `__call__` (same as %mddoclink(api,pipeline.pipeline.pipeline,Pipeline.run)) method is used to execute pipeline once. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/pipeline/2_pre_and_post_processors.py b/tutorials/pipeline/2_pre_and_post_processors.py index a972037cc..eb335feb3 100644 --- a/tutorials/pipeline/2_pre_and_post_processors.py +++ b/tutorials/pipeline/2_pre_and_post_processors.py @@ -5,9 +5,9 @@ The following tutorial shows more advanced usage of `pipeline` module as an extension to `dff.script.core`. -Here, [misc](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.context.html#dff.script.core.context.Context.misc) +Here, %mddoclink(api,script.core.context,Context.misc) dictionary of context is used for storing additional data. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py index 8e6a6e92e..df3c0c36d 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_basic.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_basic.py @@ -5,12 +5,12 @@ The following tutorial shows `pipeline` creation from dict and most important pipeline components. -Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#service) +Here, %mddoclink(api,pipeline.service.service,Service) class, that can be used for pre- and postprocessing of messages is shown. -Pipeline's [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict) +Pipeline's %mddoclink(api,pipeline.pipeline.pipeline,Pipeline.from_dict) static method is used for pipeline creation (from dictionary). -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/pipeline/3_pipeline_dict_with_services_full.py b/tutorials/pipeline/3_pipeline_dict_with_services_full.py index e5a0770d7..b085fa2ff 100644 --- a/tutorials/pipeline/3_pipeline_dict_with_services_full.py +++ b/tutorials/pipeline/3_pipeline_dict_with_services_full.py @@ -5,8 +5,9 @@ The following tutorial shows `pipeline` creation from dict and most important pipeline components. -This tutorial is a more advanced version of the [previous tutorial](./tutorials.pipeline.3_pipeline_dict_with_services_basic.html). -""" # noqa: E501 +This tutorial is a more advanced version of the +[previous tutorial](%doclink(tutorial,pipeline.3_pipeline_dict_with_services_basic)). +""" # %pip install dff diff --git a/tutorials/pipeline/4_groups_and_conditions_basic.py b/tutorials/pipeline/4_groups_and_conditions_basic.py index 3fb0ae223..18b4527b5 100644 --- a/tutorials/pipeline/4_groups_and_conditions_basic.py +++ b/tutorials/pipeline/4_groups_and_conditions_basic.py @@ -4,10 +4,10 @@ The following example shows `pipeline` service group usage and start conditions. -Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#dff.pipeline.service.service.Service)s -and [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s +Here, %mddoclink(api,pipeline.service.service,Service)s +and %mddoclink(api,pipeline.service.group,ServiceGroup)s are shown for advanced data pre- and postprocessing based on conditions. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/pipeline/4_groups_and_conditions_full.py b/tutorials/pipeline/4_groups_and_conditions_full.py index 91ec32352..e363fda2d 100644 --- a/tutorials/pipeline/4_groups_and_conditions_full.py +++ b/tutorials/pipeline/4_groups_and_conditions_full.py @@ -4,10 +4,9 @@ The following tutorial shows `pipeline` service group usage and start conditions. -Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#dff.pipeline.service.service.Service)s -and [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s -are shown for advanced data pre- and postprocessing based on conditions. -""" # noqa: E501 +This tutorial is a more advanced version of the +[previous tutorial](%doclink(tutorial,pipeline.4_groups_and_conditions_basic)). +""" # %pip install dff diff --git a/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py b/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py index c9211eeb7..4d25fa7b9 100644 --- a/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py +++ b/tutorials/pipeline/5_asynchronous_groups_and_services_basic.py @@ -5,9 +5,9 @@ The following tutorial shows `pipeline` asynchronous service and service group usage. -Here, [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s +Here, %mddoclink(api,pipeline.service.group,ServiceGroup)s are shown for advanced and asynchronous data pre- and postprocessing. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/pipeline/5_asynchronous_groups_and_services_full.py b/tutorials/pipeline/5_asynchronous_groups_and_services_full.py index 828847787..dc1d585ca 100644 --- a/tutorials/pipeline/5_asynchronous_groups_and_services_full.py +++ b/tutorials/pipeline/5_asynchronous_groups_and_services_full.py @@ -5,9 +5,9 @@ The following tutorial shows `pipeline` asynchronous service and service group usage. -Here, [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s -are shown for advanced and asynchronous data pre- and postprocessing. -""" # noqa: E501 +This tutorial is a more advanced version of the +[previous tutorial](%doclink(tutorial,pipeline.5_asynchronous_groups_and_services_basic)). +""" # %pip install dff diff --git a/tutorials/pipeline/6_custom_messenger_interface.py b/tutorials/pipeline/6_custom_messenger_interface.py index 1e5e0d72e..c20a38b20 100644 --- a/tutorials/pipeline/6_custom_messenger_interface.py +++ b/tutorials/pipeline/6_custom_messenger_interface.py @@ -4,10 +4,10 @@ The following tutorial shows messenger interfaces usage. -Here, [CallbackMessengerInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.interface.html#dff.messengers.telegram.interface.CallbackTelegramInterface) -and [PollingMessengerInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.interface.html#dff.messengers.telegram.interface.PollingTelegramInterface) +Here, %mddoclink(api,messengers.common.interface,CallbackMessengerInterface) +and %mddoclink(api,messengers.common.interface,PollingMessengerInterface) are shown as alternatives for connection to custom user messenger backends. -""" # noqa: E501 +""" # %pip install dff flask diff --git a/tutorials/pipeline/7_extra_handlers_basic.py b/tutorials/pipeline/7_extra_handlers_basic.py index add3ed699..2f72955b6 100644 --- a/tutorials/pipeline/7_extra_handlers_basic.py +++ b/tutorials/pipeline/7_extra_handlers_basic.py @@ -4,10 +4,10 @@ The following tutorial shows extra handlers possibilities and use cases. -Here, extra handlers [BeforeHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.BeforeHandler) -and [AfterHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.AfterHandler) +Here, extra handlers %mddoclink(api,pipeline.service.extra,BeforeHandler) +and %mddoclink(api,pipeline.service.extra,AfterHandler) are shown as additional means of data processing, attached to services. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/pipeline/7_extra_handlers_full.py b/tutorials/pipeline/7_extra_handlers_full.py index f53a5471e..0027c8ca9 100644 --- a/tutorials/pipeline/7_extra_handlers_full.py +++ b/tutorials/pipeline/7_extra_handlers_full.py @@ -4,10 +4,9 @@ The following tutorial shows extra handlers possibilities and use cases. -Here, extra handlers [BeforeHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.BeforeHandler) -and [AfterHandler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.extra.html#dff.pipeline.service.extra.AfterHandler) -are shown as additional means of data processing, attached to services. -""" # noqa: E501 +This tutorial is a more advanced version of the +[previous tutorial](%doclink(tutorial,pipeline.7_extra_handlers_basic)). +""" # %pip install dff psutil diff --git a/tutorials/pipeline/8_extra_handlers_and_extensions.py b/tutorials/pipeline/8_extra_handlers_and_extensions.py index 91e335f78..8b610af5f 100644 --- a/tutorials/pipeline/8_extra_handlers_and_extensions.py +++ b/tutorials/pipeline/8_extra_handlers_and_extensions.py @@ -5,9 +5,10 @@ The following tutorial shows how pipeline can be extended by global extra handlers and custom functions. -Here, [add_global_handler](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.add_global_handler) -function is shown, that can be used to add extra handlers before and/or after all pipeline services. -""" # noqa: E501 +Here, %mddoclink(api,pipeline.pipeline.pipeline,Pipeline.add_global_handler) +function is shown, that can be used to add extra handlers before +and/or after all pipeline services. +""" # %pip install dff diff --git a/tutorials/script/core/1_basics.py b/tutorials/script/core/1_basics.py index f0dba767c..a5ebb2d99 100644 --- a/tutorials/script/core/1_basics.py +++ b/tutorials/script/core/1_basics.py @@ -4,15 +4,16 @@ This notebook shows basic tutorial of creating a simple dialog bot (agent). -Here, basic usege of [Pipeline](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline) -primitive is shown: its' creation with [from_script](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_script) +Here, basic usege of %mddoclink(api,pipeline.pipeline.pipeline,Pipeline) +primitive is shown: its' creation with +%mddoclink(api,pipeline.pipeline.pipeline,Pipeline.from_script) and execution. -Additionally, function [check_happy_path](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.utils.testing.common.html#dff.utils.testing.common.check_happy_path) +Additionally, function %mddoclink(api,utils.testing.common,check_happy_path) that can be used for Pipeline testing is presented. Let's do all the necessary imports from DFF: -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/script/core/2_conditions.py b/tutorials/script/core/2_conditions.py index f4edd3232..35b862d4b 100644 --- a/tutorials/script/core/2_conditions.py +++ b/tutorials/script/core/2_conditions.py @@ -5,11 +5,11 @@ This tutorial shows different options for setting transition conditions from one node to another. -Here, [conditions](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.conditions.std_conditions.html#conditions) +Here, [conditions](%doclink(api,script.conditions.std_conditions)) for script transitions are shown. First of all, let's do all the necessary imports from DFF. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/script/core/3_responses.py b/tutorials/script/core/3_responses.py index 60226f579..3d12a75ce 100644 --- a/tutorials/script/core/3_responses.py +++ b/tutorials/script/core/3_responses.py @@ -4,11 +4,11 @@ This tutorial shows different options for setting responses. -Here, [responses](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.responses.std_responses.html#responses) +Here, [responses](%doclink(api,script.responses.std_responses)) that allow giving custom answers to users are shown. Let's do all the necessary imports from DFF. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/script/core/4_transitions.py b/tutorials/script/core/4_transitions.py index 934cbd665..86a6f9e99 100644 --- a/tutorials/script/core/4_transitions.py +++ b/tutorials/script/core/4_transitions.py @@ -4,13 +4,14 @@ This tutorial shows settings for transitions between flows and nodes. -Here, [conditions](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.conditions.std_conditions.html#conditions) +Here, [conditions](%doclink(api,script.conditions.std_conditions)) for transition between many different script steps are shown. -Some of the destination steps can be set using [labels](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.labels.std_labels.html#labels). +Some of the destination steps can be set using +[labels](%doclink(api,script.labels.std_labels)). First of all, let's do all the necessary imports from DFF. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/script/core/5_global_transitions.py b/tutorials/script/core/5_global_transitions.py index 25f7f410d..8d555d0f1 100644 --- a/tutorials/script/core/5_global_transitions.py +++ b/tutorials/script/core/5_global_transitions.py @@ -4,11 +4,11 @@ This tutorial shows the global setting of transitions. -Here, global [conditions](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.conditions.std_conditions.html#conditions) +Here, global [conditions](%doclink(api,script.conditions.std_conditions)) for default transition between many different script steps are shown. First of all, let's do all the necessary imports from DFF. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/script/core/7_pre_response_processing.py b/tutorials/script/core/7_pre_response_processing.py index e220ce058..d43e9c17d 100644 --- a/tutorials/script/core/7_pre_response_processing.py +++ b/tutorials/script/core/7_pre_response_processing.py @@ -4,15 +4,14 @@ This tutorial shows pre-response processing feature. -Here, [PRE_RESPONSE_PROCESSING](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.PRE_RESPONSE_PROCESSING) +Here, %mddoclink(api,script.core.keywords,Keywords.PRE_RESPONSE_PROCESSING) is demonstrated which can be used for additional context processing before response handlers. -There are also some other -[Keywords](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords) +There are also some other %mddoclink(api,script.core.keywords,Keywords) worth attention used in this tutorial. First of all, let's do all the necessary imports from DFF. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/script/core/8_misc.py b/tutorials/script/core/8_misc.py index 85013b95e..7756eca12 100644 --- a/tutorials/script/core/8_misc.py +++ b/tutorials/script/core/8_misc.py @@ -4,11 +4,11 @@ This tutorial shows `MISC` (miscellaneous) keyword usage. -See [MISC](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.MISC) +See %mddoclink(api,script.core.keywords,Keywords.MISC) for more information. First of all, let's do all the necessary imports from DFF. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/script/core/9_pre_transitions_processing.py b/tutorials/script/core/9_pre_transitions_processing.py index b330208ea..859a1cd5f 100644 --- a/tutorials/script/core/9_pre_transitions_processing.py +++ b/tutorials/script/core/9_pre_transitions_processing.py @@ -4,11 +4,12 @@ This tutorial shows pre-transitions processing feature. -Here, [PRE_TRANSITIONS_PROCESSING](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.PRE_TRANSITIONS_PROCESSING) -is demonstrated which can be used for additional context processing before transitioning to the next step. +Here, %mddoclink(api,script.core.keywords,Keywords.PRE_TRANSITIONS_PROCESSING) +is demonstrated which can be used for additional context +processing before transitioning to the next step. First of all, let's do all the necessary imports from DFF. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/script/responses/1_basics.py b/tutorials/script/responses/1_basics.py index 2f4ad6a5f..c737b05f5 100644 --- a/tutorials/script/responses/1_basics.py +++ b/tutorials/script/responses/1_basics.py @@ -3,10 +3,10 @@ # Responses: 1. Basics Here, the process of response forming is shown. -Special keywords [RESPONSE](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.RESPONSE) -and [TRANSITIONS](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.keywords.html#dff.script.core.keywords.Keywords.TRANSITIONS) +Special keywords %mddoclink(api,script.core.keywords,Keywords.RESPONSE) +and %mddoclink(api,script.core.keywords,Keywords.TRANSITIONS) are used for that. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/script/responses/2_buttons.py b/tutorials/script/responses/2_buttons.py index fd7304459..08cec46db 100644 --- a/tutorials/script/responses/2_buttons.py +++ b/tutorials/script/responses/2_buttons.py @@ -2,11 +2,12 @@ """ # Responses: 2. Buttons -In this tutorial [Button](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Button) +In this tutorial %mddoclink(api,script.core.message,Button) class is demonstrated. -Buttons are one of [Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message) fields. -They can be attached to any message but will only work if the chosen [messenger interface](https://deeppavlov.github.io/dialog_flow_framework/apiref/index_messenger_interfaces.html) supports them. -""" # noqa: E501 +Buttons are one of %mddoclink(api,script.core.message,Message) fields. +They can be attached to any message but will only work if the chosen +[messenger interface](%doclink(api,index_messenger_interfaces)) supports them. +""" # %pip install dff diff --git a/tutorials/script/responses/3_media.py b/tutorials/script/responses/3_media.py index 81c4656f1..8b43d58f9 100644 --- a/tutorials/script/responses/3_media.py +++ b/tutorials/script/responses/3_media.py @@ -2,13 +2,14 @@ """ # Responses: 3. Media -Here, [Attachments](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Attachments) -class is shown. Attachments can be used for attaching different media elements -(such as [Image](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Image), -[Document](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Document) -or [Audio](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Audio)). -They can be attached to any message but will only work if the chosen [messenger interface](https://deeppavlov.github.io/dialog_flow_framework/apiref/index_messenger_interfaces.html) supports them. -""" # noqa: E501 +Here, %mddoclink(api,script.core.message,Attachments) class is shown. +Attachments can be used for attaching different media elements +(such as %mddoclink(api,script.core.message,Image), %mddoclink(api,script.core.message,Document) +or %mddoclink(api,script.core.message,Audio)). + +They can be attached to any message but will only work if the chosen +[messenger interface](%doclink(api,index_messenger_interfaces)) supports them. +""" # %pip install dff diff --git a/tutorials/script/responses/4_multi_message.py b/tutorials/script/responses/4_multi_message.py index 744a8dc0a..d6dca4b1f 100644 --- a/tutorials/script/responses/4_multi_message.py +++ b/tutorials/script/responses/4_multi_message.py @@ -4,11 +4,10 @@ This tutorial shows Multi Message usage. -The [MultiMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.MultiMessage) -represents a combination of several messages. +The %mddoclink(api,script.core.message,MultiMessage) represents a combination of several messages. Let's do all the necessary imports from DFF. -""" # noqa: E501 +""" # %pip install dff diff --git a/tutorials/utils/1_cache.py b/tutorials/utils/1_cache.py index 910996f27..2173cfa84 100644 --- a/tutorials/utils/1_cache.py +++ b/tutorials/utils/1_cache.py @@ -2,10 +2,9 @@ """ # 1. Cache +TODO: no entry in documentation! """ -# TODO: no entry in documentation! - # %pip install dff # %% diff --git a/tutorials/utils/2_lru_cache.py b/tutorials/utils/2_lru_cache.py index 1e0c94ca3..e96dee236 100644 --- a/tutorials/utils/2_lru_cache.py +++ b/tutorials/utils/2_lru_cache.py @@ -2,10 +2,9 @@ """ # 2. LRU Cache +TODO: no entry in documentation! """ -# TODO: no entry in documentation! - # %pip install dff # %% From caa67180787fe4389cfd5b06957d9a5623cb9f4f Mon Sep 17 00:00:00 2001 From: pseusys Date: Mon, 21 Aug 2023 22:23:44 +0200 Subject: [PATCH 12/21] links proposition --- docs/source/utils/notebook.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index 6acb347eb..e66665e7e 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -77,17 +77,17 @@ class DocumentationLink(ReplacePattern): USAGE EXAMPLES -------------- - [link](%doclink(api,script.core.script)) + [Node](%doclink(api,script.core.script)) -> [Node](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/dff/script/core/script#Node) - [link](%doclink(api,script.core.script,Node)) + [Node](%doclink(api,script.core.script,Node)) -> [Node](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat) - [link](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) + [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) -> [API-configuration](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration) - [link](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration)) + [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration)) -> [API-configuration](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration) - [link](%doclink(guide,basic_conceptions)) + [basic_conceptions](%doclink(guide,basic_conceptions)) -> [basic_conceptions](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions) - [link](%doclink(guide,basic_conceptions,example-conversational-chat-bot)) + [example-conversational-chat-bot](%doclink(guide,basic_conceptions,example-conversational-chat-bot)) -> [example-conversational-chat-bot](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions#example-conversational-chat-bot) """ @@ -157,17 +157,15 @@ class MarkdownDocumentationLink(DocumentationLink): USAGE EXAMPLES -------------- - [script](%doclink(api,script.core.script)) + %mddoclink(api,script.core.script,Node) -> [Node](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/dff/script/core/script#Node) - [Node](%doclink(api,script.core.script,Node)) + %mddoclink(tutorial,messengers.web_api_interface.4_streamlit_chat) -> [4_streamlit_chat](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat) - [4_streamlit_chat](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) + %mddoclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration) -> [API-configuration](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration) - [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration)) + %mddoclink(guide,basic_conceptions) -> [basic_conceptions](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions) - [basic_conceptions](%doclink(guide,basic_conceptions)) - - [example-conversational-chat-bot](%doclink(guide,basic_conceptions,example-conversational-chat-bot)) + %mddoclink(guide,basic_conceptions,example-conversational-chat-bot) -> [example-conversational-chat-bot](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions#example-conversational-chat-bot) """ From 00800d4775145f1240a18e387bd52e671f3941c7 Mon Sep 17 00:00:00 2001 From: pseusys Date: Wed, 23 Aug 2023 02:52:39 +0200 Subject: [PATCH 13/21] docs fixed --- docs/source/utils/notebook.py | 46 ++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index e66665e7e..67a531388 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -77,17 +77,31 @@ class DocumentationLink(ReplacePattern): USAGE EXAMPLES -------------- - [Node](%doclink(api,script.core.script)) -> [Node](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/dff/script/core/script#Node) + [Node](%doclink(api,script.core.script)) -> [Node]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/dff/script/core/script#Node + ) - [Node](%doclink(api,script.core.script,Node)) -> [Node](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat) + [Node](%doclink(api,script.core.script,Node)) -> [Node]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat + ) - [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) -> [API-configuration](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration) + [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) -> [API-configuration]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration + ) - [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration)) -> [API-configuration](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration) + [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration)) + -> [API-configuration]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration + ) - [basic_conceptions](%doclink(guide,basic_conceptions)) -> [basic_conceptions](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions) + [basic_conceptions](%doclink(guide,basic_conceptions)) -> [basic_conceptions]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions + ) - [example-conversational-chat-bot](%doclink(guide,basic_conceptions,example-conversational-chat-bot)) -> [example-conversational-chat-bot](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions#example-conversational-chat-bot) + [example-conversational-chat-bot](%doclink(guide,basic_conceptions,example-conversational-chat-bot)) + -> [example-conversational-chat-bot]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions#example-conversational-chat-bot + ) """ @@ -157,15 +171,25 @@ class MarkdownDocumentationLink(DocumentationLink): USAGE EXAMPLES -------------- - %mddoclink(api,script.core.script,Node) -> [Node](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/dff/script/core/script#Node) + %mddoclink(api,script.core.script,Node) -> [Node]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/dff/script/core/script#Node + ) - %mddoclink(tutorial,messengers.web_api_interface.4_streamlit_chat) -> [4_streamlit_chat](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat) + %mddoclink(tutorial,messengers.web_api_interface.4_streamlit_chat) -> [4_streamlit_chat]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat + ) - %mddoclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration) -> [API-configuration](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration) + %mddoclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration) -> [API-configuration]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration + ) - %mddoclink(guide,basic_conceptions) -> [basic_conceptions](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions) + %mddoclink(guide,basic_conceptions) -> [basic_conceptions]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions + ) - %mddoclink(guide,basic_conceptions,example-conversational-chat-bot) -> [example-conversational-chat-bot](http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions#example-conversational-chat-bot) + %mddoclink(guide,basic_conceptions,example-conversational-chat-bot) -> [example-conversational-chat-bot]( + http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions#example-conversational-chat-bot + ) """ From 82c14c9964d62c015a604dd4e7eab1cf97d1928a Mon Sep 17 00:00:00 2001 From: pseusys Date: Wed, 23 Aug 2023 03:01:55 +0200 Subject: [PATCH 14/21] links fixed (again) --- docs/source/utils/notebook.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index 67a531388..6ac49df66 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -78,29 +78,29 @@ class DocumentationLink(ReplacePattern): -------------- [Node](%doclink(api,script.core.script)) -> [Node]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/dff/script/core/script#Node + ../apiref/dff.script.core.script.rst ) [Node](%doclink(api,script.core.script,Node)) -> [Node]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat + ../apiref/dff.script.core.script.rst#dff.script.core.script.Node ) [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) -> [API-configuration]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration + ../tutorials/tutorials.messengers.web_api_interface.4_streamlit_chat.py ) [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration)) -> [API-configuration]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration + ../tutorials/tutorials.messengers.web_api_interface.4_streamlit_chat.py#API-configuration ) [basic_conceptions](%doclink(guide,basic_conceptions)) -> [basic_conceptions]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions + ../user_guides/basic_conceptions.rst ) [example-conversational-chat-bot](%doclink(guide,basic_conceptions,example-conversational-chat-bot)) -> [example-conversational-chat-bot]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions#example-conversational-chat-bot + ../user_guides/basic_conceptions.rst#example-conversational-chat-bot ) """ @@ -172,23 +172,23 @@ class MarkdownDocumentationLink(DocumentationLink): -------------- %mddoclink(api,script.core.script,Node) -> [Node]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/dff/script/core/script#Node + ../apiref/dff.script.core.script.rst#dff.script.core.script.Node ) %mddoclink(tutorial,messengers.web_api_interface.4_streamlit_chat) -> [4_streamlit_chat]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat + ../tutorials/tutorials.messengers.web_api_interface.4_streamlit_chat.py ) %mddoclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration) -> [API-configuration]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/tutorials/messengers/web_api_interface/4_streamlit_chat#API-configuration + ../tutorials/tutorials.messengers.web_api_interface.4_streamlit_chat.py#API-configuration ) %mddoclink(guide,basic_conceptions) -> [basic_conceptions]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions + ../user_guides/basic_conceptions.rst ) %mddoclink(guide,basic_conceptions,example-conversational-chat-bot) -> [example-conversational-chat-bot]( - http://github.com/deeppavlov/dialog_flow_framework/tree/dev/docs/sources/user_guides/basic_conceptions#example-conversational-chat-bot + ../user_guides/basic_conceptions.rst#example-conversational-chat-bot ) """ From e67d974a12c5fe8ed13d8e8475d1b3c8a8641e36 Mon Sep 17 00:00:00 2001 From: pseusys Date: Fri, 25 Aug 2023 00:01:14 +0200 Subject: [PATCH 15/21] review comments fixed --- docs/source/conf.py | 2 +- docs/source/utils/notebook.py | 16 ++++++++++++---- tutorials/context_storages/3_mongodb.py | 2 +- tutorials/context_storages/4_redis.py | 2 +- tutorials/context_storages/5_mysql.py | 2 +- tutorials/context_storages/6_sqlite.py | 2 +- tutorials/context_storages/7_yandex_database.py | 2 +- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 4bc3731dd..fda72b150 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -145,7 +145,7 @@ ] -autodoc_default_options = {"members": True, "undoc-members": False, "private-members": False} +autodoc_default_options = {"members": True, "undoc-members": False, "private-members": True} def setup(_): diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index 6ac49df66..7ef78c17c 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -59,7 +59,7 @@ def replacement_string(matchobj: re.Match) -> str: return f""" # %% # installing dependencies -!pip install -q {matchobj.group(1)} +%pip install -q {matchobj.group(1)} """ @@ -77,7 +77,11 @@ class DocumentationLink(ReplacePattern): USAGE EXAMPLES -------------- - [Node](%doclink(api,script.core.script)) -> [Node]( + [index_pipeline](%doclink(api,index_pipeline)) -> [index_pipeline]( + ../apiref/index_pipeline.rst + ) + + [script](%doclink(api,script.core.script)) -> [script]( ../apiref/dff.script.core.script.rst ) @@ -85,7 +89,7 @@ class DocumentationLink(ReplacePattern): ../apiref/dff.script.core.script.rst#dff.script.core.script.Node ) - [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) -> [API-configuration]( + [4_streamlit_chat](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) -> [4_streamlit_chat]( ../tutorials/tutorials.messengers.web_api_interface.4_streamlit_chat.py ) @@ -166,11 +170,15 @@ class MarkdownDocumentationLink(DocumentationLink): So, `%mddoclink(arg1,arg2,arg3)` will be replaced with `[text](link_to_doc_page(arg1, arg2, arg3))`, and `%doclink(arg1,arg2)` will be replaced with `[text](link_to_doc_page(arg1, arg2))` with `text` being the last - path segment of `arg2` or `arg3` (if present). + path segment of the last argument. USAGE EXAMPLES -------------- + %mddoclink(api,index_pipeline) -> [index_pipeline]( + ../apiref/index_pipeline.rst + ) + %mddoclink(api,script.core.script,Node) -> [Node]( ../apiref/dff.script.core.script.rst#dff.script.core.script.Node ) diff --git a/tutorials/context_storages/3_mongodb.py b/tutorials/context_storages/3_mongodb.py index 0221657bc..cd3f8fdb1 100644 --- a/tutorials/context_storages/3_mongodb.py +++ b/tutorials/context_storages/3_mongodb.py @@ -7,7 +7,7 @@ See %mddoclink(api,context_storages.mongo,MongoContextStorage) class for storing you users' contexts in Mongo database. -The DFF uses [motor](https://motor.readthedocs.io/en/stable/) +DFF uses [motor](https://motor.readthedocs.io/en/stable/) library for asynchronous access to MongoDB. """ diff --git a/tutorials/context_storages/4_redis.py b/tutorials/context_storages/4_redis.py index 2ea96eec7..01bf57383 100644 --- a/tutorials/context_storages/4_redis.py +++ b/tutorials/context_storages/4_redis.py @@ -7,7 +7,7 @@ See %mddoclink(api,context_storages.redis,RedisContextStorage) class for storing you users' contexts in Redis database. -The DFF uses [redis.asyncio](https://redis.readthedocs.io/en/latest/) +DFF uses [redis.asyncio](https://redis.readthedocs.io/en/latest/) library for asynchronous access to Redis DB. """ diff --git a/tutorials/context_storages/5_mysql.py b/tutorials/context_storages/5_mysql.py index 8c63208af..46ab9b0fe 100644 --- a/tutorials/context_storages/5_mysql.py +++ b/tutorials/context_storages/5_mysql.py @@ -7,7 +7,7 @@ See %mddoclink(api,context_storages.sql,SQLContextStorage) class for storing you users' contexts in SQL databases. -The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) +DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncmy](https://github.com/long2ice/asyncmy) libraries for asynchronous access to MySQL DB. """ diff --git a/tutorials/context_storages/6_sqlite.py b/tutorials/context_storages/6_sqlite.py index f7d47a13d..8d7e0b53b 100644 --- a/tutorials/context_storages/6_sqlite.py +++ b/tutorials/context_storages/6_sqlite.py @@ -7,7 +7,7 @@ See %mddoclink(api,context_storages.sql,SQLContextStorage) class for storing you users' contexts in SQL databases. -The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) +DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [aiosqlite](https://readthedocs.org/projects/aiosqlite/) libraries for asynchronous access to SQLite DB. diff --git a/tutorials/context_storages/7_yandex_database.py b/tutorials/context_storages/7_yandex_database.py index 3099b86db..385617241 100644 --- a/tutorials/context_storages/7_yandex_database.py +++ b/tutorials/context_storages/7_yandex_database.py @@ -7,7 +7,7 @@ See %mddoclink(api,context_storages.ydb,YDBContextStorage) class for storing you users' contexts in Yandex database. -The DFF uses [ydb.aio](https://ydb.tech/en/docs/) +DFF uses [ydb.aio](https://ydb.tech/en/docs/) library for asynchronous access to Yandex DB. """ From aa6f44a1281df672d68e39839d2ec8f3eaee17b8 Mon Sep 17 00:00:00 2001 From: pseusys Date: Sat, 30 Sep 2023 19:48:09 +0200 Subject: [PATCH 16/21] docs added to tutorials --- tutorials/utils/1_cache.py | 8 +++++++- tutorials/utils/2_lru_cache.py | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tutorials/utils/1_cache.py b/tutorials/utils/1_cache.py index 2173cfa84..2e47808af 100644 --- a/tutorials/utils/1_cache.py +++ b/tutorials/utils/1_cache.py @@ -2,7 +2,13 @@ """ # 1. Cache -TODO: no entry in documentation! +In this tutorial use of +%mddoclink(dff,utils.turn_caching.singleton_turn_caching,cache) +function is demonstrated. +This function is used a lot like :py:func:`~functools.cache` function and +helps saving results of heavy function execution and avoiding recalculation. +Caches are kept in a library-wide singleton +and cleared in the end of each turn. """ # %pip install dff diff --git a/tutorials/utils/2_lru_cache.py b/tutorials/utils/2_lru_cache.py index e96dee236..5789939e6 100644 --- a/tutorials/utils/2_lru_cache.py +++ b/tutorials/utils/2_lru_cache.py @@ -2,7 +2,14 @@ """ # 2. LRU Cache -TODO: no entry in documentation! +In this tutorial use of +%mddoclink(dff,utils.turn_caching.singleton_turn_caching,lru_cache) +function is demonstrated. +This function is used a lot like :py:func:`~functools.lru_cache` function and +helps saving results of heavy function execution and avoiding recalculation. +Caches are kept in a library-wide singleton +and cleared in the end of each turn. +Maximum size parameter limits amount of function execution result cached. """ # %pip install dff From 072a71e8dab58fd90606d0112361dce9f5ee6230 Mon Sep 17 00:00:00 2001 From: pseusys Date: Sat, 30 Sep 2023 23:53:25 +0200 Subject: [PATCH 17/21] dff -> api --- tutorials/utils/1_cache.py | 2 +- tutorials/utils/2_lru_cache.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/utils/1_cache.py b/tutorials/utils/1_cache.py index 2e47808af..a6617f64f 100644 --- a/tutorials/utils/1_cache.py +++ b/tutorials/utils/1_cache.py @@ -3,7 +3,7 @@ # 1. Cache In this tutorial use of -%mddoclink(dff,utils.turn_caching.singleton_turn_caching,cache) +%mddoclink(api,utils.turn_caching.singleton_turn_caching,cache) function is demonstrated. This function is used a lot like :py:func:`~functools.cache` function and helps saving results of heavy function execution and avoiding recalculation. diff --git a/tutorials/utils/2_lru_cache.py b/tutorials/utils/2_lru_cache.py index 5789939e6..58b00a2c0 100644 --- a/tutorials/utils/2_lru_cache.py +++ b/tutorials/utils/2_lru_cache.py @@ -3,7 +3,7 @@ # 2. LRU Cache In this tutorial use of -%mddoclink(dff,utils.turn_caching.singleton_turn_caching,lru_cache) +%mddoclink(api,utils.turn_caching.singleton_turn_caching,lru_cache) function is demonstrated. This function is used a lot like :py:func:`~functools.lru_cache` function and helps saving results of heavy function execution and avoiding recalculation. From adfea27ad0ac92d3cb7e0ea1c8ccf176c14e9530 Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Mon, 2 Oct 2023 02:23:51 +0300 Subject: [PATCH 18/21] add note about index pages. --- docs/source/utils/notebook.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index 7ef78c17c..8ce631be2 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -135,6 +135,9 @@ def link_to_doc_page( To link to the basic script tutorial, pass "script.core.1_basics" (without the "tutorials" prefix). To link to the basic concepts guide, pass "basic_conceptions". + + API index pages are also supported. + Passing "index_pipeline" will link to the "apiref/index_pipeline.html" page. :param anchor: An anchor on the page. (optional) From 664169469816b3f0b8a473f93a2e055d3b699973 Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Mon, 2 Oct 2023 02:29:31 +0300 Subject: [PATCH 19/21] remove markdown wrapping from usage example for `DocumentationLink` --- docs/source/utils/notebook.py | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/docs/source/utils/notebook.py b/docs/source/utils/notebook.py index 8ce631be2..a5341d715 100644 --- a/docs/source/utils/notebook.py +++ b/docs/source/utils/notebook.py @@ -77,35 +77,22 @@ class DocumentationLink(ReplacePattern): USAGE EXAMPLES -------------- - [index_pipeline](%doclink(api,index_pipeline)) -> [index_pipeline]( - ../apiref/index_pipeline.rst - ) + %doclink(api,index_pipeline)) -> ../apiref/index_pipeline.rst - [script](%doclink(api,script.core.script)) -> [script]( - ../apiref/dff.script.core.script.rst - ) + %doclink(api,script.core.script) -> ../apiref/dff.script.core.script.rst - [Node](%doclink(api,script.core.script,Node)) -> [Node]( - ../apiref/dff.script.core.script.rst#dff.script.core.script.Node - ) + %doclink(api,script.core.script,Node) -> ../apiref/dff.script.core.script.rst#dff.script.core.script.Node - [4_streamlit_chat](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) -> [4_streamlit_chat]( - ../tutorials/tutorials.messengers.web_api_interface.4_streamlit_chat.py - ) + %doclink(tutorial,messengers.web_api_interface.4_streamlit_chat)) -> + ../tutorials/tutorials.messengers.web_api_interface.4_streamlit_chat.py - [API-configuration](%doclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration)) - -> [API-configuration]( - ../tutorials/tutorials.messengers.web_api_interface.4_streamlit_chat.py#API-configuration - ) + %doclink(tutorial,messengers.web_api_interface.4_streamlit_chat,API-configuration) -> + ../tutorials/tutorials.messengers.web_api_interface.4_streamlit_chat.py#API-configuration - [basic_conceptions](%doclink(guide,basic_conceptions)) -> [basic_conceptions]( - ../user_guides/basic_conceptions.rst - ) + %doclink(guide,basic_conceptions) -> ../user_guides/basic_conceptions.rst - [example-conversational-chat-bot](%doclink(guide,basic_conceptions,example-conversational-chat-bot)) - -> [example-conversational-chat-bot]( - ../user_guides/basic_conceptions.rst#example-conversational-chat-bot - ) + %doclink(guide,basic_conceptions,example-conversational-chat-bot) -> + ../user_guides/basic_conceptions.rst#example-conversational-chat-bot """ From ce9898f65b7b2215447903115b031d3618950f47 Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Mon, 2 Oct 2023 02:43:35 +0300 Subject: [PATCH 20/21] use `mddoclink` in benchmark tutorial && minor changes to the tutorial --- .../context_storages/8_db_benchmarking.py | 59 +++++++++---------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/tutorials/context_storages/8_db_benchmarking.py b/tutorials/context_storages/8_db_benchmarking.py index 6793e6ac7..2c88de3ee 100644 --- a/tutorials/context_storages/8_db_benchmarking.py +++ b/tutorials/context_storages/8_db_benchmarking.py @@ -50,34 +50,28 @@ Benchmark results are saved to files. For that there exist two functions: -[benchmark_all]( -%doclink(api,utils.db_benchmark.benchmark,benchmark_all) -) +%mddoclink(api,utils.db_benchmark.benchmark,benchmark_all) and -[save_results_to_file]( -%doclink(api,utils.db_benchmark.benchmark,save_results_to_file) -). +%mddoclink(api,utils.db_benchmark.benchmark,save_results_to_file). Note: context storages passed into these functions will be cleared. ### Configuration The first one is a higher-level wrapper of the second one. -The first function accepts [BenchmarkCases]( -%doclink(api,utils.db_benchmark.benchmark,BenchmarkCase) -) which configure databases that are being benchmark and configurations of the benchmarks. +The first function accepts +%mddoclink(api,utils.db_benchmark.benchmark,BenchmarkCase) +which configure databases that are being benchmark and configurations of the benchmarks. The second function accepts only a single URI for the database and several benchmark configurations. So, the second function is simpler to use, while the first function allows for more configuration (e.g. having different databases benchmarked in a single file). -Both function use [BenchmarkConfig]( -%doclink(api,utils.db_benchmark.benchmark,BenchmarkConfig) -) to configure benchmark behaviour. +Both function use +%mddoclink(api,utils.db_benchmark.benchmark,BenchmarkConfig) +to configure benchmark behaviour. `BenchmarkConfig` is only an interface for benchmark configurations. Its most basic implementation is -[BasicBenchmarkConfig]( -%doclink(api,utils.db_benchmark.basic_config,BasicBenchmarkConfig) -). +%mddoclink(api,utils.db_benchmark.basic_config,BasicBenchmarkConfig). It has several parameters: @@ -125,9 +119,9 @@ """ ## Viewing benchmark results -Now that the results are saved to a file you can either view them using [report]( -%doclink(api,utils.db_benchmark.report,report) -) function or [our streamlit app]( +Now that the results are saved to a file you can either view them using the +%mddoclink(api,utils.db_benchmark.report,report) +function or [our streamlit app]( ../_misc/benchmark_streamlit.py ). """ @@ -187,21 +181,24 @@ ### Configuration presets -The [dff.utils.db_benchmarks.basic_config]( -%doclink(api,utils.db_benchmark.basic_config) -) module also includes a dictionary containing configuration presets. +The +%mddoclink(api,utils.db_benchmark.basic_config) +module also includes a dictionary containing configuration presets. Those cover various contexts and messages as well as some edge cases. - -To use configuration presets, simply pass them to benchmark functions. """ # %% -print(benchmark.basic_configurations.keys()) +print(benchmark.basic_config.basic_configurations.keys()) -# benchmark.benchmark_all( -# ..., -# benchmark_configs=benchmark.basic_configurations -# ) +# %% [markdown] +""" +To use configuration presets, simply pass them to benchmark functions: + + benchmark.benchmark_all( + ..., + benchmark_configs=benchmark.basic_configurations + ) +""" # %% [markdown] """ @@ -209,9 +206,9 @@ If the basic configuration is not enough for you, you can create your own. -To do so, inherit from the [dff.utils.db_benchmark.benchmark.BenchmarkConfig]( -%doclink(api,utils.db_benchmark.benchmark,BenchmarkConfig) -) class. You need to define three methods: +To do so, inherit from the +%mddoclink(api,utils.db_benchmark.benchmark,BenchmarkConfig) +class. You need to define three methods: - `get_context` -- method to get initial contexts. - `info` -- method for getting display info representing the configuration. From b54a737dc288cce32c78c5a2b7f9b870818870b6 Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Mon, 2 Oct 2023 02:53:02 +0300 Subject: [PATCH 21/21] minor corrections to cache tutorial descriptions --- tutorials/utils/1_cache.py | 8 +++++--- tutorials/utils/2_lru_cache.py | 11 +++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tutorials/utils/1_cache.py b/tutorials/utils/1_cache.py index a6617f64f..bc1235551 100644 --- a/tutorials/utils/1_cache.py +++ b/tutorials/utils/1_cache.py @@ -5,10 +5,12 @@ In this tutorial use of %mddoclink(api,utils.turn_caching.singleton_turn_caching,cache) function is demonstrated. -This function is used a lot like :py:func:`~functools.cache` function and -helps saving results of heavy function execution and avoiding recalculation. + +This function is used a lot like `functools.cache` function and +helps by saving results of heavy function execution and avoiding recalculation. + Caches are kept in a library-wide singleton -and cleared in the end of each turn. +and are cleared at the end of each turn. """ # %pip install dff diff --git a/tutorials/utils/2_lru_cache.py b/tutorials/utils/2_lru_cache.py index 58b00a2c0..0aaf326bc 100644 --- a/tutorials/utils/2_lru_cache.py +++ b/tutorials/utils/2_lru_cache.py @@ -5,11 +5,14 @@ In this tutorial use of %mddoclink(api,utils.turn_caching.singleton_turn_caching,lru_cache) function is demonstrated. -This function is used a lot like :py:func:`~functools.lru_cache` function and -helps saving results of heavy function execution and avoiding recalculation. + +This function is used a lot like `functools.lru_cache` function and +helps by saving results of heavy function execution and avoiding recalculation. + Caches are kept in a library-wide singleton -and cleared in the end of each turn. -Maximum size parameter limits amount of function execution result cached. +and are cleared at the end of each turn. + +Maximum size parameter limits the amount of function execution results cached. """ # %pip install dff