Repository navigation
[monitor-control-service] Fix invalid escape sequence SyntaxWarning in data-collection rule create example - #10532
Open
nabeleon94 wants to merge 1 commit into
Open
nabeleon94 wants to merge 1 commit into
nabeleon94 wants to merge 1 commit into
Conversation
…n data-collection rule create example
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Thank you for your contribution nabeleon94! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change addressing the Python 3.12+ invalid-escape warning.
No open issues 🎉
What changed in this PR
Fixes the invalid-escape SyntaxWarning emitted when the monitor-control-service extension loads for az monitor commands on Python 3.12+, addressing #10531 without changing rendered help text.
Changes:
- Escapes backslashes in the data collection rule creation example.
- Bumps the extension version to 1.2.1 and documents the fix.
| File | Description |
|---|---|
src/monitor-control-service/setup.py |
Bumps the extension version to 1.2.1. |
src/monitor-control-service/HISTORY.rst |
Adds a release note describing the warning fix. |
src/monitor-control-service/azext_amcs/aaz/latest/monitor/data_collection/rule/_create.py |
Escapes the example path’s backslashes while preserving help output. |
Review effort: Balanced
Author
|
@microsoft-github-policy-service agree |
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
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.
🤖 PR Validation — ️✔️ All clear
Fixes #10531
Related command
az monitor data-collection rule create(and everyaz monitor ...command, since the extension module is imported while building the command table)Description
With Python 3.12+ (e.g. Azure CLI 2.91.0), any
az monitorhelp/command prints:The class docstring for
monitor data-collection rule createcontains the example path"C:\samples\dcrEx1.json"in a regular (non-raw) string, so\sis an invalid escape. This escapes the backslashes (C:\\samples\\dcrEx1.json), the same way the sibling_update.pyalready writes\\Process(_Total)\\Thread Count. The rendered help text is unchanged.Also bumps the extension to 1.2.1 with a HISTORY entry.
This is the only invalid escape sequence in the extension (checked by compiling every
.pyundersrc/monitor-control-servicewith warnings as errors).Testing
python -W error::SyntaxWarning -c "import azext_amcs.aaz.latest.monitor.data_collection.rule._create"fails withSyntaxError: invalid escape sequence '\s'.Create.__doc__(the help text) is byte-identical to before. It still shows--rule-file "C:\samples\dcrEx1.json".General Guidelines
azdev style <YOUR_EXT>locally? The changed file is# pylint: skip-file/# flake8: noqagenerated code. Only a string literal changed.python scripts/ci/test_index.py -qlocally? Not applicable:src/index.jsonis not modified.