aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bs4
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-14 15:50:51 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-14 16:12:30 +0000
commitc1fcc46e2498ddd41425d8756754f814d682aba3 (patch)
treeee8367f90ab043e192481284ddc485d372f3670a /lib/bs4
parent52a144a7daa94b2bd239d582cb71d1f03119918f (diff)
downloadbitbake-c1fcc46e2498ddd41425d8756754f814d682aba3.tar.gz
bitbake: Fix Deprecated warnings from regexs
Fix handling of escape characters in regexs and hence fix python Deprecation warnings which will be problematic in python 3.8. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bs4')
-rw-r--r--lib/bs4/dammit.py12
-rw-r--r--lib/bs4/element.py8
2 files changed, 10 insertions, 10 deletions
diff --git a/lib/bs4/dammit.py b/lib/bs4/dammit.py
index 68d419feb..805aa908a 100644
--- a/lib/bs4/dammit.py
+++ b/lib/bs4/dammit.py
@@ -45,9 +45,9 @@ except ImportError:
pass
xml_encoding_re = re.compile(
- '^<\?.*encoding=[\'"](.*?)[\'"].*\?>'.encode(), re.I)
+ r'^<\?.*encoding=[\'"](.*?)[\'"].*\?>'.encode(), re.I)
html_meta_re = re.compile(
- '<\s*meta[^>]+charset\s*=\s*["\']?([^>]*?)[ /;\'">]'.encode(), re.I)
+ r'<\s*meta[^>]+charset\s*=\s*["\']?([^>]*?)[ /;\'">]'.encode(), re.I)
class EntitySubstitution(object):
@@ -80,11 +80,11 @@ class EntitySubstitution(object):
">": "gt",
}
- BARE_AMPERSAND_OR_BRACKET = re.compile("([<>]|"
- "&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;)"
- ")")
+ BARE_AMPERSAND_OR_BRACKET = re.compile(r"([<>]|"
+ r"&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;)"
+ r")")
- AMPERSAND_OR_BRACKET = re.compile("([<>&])")
+ AMPERSAND_OR_BRACKET = re.compile(r"([<>&])")
@classmethod
def _substitute_html_entity(cls, matchobj):
diff --git a/lib/bs4/element.py b/lib/bs4/element.py
index 0c30759ff..3775a6045 100644
--- a/lib/bs4/element.py
+++ b/lib/bs4/element.py
@@ -10,7 +10,7 @@ from bs4.dammit import EntitySubstitution
DEFAULT_OUTPUT_ENCODING = "utf-8"
PY3K = (sys.version_info[0] > 2)
-whitespace_re = re.compile("\s+")
+whitespace_re = re.compile(r"\s+")
def _alias(attr):
"""Alias one attribute name to another for backward compatibility"""
@@ -67,7 +67,7 @@ class ContentMetaAttributeValue(AttributeValueWithCharsetSubstitution):
The value of the 'content' attribute will be one of these objects.
"""
- CHARSET_RE = re.compile("((^|;)\s*charset=)([^;]*)", re.M)
+ CHARSET_RE = re.compile(r"((^|;)\s*charset=)([^;]*)", re.M)
def __new__(cls, original_value):
match = cls.CHARSET_RE.search(original_value)
@@ -580,7 +580,7 @@ class PageElement(object):
# Methods for supporting CSS selectors.
- tag_name_re = re.compile('^[a-zA-Z0-9][-.a-zA-Z0-9:_]*$')
+ tag_name_re = re.compile(r'^[a-zA-Z0-9][-.a-zA-Z0-9:_]*$')
# /^([a-zA-Z0-9][-.a-zA-Z0-9:_]*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
# \---------------------------/ \---/\-------------/ \-------/
@@ -1364,7 +1364,7 @@ class Tag(PageElement):
if tag_name == '':
raise ValueError(
"A pseudo-class must be prefixed with a tag name.")
- pseudo_attributes = re.match('([a-zA-Z\d-]+)\(([a-zA-Z\d]+)\)', pseudo)
+ pseudo_attributes = re.match(r'([a-zA-Z\d-]+)\(([a-zA-Z\d]+)\)', pseudo)
found = []
if pseudo_attributes is None:
pseudo_type = pseudo