From 32845f6877557ec75a0c7791bf50da619d06536b Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sun, 6 Jan 2019 19:39:06 -0500 Subject: Tried even harder to avoid the deprecation warning originally fixed in 4.6.1. [bug=1778909] --- CHANGELOG | 5 ++++- bs4/element.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 389b949..d3c8578 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -= 4.7.1 (Unreleased) += 4.7.1 (20190106) * Fixed a significant performance problem introduced in 4.7.0. [bug=1810617] @@ -8,6 +8,9 @@ * Beautiful Soup will no longer try to keep track of namespaces that are not defined with a prefix; this can confuse soupselect. [bug=1810680] +* Tried even harder to avoid the deprecation warning originally fixed in + 4.6.1. [bug=1778909] + = 4.7.0 (20181231) * Beautiful Soup's CSS Selector implementation has been replaced by a diff --git a/bs4/element.py b/bs4/element.py index 5718d31..547b8ba 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -217,7 +217,7 @@ class PageElement(object): if formatter is None: output = s else: - if callable(formatter): + if isinstance(formatter, Callable): # Backwards compatibility -- you used to pass in a formatting method. output = formatter(s) else: @@ -1138,7 +1138,7 @@ class Tag(PageElement): # First off, turn a string formatter into a Formatter object. This # will stop the lookup from happening over and over again. - if not isinstance(formatter, Formatter) and not callable(formatter): + if not isinstance(formatter, Formatter) and not isinstance(formatter, Callable): formatter = self._formatter_for_name(formatter) attrs = [] if self.attrs: @@ -1243,7 +1243,7 @@ class Tag(PageElement): """ # First off, turn a string formatter into a Formatter object. This # will stop the lookup from happening over and over again. - if not isinstance(formatter, Formatter) and not callable(formatter): + if not isinstance(formatter, Formatter) and not isinstance(formatter, Callable): formatter = self._formatter_for_name(formatter) pretty_print = (indent_level is not None) @@ -1425,7 +1425,7 @@ class SoupStrainer(object): def _normalize_search_value(self, value): # Leave it alone if it's a Unicode string, a callable, a # regular expression, a boolean, or None. - if (isinstance(value, unicode) or callable(value) or hasattr(value, 'match') + if (isinstance(value, unicode) or isinstance(value, Callable) or hasattr(value, 'match') or isinstance(value, bool) or value is None): return value -- cgit v1.2.1