mirror of
https://git.yoctoproject.org/poky
synced 2026-09-29 07:36:20 +02:00
bitbake: bs4/element: Fix DeprecationWarning
./lib/bs4/element.py:1565: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working (Bitbake rev: 52a144a7daa94b2bd239d582cb71d1f03119918f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
|
|
||||||
from pdb import set_trace
|
from pdb import set_trace
|
||||||
import collections
|
import collections.abc
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
@@ -155,7 +155,7 @@ class PageElement(object):
|
|||||||
|
|
||||||
def format_string(self, s, formatter='minimal'):
|
def format_string(self, s, formatter='minimal'):
|
||||||
"""Format the given string using the given formatter."""
|
"""Format the given string using the given formatter."""
|
||||||
if not isinstance(formatter, collections.Callable):
|
if not isinstance(formatter, collections.abc.Callable):
|
||||||
formatter = self._formatter_for_name(formatter)
|
formatter = self._formatter_for_name(formatter)
|
||||||
if formatter is None:
|
if formatter is None:
|
||||||
output = s
|
output = s
|
||||||
@@ -1077,7 +1077,7 @@ class Tag(PageElement):
|
|||||||
|
|
||||||
# First off, turn a string formatter into a function. This
|
# First off, turn a string formatter into a function. This
|
||||||
# will stop the lookup from happening over and over again.
|
# will stop the lookup from happening over and over again.
|
||||||
if not isinstance(formatter, collections.Callable):
|
if not isinstance(formatter, collections.abc.Callable):
|
||||||
formatter = self._formatter_for_name(formatter)
|
formatter = self._formatter_for_name(formatter)
|
||||||
|
|
||||||
attrs = []
|
attrs = []
|
||||||
@@ -1181,7 +1181,7 @@ class Tag(PageElement):
|
|||||||
"""
|
"""
|
||||||
# First off, turn a string formatter into a function. This
|
# First off, turn a string formatter into a function. This
|
||||||
# will stop the lookup from happening over and over again.
|
# will stop the lookup from happening over and over again.
|
||||||
if not isinstance(formatter, collections.Callable):
|
if not isinstance(formatter, collections.abc.Callable):
|
||||||
formatter = self._formatter_for_name(formatter)
|
formatter = self._formatter_for_name(formatter)
|
||||||
|
|
||||||
pretty_print = (indent_level is not None)
|
pretty_print = (indent_level is not None)
|
||||||
@@ -1562,7 +1562,7 @@ class SoupStrainer(object):
|
|||||||
def _normalize_search_value(self, value):
|
def _normalize_search_value(self, value):
|
||||||
# Leave it alone if it's a Unicode string, a callable, a
|
# Leave it alone if it's a Unicode string, a callable, a
|
||||||
# regular expression, a boolean, or None.
|
# regular expression, a boolean, or None.
|
||||||
if (isinstance(value, str) or isinstance(value, collections.Callable) or hasattr(value, 'match')
|
if (isinstance(value, str) or isinstance(value, collections.abc.Callable) or hasattr(value, 'match')
|
||||||
or isinstance(value, bool) or value is None):
|
or isinstance(value, bool) or value is None):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@@ -1602,7 +1602,7 @@ class SoupStrainer(object):
|
|||||||
markup = markup_name
|
markup = markup_name
|
||||||
markup_attrs = markup
|
markup_attrs = markup
|
||||||
call_function_with_tag_data = (
|
call_function_with_tag_data = (
|
||||||
isinstance(self.name, collections.Callable)
|
isinstance(self.name, collections.abc.Callable)
|
||||||
and not isinstance(markup_name, Tag))
|
and not isinstance(markup_name, Tag))
|
||||||
|
|
||||||
if ((not self.name)
|
if ((not self.name)
|
||||||
@@ -1688,7 +1688,7 @@ class SoupStrainer(object):
|
|||||||
# True matches any non-None value.
|
# True matches any non-None value.
|
||||||
return markup is not None
|
return markup is not None
|
||||||
|
|
||||||
if isinstance(match_against, collections.Callable):
|
if isinstance(match_against, collections.abc.Callable):
|
||||||
return match_against(markup)
|
return match_against(markup)
|
||||||
|
|
||||||
# Custom callables take the tag as an argument, but all
|
# Custom callables take the tag as an argument, but all
|
||||||
|
|||||||
Reference in New Issue
Block a user