Skip to content
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

BinToPcd.py: Update regex strings to use raw strings #604

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions BaseTools/Scripts/BinToPcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
'''
from __future__ import print_function

import sys
# MU_CHANGE BEGIN: isort imports
import argparse
import re
import io
import struct
import math
import re
import struct
import sys
# MU_CHANGE END

#
# Globals for help information
Expand All @@ -37,17 +39,19 @@ def ValidateUnsignedInteger (Argument):
return Value

def ValidatePcdName (Argument):
if re.split ('[a-zA-Z\_][a-zA-Z0-9\_]*\.[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) != ['', '']:
# MU_CHANGE: make regex string a raw string
if re.split (r'[a-zA-Z\_][a-zA-Z0-9\_]*\.[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) != ['', '']:
Message = '{Argument} is not in the form <PcdTokenSpaceGuidCName>.<PcdCName>'.format (Argument = Argument)
raise argparse.ArgumentTypeError (Message)
return Argument

def ValidateGuidName (Argument):
if re.split ('[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) != ['', '']:
# MU_CHANGE: make regex string a raw string
if re.split (r'[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) != ['', '']:
Message = '{Argument} is not a valid GUID C name'.format (Argument = Argument)
raise argparse.ArgumentTypeError (Message)
return Argument

def XdrPackBuffer (buffer):
packed_bytes = io.BytesIO()
for unpacked_bytes in buffer:
Expand Down