audk/BaseTools/Source/Python/Ecc
Mike Beaton 6820004b3e BaseTools: Fix multiple 'invalid escape sequence' warnings in tests
In Python 3.12 invalid escape sequences in strings moved from
DeprecationWarning to SyntaxWarning
(ref https://docs.python.org/3/whatsnew/changelog.html#python-3-12-0-final
and search for gh-98401). In a future Python version this will become
SyntaxError.

Multiple instances of these SyntaxWarnings are currently printed when
running the BaseTools tests using Python 3.12 (though without actually
failing the affected tests).

This commit updates all lines which were causing this type of warning.

Typical examples which needed fixing are:

- "BaseTools\Source\Python" representing a path: "\S" and "\P" are invalid
escape sequences, therefore left unchanged, therefore the test works
(with a warning in Python 3.12). r"BaseTools\Source\Python" represents
the same string, but with escapes turned off completely thus no warning.

- Where '\t\s' is used as a regex pattern, then chr(9) + '\\s' is sent
to the regex parser (with a warning in Python 3.12) since '\s' is not a
valid Python escape sequence. This works correctly, though arguably for
the wrong reasons. r'\t\s' sends the same as '\\t\\s', as originally
intended and with no warning.

(Note that ' and " are not fundamentally different in Python.)

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-23 04:55:53 +00:00
..
CParser3 BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
CParser4 BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
MetaFileWorkspace BaseTools: Fix multiple 'invalid escape sequence' warnings in tests 2024-09-23 04:55:53 +00:00
Xml BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
C.g BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
Check.py BaseTools: Fix multiple 'invalid escape sequence' warnings in tests 2024-09-23 04:55:53 +00:00
CodeFragment.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
CodeFragmentCollector.py BaseTools:ECC report errors on account of analyze special characters 2019-05-08 09:41:42 +08:00
Configuration.py BaseTools: Fix multiple 'invalid escape sequence' warnings in tests 2024-09-23 04:55:53 +00:00
Database.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
EccGlobalData.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
EccMain.py BaseTools: Change RealPath to AbsPath 2021-10-13 09:07:16 +00:00
EccToolError.py BaseTools: drop GeneralCheckNonAscii() from ECC 2024-07-15 13:27:00 +00:00
Exception.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
FileProfile.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
MetaDataParser.py BaseTools/Ecc: Fix ECC check MetaFile Copyright information issue 2020-10-27 06:50:06 +00:00
ParserWarning.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
__init__.py BaseTools: Replace BSD License with BSD+Patent License 2019-04-09 09:10:20 -07:00
c.py BaseTools: Fix multiple 'invalid escape sequence' warnings in tests 2024-09-23 04:55:53 +00:00
config.ini BaseTools: drop GeneralCheckNonAscii() from ECC 2024-07-15 13:27:00 +00:00
exception.xml BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list 2021-02-01 10:01:02 -08:00