Modification for how nac-validate handles python 3.14 warning messages.#370
Merged
danischm merged 1 commit intonetascode:mainfrom Mar 18, 2026
Merged
Conversation
tzarski0
approved these changes
Mar 12, 2026
danischm
approved these changes
Mar 18, 2026
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.
The need to modify this originates because when users install python 3.14 or later and then try to run nac-validate tool they will see a bunch of warning messages even though they are not breaking anything in their schema or yaml files.
They will see something like this.
nac-validate --version
nac-validate, version 1.2.0
nac-validate -s schemas/schema.yaml -r validation/rules/ data/ .defaults/ -v DEBUG
INFO - Loading schema
:1: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\d"? A raw string is also an option.
:1: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\d"? A raw string is also an option.
:1: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\d"? A raw string is also an option.
:1: SyntaxWarning: "." is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\."? A raw string is also an option.
:1: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\d"? A raw string is also an option.
:1: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\d"? A raw string is also an option.
:1: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\d"? A raw string is also an option.
:1: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\d"? A raw string is also an option.
:1: SyntaxWarning: "[" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\["? A raw string is also an option.
:1: SyntaxWarning: "." is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\."? A raw string is also an option.
:1: SyntaxWarning: "-" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\-"? A raw string is also an option.
:1: SyntaxWarning: "-" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\-"? A raw string is also an option.
:1: SyntaxWarning: "[" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\["? A raw string is also an option.
:1: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\d"? A raw string is also an option.
… snip…
:1: SyntaxWarning: "[" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\["? A raw string is also an option.
INFO - Loading rules
The nac-validate tool includes a script called validator.py that already has a function that catches the warnings and ignores them. The reason why these warnings are caught with releases below 3.14 but not caught when using python 3.14 is because the warning message generated doesn't match what the function is expecting as a pattern.
Current script inside nac-validate is expecting the message to begin with:
message="invalid escape sequence"
As shown above, the warnings similarly begin with:
:1: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\d"? A raw string is also an option.
After doing some testing I modified the pattern that the script is expecting to:
message=r".invalid escape sequence."
that way it matches that pattern anywhere in the message. After modifying that line please see on the image how execution went. I tested it with one validation rule error on purpose just to see if nac-validate it's working fine.
That would help people avoid those warning messages when using python 3.14 while executing nac-validate and continue to work normally.