diff --git a/docs/code_snippets/metrics/add_new_benchmark.py b/docs/code_snippets/metrics/add_new_benchmark.py new file mode 100644 index 0000000..7516352 --- /dev/null +++ b/docs/code_snippets/metrics/add_new_benchmark.py @@ -0,0 +1,9 @@ +from metrics.benchmarks.entity import benchmarks + +@benchmarks.register( + type_="my_category", + description="Description of what is being measured" +) +def benchmark_my_operation() -> None: + # Code whose performance is being measured + pass diff --git a/docs/locales/en/LC_MESSAGES/root/api/app/index.po b/docs/locales/en/LC_MESSAGES/root/api/app/index.po index 32951af..f18dbdd 100644 --- a/docs/locales/en/LC_MESSAGES/root/api/app/index.po +++ b/docs/locales/en/LC_MESSAGES/root/api/app/index.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Argenta \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-13 21:50+0300\n" +"POT-Creation-Date: 2026-02-06 23:44+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -29,32 +29,32 @@ msgid "" "взаимодействие с пользователем, координируя работу всех компонентов: " "роутеров, обработчиков и системных сообщений." msgstr "" -"The ``App`` object is the implementations of your console application. It handles " -"configuration, lifecycle management, command processing, and user " -"interaction, coordinating the work of all components: routers, handlers, " -"and system messages." +"The ``App`` object is the implementations of your console application. It" +" handles configuration, lifecycle management, command processing, and " +"user interaction, coordinating the work of all components: routers, " +"handlers, and system messages." #: ../../root/api/app/index.rst:11 msgid "Инициализация" msgstr "Initialization" -#: ../../root/api/app/index.rst:37 +#: ../../root/api/app/index.rst:31 msgid "Создаёт и настраивает экземпляр приложения." msgstr "Creates and configures an application instance." -#: ../../root/api/app/index.rst:39 +#: ../../root/api/app/index.rst:33 msgid "``prompt``: Приглашение к вводу, отображаемое перед каждой командой." msgstr "``prompt``: Input prompt displayed before each command." -#: ../../root/api/app/index.rst:40 +#: ../../root/api/app/index.rst:34 msgid "``initial_message``: Сообщение, выводимое при запуске приложения." msgstr "``initial_message``: Message displayed when the application starts." -#: ../../root/api/app/index.rst:41 +#: ../../root/api/app/index.rst:35 msgid "``farewell_message``: Сообщение, выводимое при выходе из приложения." msgstr "``farewell_message``: Message displayed when exiting the application." -#: ../../root/api/app/index.rst:42 +#: ../../root/api/app/index.rst:36 msgid "" "``exit_command``: Команда, которая маркируется как триггер для выхода из " "приложения." @@ -62,7 +62,7 @@ msgstr "" "``exit_command``: Command that is marked as a trigger for exiting the " "application." -#: ../../root/api/app/index.rst:43 +#: ../../root/api/app/index.rst:37 msgid "" "``system_router_title``: Заголовок для системного роутера (содержит " "команду выхода)." @@ -70,7 +70,7 @@ msgstr "" "``system_router_title``: Title for the system router (contains the exit " "command)." -#: ../../root/api/app/index.rst:44 +#: ../../root/api/app/index.rst:38 msgid "" "``dividing_line``: Тип разделительной линии (``StaticDividingLine`` или " "``DynamicDividingLine``)." @@ -78,7 +78,7 @@ msgstr "" "``dividing_line``: Type of dividing line (``StaticDividingLine`` or " "``DynamicDividingLine``)." -#: ../../root/api/app/index.rst:45 +#: ../../root/api/app/index.rst:39 msgid "" "``repeat_command_groups_printing``: Если ``True``, список доступных " "команд выводится перед каждым вводом." @@ -86,7 +86,7 @@ msgstr "" "``repeat_command_groups_printing``: If ``True``, the list of available " "commands is displayed before each input." -#: ../../root/api/app/index.rst:46 +#: ../../root/api/app/index.rst:40 msgid "" "``override_system_messages``: Если ``True``, стандартное форматирование " "(цвета, ASCII-арт) отключается." @@ -94,7 +94,7 @@ msgstr "" "``override_system_messages``: If ``True``, standard formatting (colors, " "ASCII art) is disabled." -#: ../../root/api/app/index.rst:47 +#: ../../root/api/app/index.rst:41 msgid "" "``autocompleter``: Экземпляр класса :ref:`AutoCompleter " "`, отвечающий за автодополнение команд." @@ -103,29 +103,28 @@ msgstr "" "` class responsible for command " "autocompletion." -#: ../../root/api/app/index.rst:48 -msgid "" -"``print_func``: Функция для вывода всех системных сообщений (по умолчанию" -" ``rich.Console().print``)." +#: ../../root/api/app/index.rst:42 +#, fuzzy +msgid "``printer``: Функция для вывода всех системных сообщений." msgstr "" "``print_func``: Function for outputting all system messages (defaults to " "``rich.Console().print``)." -#: ../../root/api/app/index.rst:53 +#: ../../root/api/app/index.rst:47 msgid "" "В приложениях на Argenta регистр вводимых команд не важен, проверка на " "существование и роутинг команд производится на основании триггеров, " "приведённых к нижнему регистру." msgstr "" -"In applications on Argenta, the case of the entered commands is not important, checking for the " -" existence and routing of commands is performed based on triggers " -"reduced to lowercase." +"In applications on Argenta, the case of the entered commands is not " +"important, checking for the existence and routing of commands is " +"performed based on triggers reduced to lowercase." -#: ../../root/api/app/index.rst:56 +#: ../../root/api/app/index.rst:50 msgid "Основные методы" msgstr "Main Methods" -#: ../../root/api/app/index.rst:60 +#: ../../root/api/app/index.rst:54 msgid "" "Регистрирует роутер в приложении. Все команды из этого роутера становятся" " доступными для вызова." @@ -137,19 +136,19 @@ msgstr "" msgid "Parameters" msgstr "Parameters" -#: ../../root/api/app/index.rst:62 +#: ../../root/api/app/index.rst:56 msgid "Экземпляр ``Router`` для регистрации." msgstr "``Router`` instance to register." -#: ../../root/api/app/index.rst:66 +#: ../../root/api/app/index.rst:60 msgid "Регистрирует несколько роутеров одновременно." msgstr "Registers multiple routers simultaneously." -#: ../../root/api/app/index.rst:68 +#: ../../root/api/app/index.rst:62 msgid "Последовательность экземпляров ``Router`` для регистрации." msgstr "Sequence of ``Router`` instances to register." -#: ../../root/api/app/index.rst:72 +#: ../../root/api/app/index.rst:66 msgid "" "Добавляет текстовое сообщение, которое выводится при запуске приложения " "после ``initial_message``." @@ -157,11 +156,11 @@ msgstr "" "Adds a text message that is displayed when the application starts after " "``initial_message``." -#: ../../root/api/app/index.rst:74 +#: ../../root/api/app/index.rst:68 msgid "Строка с сообщением." msgstr "String with the message." -#: ../../root/api/app/index.rst:77 +#: ../../root/api/app/index.rst:71 msgid "" "Для вывода стандартных сообщений можно использовать готовые шаблоны из " ":ref:`PredefinedMessages `." @@ -169,11 +168,11 @@ msgstr "" "For outputting standard messages, you can use ready-made templates from " ":ref:`PredefinedMessages `." -#: ../../root/api/app/index.rst:82 +#: ../../root/api/app/index.rst:76 msgid "Методы установки обработчиков" msgstr "Handler Setup Methods" -#: ../../root/api/app/index.rst:84 +#: ../../root/api/app/index.rst:78 msgid "" "``App`` позволяет настраивать реакцию на различные события, такие как " "ошибки ввода или неизвестные команды." @@ -181,7 +180,7 @@ msgstr "" "``App`` allows you to configure responses to various events, such as " "input errors or unknown commands." -#: ../../root/api/app/index.rst:87 +#: ../../root/api/app/index.rst:81 msgid "" "Подробнее об исключениях и их обработке в соответствующем :ref:`разделе " "документации `." @@ -189,59 +188,59 @@ msgstr "" "For more details on exceptions and their handling, see the corresponding " ":ref:`documentation section `." -#: ../../root/api/app/index.rst:93 +#: ../../root/api/app/index.rst:87 msgid "Устанавливает шаблон для форматирования описания команды." msgstr "Sets the template for formatting command descriptions." -#: ../../root/api/app/index.rst:95 +#: ../../root/api/app/index.rst:89 msgid "Обработчик принимает триггер команды (``str``) и её описание (``str``)." msgstr "" "The handler accepts the command trigger (``str``) and its description " "(``str``)." -#: ../../root/api/app/index.rst:101 +#: ../../root/api/app/index.rst:95 msgid "Устанавливает обработчик при некорректном введённом синтаксисе флагов." msgstr "Sets the handler for incorrect flag syntax input." -#: ../../root/api/app/index.rst:103 ../../root/api/app/index.rst:111 +#: ../../root/api/app/index.rst:97 ../../root/api/app/index.rst:105 msgid "Обработчик принимает строку, введённую пользователем." msgstr "The handler accepts the string entered by the user." -#: ../../root/api/app/index.rst:109 +#: ../../root/api/app/index.rst:103 msgid "Устанавливает обработчик при повторяющихся флагах в введённой команде." msgstr "Sets the handler for duplicate flags in the entered command." -#: ../../root/api/app/index.rst:117 +#: ../../root/api/app/index.rst:111 msgid "Устанавливает обработчик при вводе неизвестной команды." msgstr "Sets the handler for entering an unknown command." -#: ../../root/api/app/index.rst:119 +#: ../../root/api/app/index.rst:113 msgid "Обработчик принимает объект ``InputCommand`` - объект введённой команды." msgstr "" "The handler accepts an ``InputCommand`` object - the entered command " "object." -#: ../../root/api/app/index.rst:125 +#: ../../root/api/app/index.rst:119 msgid "Устанавливает обработчик при вводе пустой строки." msgstr "Sets the handler for entering an empty string." -#: ../../root/api/app/index.rst:127 +#: ../../root/api/app/index.rst:121 msgid "Обработчик не принимает аргументов." msgstr "The handler accepts no arguments." -#: ../../root/api/app/index.rst:133 +#: ../../root/api/app/index.rst:127 msgid "Переопределяет стандартное поведение при вызове команды выхода." msgstr "Overrides the default behavior when the exit command is invoked." -#: ../../root/api/app/index.rst:135 +#: ../../root/api/app/index.rst:129 msgid "Обработчик принимает объект ``Response``." msgstr "The handler accepts a ``Response`` object." -#: ../../root/api/app/index.rst:148 +#: ../../root/api/app/index.rst:142 msgid "PredefinedMessages" msgstr "PredefinedMessages" -#: ../../root/api/app/index.rst:150 +#: ../../root/api/app/index.rst:144 msgid "" "``PredefinedMessages`` — это контейнер, содержащий набор готовых к " "использованию сообщений. Они отформатированы с использованием синтаксиса " @@ -252,31 +251,31 @@ msgstr "" "messages. They are formatted using ``rich`` syntax and are intended for " "displaying standard information, such as usage hints." -#: ../../root/api/app/index.rst:152 +#: ../../root/api/app/index.rst:146 msgid "Рекомендуется использовать их при старте приложения." msgstr "It is recommended to use them when starting the application." -#: ../../root/api/app/index.rst:179 +#: ../../root/api/app/index.rst:173 msgid "Строка: ``[b dim]Usage[/b dim]: [i] <[green]flags[/green]>[/i]``" msgstr "String: ``[b dim]Usage[/b dim]: [i] <[green]flags[/green]>[/i]``" -#: ../../root/api/app/index.rst:181 +#: ../../root/api/app/index.rst:175 msgid "Отображается как: ``Usage: ``" msgstr "Displayed as: ``Usage: ``" -#: ../../root/api/app/index.rst:185 +#: ../../root/api/app/index.rst:179 msgid "Строка: ``[b dim]Help[/b dim]: [i][/i] [b red]--help[/b red]``" msgstr "String: ``[b dim]Help[/b dim]: [i][/i] [b red]--help[/b red]``" -#: ../../root/api/app/index.rst:187 +#: ../../root/api/app/index.rst:181 msgid "Отображается как: ``Help: --help``" msgstr "Displayed as: ``Help: --help``" -#: ../../root/api/app/index.rst:191 +#: ../../root/api/app/index.rst:185 msgid "Строка: ``[b dim]Autocomplete[/b dim]: [i][/i] [bold]``" msgstr "String: ``[b dim]Autocomplete[/b dim]: [i][/i] [bold]``" -#: ../../root/api/app/index.rst:193 +#: ../../root/api/app/index.rst:187 msgid "Отображается как: ``Autocomplete: ``" msgstr "Displayed as: ``Autocomplete: ``" diff --git a/docs/locales/en/LC_MESSAGES/root/api/orchestrator/argparser.po b/docs/locales/en/LC_MESSAGES/root/api/orchestrator/argparser.po index b45ecd7..24acdc5 100644 --- a/docs/locales/en/LC_MESSAGES/root/api/orchestrator/argparser.po +++ b/docs/locales/en/LC_MESSAGES/root/api/orchestrator/argparser.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Argenta \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-02 22:29+0300\n" +"POT-Creation-Date: 2026-02-06 23:44+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -30,10 +30,11 @@ msgid "" "позволяет получать внешнюю конфигурацию в момент старта (например, путь к" " файлу настроек, флаги отладки или режим запуска)." msgstr "" -"``ArgParser`` is designed for processing **command-line arguments** passed to the " -"application at startup. It's important not to confuse them with flags that the user " -"enters in interactive mode. ``ArgParser`` allows receiving external configuration at " -"startup (e.g., path to settings file, debug flags, or launch mode)." +"``ArgParser`` is designed for processing **command-line arguments** " +"passed to the application at startup. It's important not to confuse them " +"with flags that the user enters in interactive mode. ``ArgParser`` allows" +" receiving external configuration at startup (e.g., path to settings " +"file, debug flags, or launch mode)." #: ../../root/api/orchestrator/argparser.rst:11 msgid "Инициализация" @@ -81,8 +82,9 @@ msgid "" "экземпляр ``ArgParser``, атрибут ``parsed_argspace`` будет содержать " "пустой ``ArgSpace``." msgstr "" -"Before initializing ``Orchestrator``, to whose constructor an ``ArgParser`` instance " -"was passed, the ``parsed_argspace`` attribute will contain an empty ``ArgSpace``." +"Before initializing ``Orchestrator``, to whose constructor an " +"``ArgParser`` instance was passed, the ``parsed_argspace`` attribute will" +" contain an empty ``ArgSpace``." #: ../../root/api/orchestrator/argparser.rst:40 msgid "" @@ -90,8 +92,9 @@ msgid "" "``Orchestrator``, поэтому использовать ``parsed_argspace`` " "**целесообразно только после** этого." msgstr "" -"Parsing and validation of arguments occur during ``Orchestrator`` initialization, " -"so using ``parsed_argspace`` is **advisable only after** that." +"Parsing and validation of arguments occur during ``Orchestrator`` " +"initialization, so using ``parsed_argspace`` is **advisable only after** " +"that." #: ../../root/api/orchestrator/argparser.rst:45 msgid "Лучшие практики" @@ -104,9 +107,10 @@ msgid "" "``ArgSpace`` через DI. Подробнее см. :ref:`здесь " "`." msgstr "" -"Using the ``parsed_argspace`` attribute is recommended only during the application " -"setup phase. In handlers, the best practice is to obtain ``ArgSpace`` through DI. " -"For more details, see :ref:`here `." +"Using the ``parsed_argspace`` attribute is recommended only during the " +"application setup phase. In handlers, the best practice is to obtain " +"``ArgSpace`` through DI. For more details, see :ref:`here " +"`." #: ../../root/api/orchestrator/argparser.rst:49 msgid "**Пример использования:**" @@ -129,8 +133,8 @@ msgid "" "При работе с аргументами командной строки стандартный ``ArgumentParser`` " "автоматически обрабатывает следующие ситуации:" msgstr "" -"When working with command-line arguments, the standard ``ArgumentParser`` " -"automatically handles the following situations:" +"When working with command-line arguments, the standard ``ArgumentParser``" +" automatically handles the following situations:" #: ../../root/api/orchestrator/argparser.rst:63 msgid "**Отсутствие обязательного аргумента:**" @@ -149,6 +153,12 @@ msgid "" "При использовании аргумента с ``is_deprecated=True`` выводится " "предупреждение, но выполнение продолжается:" msgstr "" -"When using an argument with ``is_deprecated=True``, a warning is displayed, " -"but execution continues:" +"When using an argument with ``is_deprecated=True``, a warning is " +"displayed, but execution continues:" + +#: ../../root/api/orchestrator/argparser.rst:90 +msgid "" +"Параметр поддерживается начиная с версии CPython 3.13, если версия ниже, " +"то параметр будет игнорироваться." +msgstr "" diff --git a/docs/locales/en/LC_MESSAGES/root/metrics.po b/docs/locales/en/LC_MESSAGES/root/metrics.po new file mode 100644 index 0000000..56b31bb --- /dev/null +++ b/docs/locales/en/LC_MESSAGES/root/metrics.po @@ -0,0 +1,293 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2025, kolo +# This file is distributed under the same license as the Argenta package. +# FIRST AUTHOR , 2026. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Argenta \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-02-06 23:44+0300\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: en\n" +"Language-Team: en \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../root/metrics.rst:2 +msgid "Метрики" +msgstr "Metrics" + +#: ../../root/metrics.rst:4 +msgid "" +"Система метрик ``Argenta`` предоставляет инструменты для измерения " +"производительности ключевых компонентов библиотеки. Это позволяет " +"отслеживать регрессию/прогрессию производительности между релизами и " +"оптимизировать критические участки кода." +msgstr "" +"The ``Argenta`` metrics system provides tools for measuring the performance " +"of key library components. This allows tracking performance regression/progression " +"between releases and optimizing critical code sections." + +#: ../../root/metrics.rst:9 +msgid "Запуск метрик" +msgstr "Running Metrics" + +#: ../../root/metrics.rst:11 +msgid "" +"Для работы с метриками необходимо склонировать репозиторий и установить " +"зависимости:" +msgstr "" +"To work with metrics, you need to clone the repository and install " +"dependencies:" + +#: ../../root/metrics.rst:19 +msgid "Запуск системы метрик:" +msgstr "Running the metrics system:" + +#: ../../root/metrics.rst:25 +msgid "" +"После запуска откроется интерактивная сессия с доступными командами для " +"работы с бенчмарками." +msgstr "" +"After launch, an interactive session will open with available commands for " +"working with benchmarks." + +#: ../../root/metrics.rst:30 +msgid "Доступные команды" +msgstr "Available Commands" + +#: ../../root/metrics.rst:33 +msgid "run-all" +msgstr "run-all" + +#: ../../root/metrics.rst:35 +msgid "" +"Запускает все зарегистрированные бенчмарки и выводит результаты в виде " +"таблиц." +msgstr "" +"Runs all registered benchmarks and outputs results as tables." + +#: ../../root/metrics.rst:37 ../../root/metrics.rst:55 +#: ../../root/metrics.rst:78 ../../root/metrics.rst:97 +#: ../../root/metrics.rst:117 +msgid "**Синтаксис:**" +msgstr "**Syntax:**" + +#: ../../root/metrics.rst:43 ../../root/metrics.rst:84 +#: ../../root/metrics.rst:103 +msgid "**Флаги:**" +msgstr "**Flags:**" + +#: ../../root/metrics.rst:45 +msgid "" +"``--without-gc`` — отключает сборщик мусора во время выполнения " +"бенчмарков для более стабильных результатов" +msgstr "" +"``--without-gc`` — disables garbage collector during benchmark execution " +"for more stable results" + +#: ../../root/metrics.rst:46 +msgid "``--without-system-info`` — скрывает информацию о системе в выводе" +msgstr "``--without-system-info`` — hides system information in output" + +#: ../../root/metrics.rst:51 +msgid "list-types" +msgstr "list-types" + +#: ../../root/metrics.rst:53 +msgid "" +"Выводит список всех доступных типов бенчмарков с количеством тестов в " +"каждой категории." +msgstr "" +"Displays a list of all available benchmark types with the number of tests " +"in each category." + +#: ../../root/metrics.rst:61 +msgid "**Пример вывода:**" +msgstr "**Example output:**" + +#: ../../root/metrics.rst:74 +msgid "run-type" +msgstr "run-type" + +#: ../../root/metrics.rst:76 +msgid "Запускает бенчмарки определённого типа." +msgstr "Runs benchmarks of a specific type." + +#: ../../root/metrics.rst:86 +msgid "``--type`` — тип бенчмарков для запуска (обязательный)" +msgstr "``--type`` — benchmark type to run (required)" + +#: ../../root/metrics.rst:87 ../../root/metrics.rst:106 +msgid "``--without-gc`` — отключает сборщик мусора" +msgstr "``--without-gc`` — disables garbage collector" + +#: ../../root/metrics.rst:88 +msgid "``--without-system-info`` — скрывает информацию о системе" +msgstr "``--without-system-info`` — hides system information" + +#: ../../root/metrics.rst:93 +msgid "diagrams-generate" +msgstr "diagrams-generate" + +#: ../../root/metrics.rst:95 +msgid "" +"Генерирует визуальные диаграммы сравнения производительности для всех " +"бенчмарков." +msgstr "" +"Generates visual performance comparison diagrams for all benchmarks." + +#: ../../root/metrics.rst:105 +msgid "" +"``--iterations`` — количество итераций для каждого бенчмарка (по " +"умолчанию 100)" +msgstr "" +"``--iterations`` — number of iterations for each benchmark (default 100)" + +#: ../../root/metrics.rst:108 +msgid "" +"Диаграммы сохраняются в директорию " +"``metrics/reports/diagrams//``." +msgstr "" +"Diagrams are saved to the ``metrics/reports/diagrams//`` directory." + +#: ../../root/metrics.rst:113 +msgid "release-generate" +msgstr "release-generate" + +#: ../../root/metrics.rst:115 +msgid "" +"Генерирует полный отчёт о производительности для текущей версии " +"библиотеки. Используется при подготовке релизов." +msgstr "" +"Generates a complete performance report for the current library version. " +"Used when preparing releases." + +#: ../../root/metrics.rst:123 +msgid "Команда автоматически:" +msgstr "The command automatically:" + +#: ../../root/metrics.rst:125 +msgid "Определяет текущую версию библиотеки" +msgstr "Determines the current library version" + +#: ../../root/metrics.rst:126 +msgid "Запускает все бенчмарки с 1000 итераций и отключённым GC" +msgstr "Runs all benchmarks with 1000 iterations and disabled GC" + +#: ../../root/metrics.rst:127 +msgid "Генерирует JSON-отчёты и диаграммы сравнения" +msgstr "Generates JSON reports and comparison diagrams" + +#: ../../root/metrics.rst:128 +msgid "Сохраняет результаты в ``metrics/reports/releases//``" +msgstr "Saves results to ``metrics/reports/releases//``" + +#: ../../root/metrics.rst:133 +msgid "Интерпретация результатов" +msgstr "Interpreting Results" + +#: ../../root/metrics.rst:135 +msgid "Результаты бенчмарков включают следующие метрики:" +msgstr "Benchmark results include the following metrics:" + +#: ../../root/metrics.rst:137 +msgid "**Среднее время (mean)**" +msgstr "**Mean time (mean)**" + +#: ../../root/metrics.rst:138 +msgid "" +"Среднее время выполнения операции. Основная метрика для сравнения " +"производительности." +msgstr "" +"Average operation execution time. The primary metric for performance comparison." + +#: ../../root/metrics.rst:140 +msgid "**Медиана (median)**" +msgstr "**Median (median)**" + +#: ../../root/metrics.rst:141 +msgid "" +"Медианное значение времени выполнения. Менее чувствительна к выбросам, " +"чем среднее." +msgstr "" +"Median execution time value. Less sensitive to outliers than the mean." + +#: ../../root/metrics.rst:143 +msgid "**Стандартное отклонение (std)**" +msgstr "**Standard deviation (std)**" + +#: ../../root/metrics.rst:144 +msgid "" +"Показывает стабильность измерений. Меньшее значение означает более " +"предсказуемую производительность." +msgstr "" +"Shows measurement stability. A lower value means more predictable performance." + +#: ../../root/metrics.rst:149 +msgid "Рекомендации по использованию" +msgstr "Usage Recommendations" + +#: ../../root/metrics.rst:151 +msgid "**Для оптимизации**" +msgstr "**For optimization**" + +#: ../../root/metrics.rst:152 +msgid "" +"Используйте ``run-type`` для фокусировки на конкретной области и " +"``--without-gc`` для более точных измерений." +msgstr "" +"Use ``run-type`` to focus on a specific area and ``--without-gc`` for more " +"accurate measurements." + +#: ../../root/metrics.rst:154 +msgid "**Для визуализации**" +msgstr "**For visualization**" + +#: ../../root/metrics.rst:155 +msgid "" +"Команда ``diagrams-generate`` создаёт наглядные графики, удобные для " +"презентаций и документации." +msgstr "" +"The ``diagrams-generate`` command creates clear charts suitable for " +"presentations and documentation." + +#: ../../root/metrics.rst:157 +msgid "**Для стабильных результатов**" +msgstr "**For stable results**" + +#: ../../root/metrics.rst:158 +msgid "" +"Закройте ресурсоёмкие приложения, используйте флаг ``--without-gc`` и " +"увеличивайте количество итераций через ``--iterations``." +msgstr "" +"Close resource-intensive applications, use the ``--without-gc`` flag, and " +"increase the number of iterations via ``--iterations``." + +#: ../../root/metrics.rst:163 +msgid "Добавление новых бенчмарков" +msgstr "Adding New Benchmarks" + +#: ../../root/metrics.rst:165 +msgid "" +"Вы можете реализовать свои бенчмарки для тестирования специфичных юнитов " +"библиотеки. Новые бенчмарки добавляются через декоратор " +"``@benchmarks.register``:" +msgstr "" +"You can implement your own benchmarks to test specific library units. " +"New benchmarks are added via the ``@benchmarks.register`` decorator:" + +#: ../../root/metrics.rst:173 +msgid "" +"Бенчмарк должен быть импортирован в ``metrics/benchmarks/__init__.py`` " +"для автоматической регистрации." +msgstr "" +"The benchmark must be imported in ``metrics/benchmarks/__init__.py`` for " +"automatic registration." + diff --git a/docs/locales/en/LC_MESSAGES/root/overriding_formatting.po b/docs/locales/en/LC_MESSAGES/root/overriding_formatting.po index 9c72754..95c947a 100644 --- a/docs/locales/en/LC_MESSAGES/root/overriding_formatting.po +++ b/docs/locales/en/LC_MESSAGES/root/overriding_formatting.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Argenta \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-04 20:39+0300\n" +"POT-Creation-Date: 2026-02-06 23:44+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: en\n" @@ -90,20 +90,20 @@ msgstr "Output Customization" #: ../../root/overriding_formatting.rst:32 msgid "" "Для полной замены логики вывода текста в конструкторе ``App`` " -"предусмотрен параметр ``print_func``." +"предусмотрен параметр ``printer``." msgstr "" "For complete replacement of text output logic, the ``App`` constructor " -"provides the ``print_func`` parameter." +"provides the ``printer`` parameter." #: ../../root/overriding_formatting.rst:34 msgid "" -"**print_func**: ``Callable[[str], None]`` Этот параметр позволяет " -"передать любую вызываемую сущность (например, функцию), которая будет " +"**printer**: ``Callable[[str], None]`` Этот параметр позволяет передать " +"любую вызываемую сущность (например, функцию), которая будет " "использоваться для вывода всех системных сообщений. По умолчанию это " "``rich.console.Console().print``. Вы можете передать сюда свою функцию, " "чтобы, например, логировать вывод в файл или отправлять его по сети." msgstr "" -"**print_func**: ``Callable[[str], None]`` This parameter allows passing " +"**printer**: ``Callable[[str], None]`` This parameter allows passing " "any callable entity (for example, a function) that will be used to output" " all system messages. By default, this is " "``rich.console.Console().print``. You can pass your own function here to," diff --git a/docs/root/metrics.rst b/docs/root/metrics.rst index 24dcead..5c37805 100644 --- a/docs/root/metrics.rst +++ b/docs/root/metrics.rst @@ -164,17 +164,9 @@ release-generate Вы можете реализовать свои бенчмарки для тестирования специфичных юнитов библиотеки. Новые бенчмарки добавляются через декоратор ``@benchmarks.register``: -.. code-block:: python - - from metrics.benchmarks.entity import benchmarks - - @benchmarks.register( - type_="my_category", - description="Description of what is being measured" - ) - def benchmark_my_operation() -> None: - # Код, производительность которого измеряется - pass +.. literalinclude:: ../code_snippets/metrics/add_new_benchmark.py + :language: python + :linenos: .. important:: diff --git a/src/argenta/app/autocompleter/entity.py b/src/argenta/app/autocompleter/entity.py index bdddf0c..8b0704d 100644 --- a/src/argenta/app/autocompleter/entity.py +++ b/src/argenta/app/autocompleter/entity.py @@ -3,13 +3,14 @@ __all__ = ["AutoCompleter"] import sys from typing import Callable, Iterable -from prompt_toolkit import PromptSession, HTML +from prompt_toolkit import HTML, PromptSession from prompt_toolkit.auto_suggest import AutoSuggestFromHistory -from prompt_toolkit.completion import Completer, Completion, CompleteEvent, ThreadedCompleter +from prompt_toolkit.completion import (CompleteEvent, Completer, Completion, + ThreadedCompleter) from prompt_toolkit.cursor_shapes import CursorShape from prompt_toolkit.document import Document from prompt_toolkit.formatted_text import StyleAndTextTuples -from prompt_toolkit.history import History, ThreadedHistory, FileHistory, InMemoryHistory +from prompt_toolkit.history import FileHistory, History, InMemoryHistory, ThreadedHistory from prompt_toolkit.key_binding import KeyBindings, KeyPressEvent from prompt_toolkit.lexers import Lexer from prompt_toolkit.styles import Style diff --git a/src/argenta/app/behavior_handlers/models.py b/src/argenta/app/behavior_handlers/models.py index c997803..49a0161 100644 --- a/src/argenta/app/behavior_handlers/models.py +++ b/src/argenta/app/behavior_handlers/models.py @@ -1,15 +1,11 @@ from rich.markup import escape -from argenta.response.entity import Response from argenta.app.presentation.renderers import Renderer -from argenta.app.protocols import ( - NonStandardBehaviorHandler, - EmptyCommandHandler, - Printer, - MostSimilarCommandGetter, - DescriptionMessageGenerator, -) +from argenta.app.protocols import (DescriptionMessageGenerator, EmptyCommandHandler, + MostSimilarCommandGetter, NonStandardBehaviorHandler, + Printer) from argenta.command import InputCommand +from argenta.response.entity import Response class BehaviorHandlersFabric: diff --git a/src/argenta/app/models.py b/src/argenta/app/models.py index b251e8c..f599a5d 100644 --- a/src/argenta/app/models.py +++ b/src/argenta/app/models.py @@ -1,30 +1,26 @@ __all__ = ["App"] -from typing import Never, TypeAlias import difflib +from typing import Never, TypeAlias from rich.console import Console from argenta.app.autocompleter import AutoCompleter -from argenta.app.behavior_handlers.models import ( - BehaviorHandlersFabric, - BehaviorHandlersSettersMixin, -) -from argenta.app.presentation.renderers import PlainRenderer, RichRenderer, Renderer +from argenta.app.behavior_handlers.models import (BehaviorHandlersFabric, + BehaviorHandlersSettersMixin) from argenta.app.dividing_line.models import DynamicDividingLine, StaticDividingLine +from argenta.app.presentation.renderers import PlainRenderer, Renderer, RichRenderer from argenta.app.presentation.viewers import Viewer from argenta.app.protocols import Printer from argenta.app.registered_routers.entity import RegisteredRouters -from argenta.command.exceptions import ( - InputCommandException, - RepeatedInputFlagsException, - UnprocessedInputFlagException, -) -from argenta.router.exceptions import RepeatedAliasNameException, RepeatedTriggerNameException +from argenta.command.exceptions import (InputCommandException, + RepeatedInputFlagsException, + UnprocessedInputFlagException) from argenta.command.models import Command, InputCommand from argenta.response import Response from argenta.router import Router - +from argenta.router.exceptions import (RepeatedAliasNameException, + RepeatedTriggerNameException) Matches: TypeAlias = list[str] | list[Never] diff --git a/src/argenta/app/presentation/__init__.py b/src/argenta/app/presentation/__init__.py index 606a5d1..bfe06c7 100644 --- a/src/argenta/app/presentation/__init__.py +++ b/src/argenta/app/presentation/__init__.py @@ -1,4 +1,4 @@ -from .renderers import Renderer, RichRenderer, PlainRenderer +from .renderers import PlainRenderer, Renderer, RichRenderer from .viewers import Viewer __all__ = ["Renderer", "RichRenderer", "PlainRenderer", "Viewer"] diff --git a/src/argenta/app/presentation/viewers.py b/src/argenta/app/presentation/viewers.py index a6698fe..29f6cf5 100644 --- a/src/argenta/app/presentation/viewers.py +++ b/src/argenta/app/presentation/viewers.py @@ -3,16 +3,15 @@ __all__ = ["Viewer"] import re from contextlib import redirect_stdout from io import StringIO -from typing import Iterable, Callable, TypeAlias +from typing import Callable, Iterable, TypeAlias from rich.text import Text -from argenta.app import StaticDividingLine, DynamicDividingLine +from argenta.app import DynamicDividingLine, StaticDividingLine from argenta.app.presentation.renderers import Renderer -from argenta.app.protocols import Printer, DescriptionMessageGenerator +from argenta.app.protocols import DescriptionMessageGenerator, Printer from argenta.app.registered_routers.entity import RegisteredRouters - AVAILABLE_DIVIDING_LINES: TypeAlias = StaticDividingLine | DynamicDividingLine | None diff --git a/src/argenta/command/__init__.py b/src/argenta/command/__init__.py index 3b57a28..070f53d 100644 --- a/src/argenta/command/__init__.py +++ b/src/argenta/command/__init__.py @@ -1,7 +1,8 @@ from argenta.command.flag import Flag as Flag -from argenta.command.flag.models import Flags as Flags, InputFlags as InputFlags from argenta.command.flag import InputFlag as InputFlag from argenta.command.flag import PossibleValues as PossibleValues from argenta.command.flag.defaults import PredefinedFlags as PredefinedFlags +from argenta.command.flag.models import Flags as Flags +from argenta.command.flag.models import InputFlags as InputFlags from argenta.command.models import Command as Command from argenta.command.models import InputCommand as InputCommand diff --git a/src/argenta/command/flag/__init__.py b/src/argenta/command/flag/__init__.py index 58d4991..148d4b3 100644 --- a/src/argenta/command/flag/__init__.py +++ b/src/argenta/command/flag/__init__.py @@ -1,5 +1,6 @@ -from argenta.command.flag.models import Flags as Flags, InputFlags as InputFlags from argenta.command.flag.models import Flag as Flag +from argenta.command.flag.models import Flags as Flags from argenta.command.flag.models import InputFlag as InputFlag +from argenta.command.flag.models import InputFlags as InputFlags from argenta.command.flag.models import PossibleValues as PossibleValues from argenta.command.flag.models import ValidationStatus as ValidationStatus diff --git a/src/argenta/command/flag/models.py b/src/argenta/command/flag/models.py index 77500a3..b0d7c3e 100644 --- a/src/argenta/command/flag/models.py +++ b/src/argenta/command/flag/models.py @@ -2,7 +2,7 @@ __all__ = ["PossibleValues", "ValidationStatus", "Flag", "InputFlag", "InputFlag from enum import Enum from re import Pattern -from typing import Literal, override, TypeVar, Generic, Iterator, Any, Container +from typing import Any, Container, Generic, Iterator, Literal, TypeVar, override PREFIX_TYPE = Literal["-", "--", "---"] diff --git a/src/argenta/command/models.py b/src/argenta/command/models.py index d608e65..d54ad40 100644 --- a/src/argenta/command/models.py +++ b/src/argenta/command/models.py @@ -1,14 +1,12 @@ __all__ = ["Command", "InputCommand"] import shlex -from typing import Literal, Never, Self, cast, Iterable +from typing import Iterable, Literal, Never, Self, cast -from argenta.command.exceptions import ( - EmptyInputCommandException, - RepeatedInputFlagsException, - UnprocessedInputFlagException, -) from argenta.command import Flags, InputFlags +from argenta.command.exceptions import (EmptyInputCommandException, + RepeatedInputFlagsException, + UnprocessedInputFlagException) from argenta.command.flag.models import Flag, InputFlag, ValidationStatus ParseFlagsResult = tuple[InputFlags, str | None, str | None]