summaryrefslogtreecommitdiffstats
path: root/external/poky/bitbake/lib/bs4
diff options
context:
space:
mode:
Diffstat (limited to 'external/poky/bitbake/lib/bs4')
-rw-r--r--external/poky/bitbake/lib/bs4/__init__.py2
-rw-r--r--external/poky/bitbake/lib/bs4/builder/_html5lib.py3
-rw-r--r--external/poky/bitbake/lib/bs4/dammit.py20
-rw-r--r--external/poky/bitbake/lib/bs4/element.py23
-rw-r--r--external/poky/bitbake/lib/bs4/testing.py1
-rw-r--r--external/poky/bitbake/lib/bs4/tests/test_docs.py4
-rw-r--r--external/poky/bitbake/lib/bs4/tests/test_htmlparser.py1
-rw-r--r--external/poky/bitbake/lib/bs4/tests/test_lxml.py8
-rw-r--r--external/poky/bitbake/lib/bs4/tests/test_soup.py6
-rw-r--r--external/poky/bitbake/lib/bs4/tests/test_tree.py11
10 files changed, 23 insertions, 56 deletions
diff --git a/external/poky/bitbake/lib/bs4/__init__.py b/external/poky/bitbake/lib/bs4/__init__.py
index f6fdfd50..e35725b8 100644
--- a/external/poky/bitbake/lib/bs4/__init__.py
+++ b/external/poky/bitbake/lib/bs4/__init__.py
@@ -427,7 +427,7 @@ class BeautifulSoup(Tag):
if self.is_xml:
# Print the XML declaration
encoding_part = ''
- if eventual_encoding != None:
+ if eventual_encoding is not None:
encoding_part = ' encoding="%s"' % eventual_encoding
prefix = '<?xml version="1.0"%s?>\n' % encoding_part
else:
diff --git a/external/poky/bitbake/lib/bs4/builder/_html5lib.py b/external/poky/bitbake/lib/bs4/builder/_html5lib.py
index 2b7a70aa..9e9216ef 100644
--- a/external/poky/bitbake/lib/bs4/builder/_html5lib.py
+++ b/external/poky/bitbake/lib/bs4/builder/_html5lib.py
@@ -2,7 +2,6 @@ __all__ = [
'HTML5TreeBuilder',
]
-from pdb import set_trace
import warnings
from bs4.builder import (
PERMISSIVE,
@@ -322,7 +321,7 @@ class Element(treebuildersbase.Node):
return self.element.contents
def getNameTuple(self):
- if self.namespace == None:
+ if self.namespace is None:
return namespaces["html"], self.name
else:
return self.namespace, self.name
diff --git a/external/poky/bitbake/lib/bs4/dammit.py b/external/poky/bitbake/lib/bs4/dammit.py
index 68d419fe..7ad9e0dd 100644
--- a/external/poky/bitbake/lib/bs4/dammit.py
+++ b/external/poky/bitbake/lib/bs4/dammit.py
@@ -8,12 +8,10 @@ XML or HTML to reflect a new encoding; that's the tree builder's job.
"""
__license__ = "MIT"
-from pdb import set_trace
import codecs
from html.entities import codepoint2name
import re
import logging
-import string
# Import a library to autodetect character encodings.
chardet_type = None
@@ -38,16 +36,10 @@ except ImportError:
def chardet_dammit(s):
return None
-# Available from http://cjkpython.i18n.org/.
-try:
- import iconv_codec
-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 +72,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/external/poky/bitbake/lib/bs4/element.py b/external/poky/bitbake/lib/bs4/element.py
index 0e62c2e1..68be42d1 100644
--- a/external/poky/bitbake/lib/bs4/element.py
+++ b/external/poky/bitbake/lib/bs4/element.py
@@ -1,7 +1,6 @@
__license__ = "MIT"
-from pdb import set_trace
-import collections
+import collections.abc
import re
import sys
import warnings
@@ -10,7 +9,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 +66,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)
@@ -155,7 +154,7 @@ class PageElement(object):
def format_string(self, s, formatter='minimal'):
"""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)
if formatter is None:
output = s
@@ -580,7 +579,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+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
# \---------------------------/ \---/\-------------/ \-------/
@@ -1077,7 +1076,7 @@ class Tag(PageElement):
# First off, turn a string formatter into a function. This
# 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)
attrs = []
@@ -1181,7 +1180,7 @@ class Tag(PageElement):
"""
# First off, turn a string formatter into a function. This
# 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)
pretty_print = (indent_level is not None)
@@ -1364,7 +1363,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
@@ -1562,7 +1561,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, 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):
return value
@@ -1602,7 +1601,7 @@ class SoupStrainer(object):
markup = markup_name
markup_attrs = markup
call_function_with_tag_data = (
- isinstance(self.name, collections.Callable)
+ isinstance(self.name, collections.abc.Callable)
and not isinstance(markup_name, Tag))
if ((not self.name)
@@ -1688,7 +1687,7 @@ class SoupStrainer(object):
# True matches any non-None value.
return markup is not None
- if isinstance(match_against, collections.Callable):
+ if isinstance(match_against, collections.abc.Callable):
return match_against(markup)
# Custom callables take the tag as an argument, but all
diff --git a/external/poky/bitbake/lib/bs4/testing.py b/external/poky/bitbake/lib/bs4/testing.py
index 3a2f260e..953bca8e 100644
--- a/external/poky/bitbake/lib/bs4/testing.py
+++ b/external/poky/bitbake/lib/bs4/testing.py
@@ -4,7 +4,6 @@ __license__ = "MIT"
import pickle
import copy
-import functools
import unittest
from unittest import TestCase
from bs4 import BeautifulSoup
diff --git a/external/poky/bitbake/lib/bs4/tests/test_docs.py b/external/poky/bitbake/lib/bs4/tests/test_docs.py
index 5b9f6770..d1d76a33 100644
--- a/external/poky/bitbake/lib/bs4/tests/test_docs.py
+++ b/external/poky/bitbake/lib/bs4/tests/test_docs.py
@@ -7,19 +7,15 @@ __all__ = [
'additional_tests',
]
-import atexit
import doctest
-import os
#from pkg_resources import (
# resource_filename, resource_exists, resource_listdir, cleanup_resources)
-import unittest
DOCTEST_FLAGS = (
doctest.ELLIPSIS |
doctest.NORMALIZE_WHITESPACE |
doctest.REPORT_NDIFF)
-
# def additional_tests():
# "Run the doc tests (README.txt and docs/*, if any exist)"
# doctest_files = [
diff --git a/external/poky/bitbake/lib/bs4/tests/test_htmlparser.py b/external/poky/bitbake/lib/bs4/tests/test_htmlparser.py
index b45e35f9..30a25e67 100644
--- a/external/poky/bitbake/lib/bs4/tests/test_htmlparser.py
+++ b/external/poky/bitbake/lib/bs4/tests/test_htmlparser.py
@@ -1,7 +1,6 @@
"""Tests to ensure that the html.parser tree builder generates good
trees."""
-from pdb import set_trace
import pickle
from bs4.testing import SoupTest, HTMLTreeBuilderSmokeTest
from bs4.builder import HTMLParserTreeBuilder
diff --git a/external/poky/bitbake/lib/bs4/tests/test_lxml.py b/external/poky/bitbake/lib/bs4/tests/test_lxml.py
index 6c2a1d73..6b6cdd07 100644
--- a/external/poky/bitbake/lib/bs4/tests/test_lxml.py
+++ b/external/poky/bitbake/lib/bs4/tests/test_lxml.py
@@ -1,6 +1,5 @@
"""Tests to ensure that the lxml tree builder generates good trees."""
-import re
import warnings
try:
@@ -14,13 +13,8 @@ except ImportError as e:
if LXML_PRESENT:
from bs4.builder import LXMLTreeBuilder, LXMLTreeBuilderForXML
-from bs4 import (
- BeautifulSoup,
- BeautifulStoneSoup,
- )
-from bs4.element import Comment, Doctype, SoupStrainer
+from bs4 import BeautifulStoneSoup
from bs4.testing import skipIf
-from bs4.tests import test_htmlparser
from bs4.testing import (
HTMLTreeBuilderSmokeTest,
XMLTreeBuilderSmokeTest,
diff --git a/external/poky/bitbake/lib/bs4/tests/test_soup.py b/external/poky/bitbake/lib/bs4/tests/test_soup.py
index f87949e3..6ad3cb37 100644
--- a/external/poky/bitbake/lib/bs4/tests/test_soup.py
+++ b/external/poky/bitbake/lib/bs4/tests/test_soup.py
@@ -1,16 +1,12 @@
# -*- coding: utf-8 -*-
"""Tests of Beautiful Soup as a whole."""
-from pdb import set_trace
import logging
import unittest
import sys
import tempfile
-from bs4 import (
- BeautifulSoup,
- BeautifulStoneSoup,
-)
+from bs4 import BeautifulSoup
from bs4.element import (
CharsetMetaAttributeValue,
ContentMetaAttributeValue,
diff --git a/external/poky/bitbake/lib/bs4/tests/test_tree.py b/external/poky/bitbake/lib/bs4/tests/test_tree.py
index 6d3e67f3..8e5c6642 100644
--- a/external/poky/bitbake/lib/bs4/tests/test_tree.py
+++ b/external/poky/bitbake/lib/bs4/tests/test_tree.py
@@ -9,16 +9,12 @@ same markup, but all Beautiful Soup trees can be traversed with the
methods tested here.
"""
-from pdb import set_trace
import copy
import pickle
import re
import warnings
from bs4 import BeautifulSoup
-from bs4.builder import (
- builder_registry,
- HTMLParserTreeBuilder,
-)
+from bs4.builder import builder_registry
from bs4.element import (
PY3K,
CData,
@@ -29,10 +25,7 @@ from bs4.element import (
SoupStrainer,
Tag,
)
-from bs4.testing import (
- SoupTest,
- skipIf,
-)
+from bs4.testing import SoupTest
XML_BUILDER_PRESENT = (builder_registry.lookup("xml") is not None)
LXML_PRESENT = (builder_registry.lookup("lxml") is not None)