summaryrefslogtreecommitdiffstats
path: root/bitbake/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-16 15:35:07 +0000
commite5455662a9762fc2cb8859134d855413d84fd265 (patch)
treead7c3c6b258415ab9b92ed4b04a1ce0c2f6c9eb7 /bitbake/lib/bs4
parentca4a8eea6284aad41ec67b375c2a7c7855b5fe11 (diff)
downloadpoky-e5455662a9762fc2cb8859134d855413d84fd265.tar.gz
bitbake: 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. (Bitbake rev: c1fcc46e2498ddd41425d8756754f814d682aba3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bs4')
-rw-r--r--bitbake/lib/bs4/dammit.py12
-rw-r--r--bitbake/lib/bs4/element.py8
2 files changed, 10 insertions, 10 deletions
diff --git a/bitbake/lib/bs4/dammit.py b/bitbake/lib/bs4/dammit.py
index 68d419feb5..805aa908a5 100644
--- a/bitbake/lib/bs4/dammit.py
+++ b/bitbake/lib/bs4/dammit.py
@@ -45,9 +45,9 @@ except ImportError:
45 pass 45 pass
46 46
47xml_encoding_re = re.compile( 47xml_encoding_re = re.compile(
48 '^<\?.*encoding=[\'"](.*?)[\'"].*\?>'.encode(), re.I) 48 r'^<\?.*encoding=[\'"](.*?)[\'"].*\?>'.encode(), re.I)
49html_meta_re = re.compile( 49html_meta_re = re.compile(
50 '<\s*meta[^>]+charset\s*=\s*["\']?([^>]*?)[ /;\'">]'.encode(), re.I) 50 r'<\s*meta[^>]+charset\s*=\s*["\']?([^>]*?)[ /;\'">]'.encode(), re.I)
51 51
52class EntitySubstitution(object): 52class EntitySubstitution(object):
53 53
@@ -80,11 +80,11 @@ class EntitySubstitution(object):
80 ">": "gt", 80 ">": "gt",
81 } 81 }
82 82
83 BARE_AMPERSAND_OR_BRACKET = re.compile("([<>]|" 83 BARE_AMPERSAND_OR_BRACKET = re.compile(r"([<>]|"
84 "&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;)" 84 r"&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;)"
85 ")") 85 r")")
86 86
87 AMPERSAND_OR_BRACKET = re.compile("([<>&])") 87 AMPERSAND_OR_BRACKET = re.compile(r"([<>&])")
88 88
89 @classmethod 89 @classmethod
90 def _substitute_html_entity(cls, matchobj): 90 def _substitute_html_entity(cls, matchobj):
diff --git a/bitbake/lib/bs4/element.py b/bitbake/lib/bs4/element.py
index 0c30759ffc..3775a60458 100644
--- a/bitbake/lib/bs4/element.py
+++ b/bitbake/lib/bs4/element.py
@@ -10,7 +10,7 @@ from bs4.dammit import EntitySubstitution
10DEFAULT_OUTPUT_ENCODING = "utf-8" 10DEFAULT_OUTPUT_ENCODING = "utf-8"
11PY3K = (sys.version_info[0] > 2) 11PY3K = (sys.version_info[0] > 2)
12 12
13whitespace_re = re.compile("\s+") 13whitespace_re = re.compile(r"\s+")
14 14
15def _alias(attr): 15def _alias(attr):
16 """Alias one attribute name to another for backward compatibility""" 16 """Alias one attribute name to another for backward compatibility"""
@@ -67,7 +67,7 @@ class ContentMetaAttributeValue(AttributeValueWithCharsetSubstitution):
67 The value of the 'content' attribute will be one of these objects. 67 The value of the 'content' attribute will be one of these objects.
68 """ 68 """
69 69
70 CHARSET_RE = re.compile("((^|;)\s*charset=)([^;]*)", re.M) 70 CHARSET_RE = re.compile(r"((^|;)\s*charset=)([^;]*)", re.M)
71 71
72 def __new__(cls, original_value): 72 def __new__(cls, original_value):
73 match = cls.CHARSET_RE.search(original_value) 73 match = cls.CHARSET_RE.search(original_value)
@@ -580,7 +580,7 @@ class PageElement(object):
580 580
581 # Methods for supporting CSS selectors. 581 # Methods for supporting CSS selectors.
582 582
583 tag_name_re = re.compile('^[a-zA-Z0-9][-.a-zA-Z0-9:_]*$') 583 tag_name_re = re.compile(r'^[a-zA-Z0-9][-.a-zA-Z0-9:_]*$')
584 584
585 # /^([a-zA-Z0-9][-.a-zA-Z0-9:_]*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/ 585 # /^([a-zA-Z0-9][-.a-zA-Z0-9:_]*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
586 # \---------------------------/ \---/\-------------/ \-------/ 586 # \---------------------------/ \---/\-------------/ \-------/
@@ -1364,7 +1364,7 @@ class Tag(PageElement):
1364 if tag_name == '': 1364 if tag_name == '':
1365 raise ValueError( 1365 raise ValueError(
1366 "A pseudo-class must be prefixed with a tag name.") 1366 "A pseudo-class must be prefixed with a tag name.")
1367 pseudo_attributes = re.match('([a-zA-Z\d-]+)\(([a-zA-Z\d]+)\)', pseudo) 1367 pseudo_attributes = re.match(r'([a-zA-Z\d-]+)\(([a-zA-Z\d]+)\)', pseudo)
1368 found = [] 1368 found = []
1369 if pseudo_attributes is None: 1369 if pseudo_attributes is None:
1370 pseudo_type = pseudo 1370 pseudo_type = pseudo