MAINT: add _async suffix to async helpers in pyrit/common#1744
Open
romanlutz wants to merge 5 commits into
Open
MAINT: add _async suffix to async helpers in pyrit/common#1744romanlutz wants to merge 5 commits into
romanlutz wants to merge 5 commits into
Conversation
Renames the following async helpers to comply with the PyRIT style guide requirement that all async functions end with _async. Old names are kept as thin deprecation wrappers that delegate to the new names and emit DeprecationWarning. They will be removed in v0.16.0. - convert_local_image_to_data_url -> convert_local_image_to_data_url_async - display_image_response -> display_image_response_async - download_specific_files -> download_specific_files_async - download_chunk -> download_chunk_async - download_file -> download_file_async - download_files -> download_files_async - download_with_limit -> download_with_limit_async (nested helper, renamed in place) Updates all internal call sites and test patches to use the new names, and adds deprecation-warning tests for each module-level wrapper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…anch Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…x-renames # Conflicts: # pyrit/executor/attack/printer/console_printer.py # tests/unit/executor/attack/printer/test_console_printer.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The PyRIT style guide mandates that every
async deffunction end with the_asyncsuffix, but several helpers inpyrit/common/were missing it. This PR renames those helpers, keeps the old names as thin deprecation wrappers (removed inv0.16.0), and updates the internal call sites and test patches accordingly.Renames (with deprecation wrappers that delegate and emit
DeprecationWarning):pyrit/common/data_url_converter.py:convert_local_image_to_data_url->..._asyncpyrit/common/display_response.py:display_image_response->..._asyncpyrit/common/download_hf_model.py:download_specific_files,download_chunk,download_file,download_files-> all..._asyncThe nested local helper
download_with_limitinsidedownload_files_asyncis also renamed todownload_with_limit_asyncin place (not importable, so no deprecation needed).Internal callers updated:
pyrit/prompt_target/openai/openai_chat_target.pypyrit/prompt_target/openai/openai_response_target.pypyrit/prompt_target/websocket_copilot_target.pypyrit/prompt_target/hugging_face/hugging_face_chat_target.pypyrit/message_normalizer/chat_message_normalizer.pypyrit/executor/attack/printer/console_printer.pyTests and Documentation
mock.patchtargets to the new names.pytest.warns(DeprecationWarning, ...)test for each module-level wrapper (convert_local_image_to_data_url,display_image_response,download_specific_files) so the deprecation path is exercised before removal.uv run pytestover the affected test modules: 290 passed, 28 skipped (skips are pre-existing torch-not-installed guards).uv run ruff checkanduv run ruff format --checkclean on all modified files.tytype check (pre-commit) passed on commit.doc/, so no notebook/JupyText updates were needed.