fix: DeprecationWarning: invalid escape sequence \(

Python 3 interprets string literals as Unicode strings, and therefore \( is treated as an escaped Unicode character.

Declare RegEx pattern as a raw string instead by prepending r
This commit is contained in:
Joseph Marie Alba 2021-05-16 06:20:44 +08:00 committed by GitHub
parent d84d02349c
commit a13d208a28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -409,7 +409,7 @@ def get_print_style(style=None, print_format=None, for_legacy=False):
css = css + '\n' + frappe.db.get_value('Print Style', style, 'css')
# move @import to top
for at_import in list(set(re.findall("(@import url\([^\)]+\)[;]?)", css))):
for at_import in list(set(re.findall(r"(@import url\([^\)]+\)[;]?)", css))):
css = css.replace(at_import, "")
# prepend css with at_import