Skip to content

Commit 59b3dbe

Browse files
authored
Updated DeprecationWarnings about invalid escape sequences (#314)
When compiling with Python 3.6+, a DeprecationWarning is thrown for an "invalid escape sequence". Updated places in the code where the warning is thrown with raw string notation.
1 parent 0742761 commit 59b3dbe

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

newrelic/api/html_insertion.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414

1515
import re
1616

17-
_head_re = re.compile(b'<head[^>]*>', re.IGNORECASE)
17+
_head_re = re.compile(r'<head[^>]*>', re.IGNORECASE)
1818

19-
_xua_meta_re = re.compile(b"""<\s*meta[^>]+http-equiv\s*=\s*['"]"""
20-
b"""x-ua-compatible['"][^>]*>""", re.IGNORECASE)
19+
_xua_meta_re = re.compile(r"""<\s*meta[^>]+http-equiv\s*=\s*['"]"""
20+
r"""x-ua-compatible['"][^>]*>""", re.IGNORECASE)
2121

22-
_charset_meta_re = re.compile(b"""<\s*meta[^>]+charset\s*=[^>]*>""",
22+
_charset_meta_re = re.compile(r"""<\s*meta[^>]+charset\s*=[^>]*>""",
2323
re.IGNORECASE)
2424

25-
_attachment_meta_re = re.compile(b"""<\s*meta[^>]+http-equiv\s*=\s*['"]"""
26-
b"""content-disposition['"][^>]*content\s*=\s*(?P<quote>['"])"""
27-
b"""\s*attachment(\s*;[^>]*)?(?P=quote)[^>]*>""",
25+
_attachment_meta_re = re.compile(r"""<\s*meta[^>]+http-equiv\s*=\s*['"]"""
26+
r"""content-disposition['"][^>]*content\s*=\s*(?P<quote>['"])"""
27+
r"""\s*attachment(\s*;[^>]*)?(?P=quote)[^>]*>""",
2828
re.IGNORECASE)
2929

30-
_body_re = re.compile(b'<body[^>]*>', re.IGNORECASE)
30+
_body_re = re.compile(r'<body[^>]*>', re.IGNORECASE)
3131

3232
def insert_html_snippet(data, html_to_be_inserted, search_limit=64*1024):
3333
# First determine if we have a body tag. If we don't we

newrelic/common/log_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,4 @@ def filter(self, record):
116116
_urllib3_logger.addFilter(Urllib3ConnectionFilter())
117117

118118
# Also ignore any urllib3 warning messages
119-
warnings.filterwarnings("ignore", module='newrelic\.packages\.urllib3')
119+
warnings.filterwarnings("ignore", module=r"newrelic\.packages\.urllib3")

0 commit comments

Comments
 (0)