mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
use single regex
This commit is contained in:
parent
7e1203ea51
commit
646eb2e519
1 changed files with 3 additions and 7 deletions
|
|
@ -31,8 +31,7 @@ INT_TAGS = {
|
|||
"subimages",
|
||||
}
|
||||
|
||||
CHAR_REF_REGEX_DECIMAL = re.compile(r"&#[0-9]+;")
|
||||
CHAR_REF_REGEX_HEX = re.compile(r"&#x[0-9a-zA-Z]+;")
|
||||
XML_CHAR_REF_REGEX_HEX = re.compile(r"&#x?[0-9a-fA-F]+;")
|
||||
|
||||
# Regex to parse array attributes
|
||||
ARRAY_TYPE_REGEX = re.compile(r"^(int|float|string)\[\d+\]$")
|
||||
|
|
@ -196,12 +195,9 @@ def parse_oiio_xml_output(xml_string, logger=None):
|
|||
return output
|
||||
|
||||
# Fix values with ampresand (lazy fix)
|
||||
# - ElementTree can't handle all escaped values with ampresand
|
||||
# - oiiotool exports invalid xml which ElementTree can't handle
|
||||
# e.g. ""
|
||||
matches = (
|
||||
set(CHAR_REF_REGEX_HEX.findall(xml_string))
|
||||
| set(CHAR_REF_REGEX_DECIMAL.findall(xml_string))
|
||||
)
|
||||
matches = XML_CHAR_REF_REGEX_HEX.findall(xml_string)
|
||||
for match in matches:
|
||||
new_value = match.replace("&", "&")
|
||||
xml_string = xml_string.replace(match, new_value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue