diff options
author | Leonard Richardson <leonardr@segfault.org> | 2019-01-06 19:39:06 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2019-01-06 19:39:06 -0500 |
commit | 32845f6877557ec75a0c7791bf50da619d06536b (patch) | |
tree | db93987520e57d796e8d3ecceb275c86a01a31e2 /bs4/element.py | |
parent | 9c99d3050584a088b1d066aca0c21d04f87775b0 (diff) | |
download | beautifulsoup4-32845f6877557ec75a0c7791bf50da619d06536b.tar.gz |
Tried even harder to avoid the deprecation warning originally fixed in
4.6.1. [bug=1778909]
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 8 |
1 files changed, 4 insertions, 4 deletions
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 |