-
Notifications
You must be signed in to change notification settings - Fork 30
fix ruff linter errors #368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses various ruff linter errors by removing unused imports and correcting string formatting in error messages. The changes are mostly cosmetic and aim to comply with updated linter rules without affecting the application’s functionality.
- Removed unused imports and redundant code from multiple modules.
- Updated error message strings to avoid unintended f-string behavior.
- Cleaned up import statements to improve code clarity.
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
genai-perf/genai_perf/telemetry_data/triton_telemetry_data_collector.py | Removed an unused import of Dict and List. |
genai-perf/genai_perf/subcommand/profile.py | Removed unused imports from configuration files. |
genai-perf/genai_perf/subcommand/common.py | Eliminated several redundant imports to reduce noise. |
genai-perf/genai_perf/subcommand/analyze.py | Removed unused variables and imports; updated error-related strings. |
genai-perf/genai_perf/plots/plot_config.py | Removed unnecessary import from collections.abc. |
genai-perf/genai_perf/parser.py | Changed f-string usage in error messages to literal strings for clarity. |
genai-perf/genai_perf/inputs/retrievers/synthetic_image_generator.py | Removed unused Enum import. |
genai-perf/genai_perf/inputs/retrievers/synthetic_audio_generator.py | Removed unused Enum and List imports. |
genai-perf/genai_perf/inputs/input_constants.py | Updated the import of Enum to exclude auto. |
genai-perf/genai_perf/inputs/converters/tensorrtllm_engine_converter.py | Removed an unused jinja2 import. |
genai-perf/genai_perf/inputs/converters/dynamic_grpc_converter.py | Fixed string formatting in exception messages. |
genai-perf/genai_perf/goodput_calculator/llm_goodput_calculator.py | Removed an unused Optional and Union from type hints. |
genai-perf/genai_perf/export_data/json_exporter.py | Removed unused Enum import. |
genai-perf/genai_perf/export_data/exporter_config.py | Removed unused argparse alias and pathlib import. |
genai-perf/genai_perf/config/input/config_endpoint.py | Replaced f-string with a literal string in error message. |
genai-perf/genai_perf/config/input/config_command.py | Updated error messages to use literal strings for consistency. |
genai-perf/genai_perf/config/input/base_config.py | Replaced “if not name in” with “if name not in” for clarity. |
genai-perf/genai_perf/config/generate/search_parameters.py | Adjusted error messages to remove redundant f-string markers. |
genai-perf/genai_perf/config/generate/perf_analyzer_config.py | Removed unnecessary f-string markers in CLI argument construction. |
genai-perf/genai_perf/config/generate/genai_perf_config.py | Removed redundant import for argparse. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 question repeated in a few places.
As a one off pass, i think this is good.
But lets automate it from day 1 in the new project.
@@ -195,7 +195,7 @@ def _get_artifact_stimulus_based_on_config( | |||
) -> Optional[List[str]]: | |||
if ( | |||
config.input.prompt_source == PromptSource.PAYLOAD | |||
and not "session_concurrency" in config.perf_analyzer.stimulus | |||
and "session_concurrency" not in config.perf_analyzer.stimulus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these syntactically the same?
@@ -338,7 +338,7 @@ def _add_prompt_source_args(self, config: ConfigCommand) -> List[str]: | |||
prompt_source_args = [] | |||
if ( | |||
config.input.prompt_source == PromptSource.PAYLOAD | |||
and not "session_concurrency" in config.perf_analyzer.stimulus | |||
and "session_concurrency" not in config.perf_analyzer.stimulus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these the same?
Various fixes based on ruff linter errors. Most should be harmless, however worth double checking, in case some rules were broken on purpose in which case we should add a
#noqa
flag to them. In the future I recommend we addruff
checks as standard, but open to discussion.