diff options
| author | Frazer Clews <frazer.clews@codethink.co.uk> | 2020-01-16 16:55:18 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-19 13:31:05 +0000 |
| commit | 0ac5174c7d39a3e49893df0d517d47bec1935555 (patch) | |
| tree | 479496afb1da7814071e39e888e8926cd03bec57 /bitbake/lib/bs4 | |
| parent | 444bcb6cb6be8d5205fc88790360d864e633a555 (diff) | |
| download | poky-0ac5174c7d39a3e49893df0d517d47bec1935555.tar.gz | |
bitbake: lib: remove unused imports
removed unused imports which made the code harder to read, and slightly
but less efficient
(Bitbake rev: 4367692a932ac135c5aa4f9f2a4e4f0150f76697)
Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bs4')
| -rw-r--r-- | bitbake/lib/bs4/builder/_html5lib.py | 1 | ||||
| -rw-r--r-- | bitbake/lib/bs4/dammit.py | 8 | ||||
| -rw-r--r-- | bitbake/lib/bs4/element.py | 1 | ||||
| -rw-r--r-- | bitbake/lib/bs4/testing.py | 1 | ||||
| -rw-r--r-- | bitbake/lib/bs4/tests/test_docs.py | 4 | ||||
| -rw-r--r-- | bitbake/lib/bs4/tests/test_htmlparser.py | 1 | ||||
| -rw-r--r-- | bitbake/lib/bs4/tests/test_lxml.py | 8 | ||||
| -rw-r--r-- | bitbake/lib/bs4/tests/test_soup.py | 6 | ||||
| -rw-r--r-- | bitbake/lib/bs4/tests/test_tree.py | 11 |
9 files changed, 4 insertions, 37 deletions
diff --git a/bitbake/lib/bs4/builder/_html5lib.py b/bitbake/lib/bs4/builder/_html5lib.py index 2b7a70aa11..4091ce88b9 100644 --- a/bitbake/lib/bs4/builder/_html5lib.py +++ b/bitbake/lib/bs4/builder/_html5lib.py | |||
| @@ -2,7 +2,6 @@ __all__ = [ | |||
| 2 | 'HTML5TreeBuilder', | 2 | 'HTML5TreeBuilder', |
| 3 | ] | 3 | ] |
| 4 | 4 | ||
| 5 | from pdb import set_trace | ||
| 6 | import warnings | 5 | import warnings |
| 7 | from bs4.builder import ( | 6 | from bs4.builder import ( |
| 8 | PERMISSIVE, | 7 | PERMISSIVE, |
diff --git a/bitbake/lib/bs4/dammit.py b/bitbake/lib/bs4/dammit.py index 805aa908a5..7ad9e0dd1e 100644 --- a/bitbake/lib/bs4/dammit.py +++ b/bitbake/lib/bs4/dammit.py | |||
| @@ -8,12 +8,10 @@ XML or HTML to reflect a new encoding; that's the tree builder's job. | |||
| 8 | """ | 8 | """ |
| 9 | __license__ = "MIT" | 9 | __license__ = "MIT" |
| 10 | 10 | ||
| 11 | from pdb import set_trace | ||
| 12 | import codecs | 11 | import codecs |
| 13 | from html.entities import codepoint2name | 12 | from html.entities import codepoint2name |
| 14 | import re | 13 | import re |
| 15 | import logging | 14 | import logging |
| 16 | import string | ||
| 17 | 15 | ||
| 18 | # Import a library to autodetect character encodings. | 16 | # Import a library to autodetect character encodings. |
| 19 | chardet_type = None | 17 | chardet_type = None |
| @@ -38,12 +36,6 @@ except ImportError: | |||
| 38 | def chardet_dammit(s): | 36 | def chardet_dammit(s): |
| 39 | return None | 37 | return None |
| 40 | 38 | ||
| 41 | # Available from http://cjkpython.i18n.org/. | ||
| 42 | try: | ||
| 43 | import iconv_codec | ||
| 44 | except ImportError: | ||
| 45 | pass | ||
| 46 | |||
| 47 | xml_encoding_re = re.compile( | 39 | xml_encoding_re = re.compile( |
| 48 | r'^<\?.*encoding=[\'"](.*?)[\'"].*\?>'.encode(), re.I) | 40 | r'^<\?.*encoding=[\'"](.*?)[\'"].*\?>'.encode(), re.I) |
| 49 | html_meta_re = re.compile( | 41 | html_meta_re = re.compile( |
diff --git a/bitbake/lib/bs4/element.py b/bitbake/lib/bs4/element.py index 3775a60458..68be42d138 100644 --- a/bitbake/lib/bs4/element.py +++ b/bitbake/lib/bs4/element.py | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | __license__ = "MIT" | 1 | __license__ = "MIT" |
| 2 | 2 | ||
| 3 | from pdb import set_trace | ||
| 4 | import collections.abc | 3 | import collections.abc |
| 5 | import re | 4 | import re |
| 6 | import sys | 5 | import sys |
diff --git a/bitbake/lib/bs4/testing.py b/bitbake/lib/bs4/testing.py index 3a2f260e24..953bca8e91 100644 --- a/bitbake/lib/bs4/testing.py +++ b/bitbake/lib/bs4/testing.py | |||
| @@ -4,7 +4,6 @@ __license__ = "MIT" | |||
| 4 | 4 | ||
| 5 | import pickle | 5 | import pickle |
| 6 | import copy | 6 | import copy |
| 7 | import functools | ||
| 8 | import unittest | 7 | import unittest |
| 9 | from unittest import TestCase | 8 | from unittest import TestCase |
| 10 | from bs4 import BeautifulSoup | 9 | from bs4 import BeautifulSoup |
diff --git a/bitbake/lib/bs4/tests/test_docs.py b/bitbake/lib/bs4/tests/test_docs.py index 5b9f677093..d1d76a33bf 100644 --- a/bitbake/lib/bs4/tests/test_docs.py +++ b/bitbake/lib/bs4/tests/test_docs.py | |||
| @@ -7,19 +7,15 @@ __all__ = [ | |||
| 7 | 'additional_tests', | 7 | 'additional_tests', |
| 8 | ] | 8 | ] |
| 9 | 9 | ||
| 10 | import atexit | ||
| 11 | import doctest | 10 | import doctest |
| 12 | import os | ||
| 13 | #from pkg_resources import ( | 11 | #from pkg_resources import ( |
| 14 | # resource_filename, resource_exists, resource_listdir, cleanup_resources) | 12 | # resource_filename, resource_exists, resource_listdir, cleanup_resources) |
| 15 | import unittest | ||
| 16 | 13 | ||
| 17 | DOCTEST_FLAGS = ( | 14 | DOCTEST_FLAGS = ( |
| 18 | doctest.ELLIPSIS | | 15 | doctest.ELLIPSIS | |
| 19 | doctest.NORMALIZE_WHITESPACE | | 16 | doctest.NORMALIZE_WHITESPACE | |
| 20 | doctest.REPORT_NDIFF) | 17 | doctest.REPORT_NDIFF) |
| 21 | 18 | ||
| 22 | |||
| 23 | # def additional_tests(): | 19 | # def additional_tests(): |
| 24 | # "Run the doc tests (README.txt and docs/*, if any exist)" | 20 | # "Run the doc tests (README.txt and docs/*, if any exist)" |
| 25 | # doctest_files = [ | 21 | # doctest_files = [ |
diff --git a/bitbake/lib/bs4/tests/test_htmlparser.py b/bitbake/lib/bs4/tests/test_htmlparser.py index b45e35f999..30a25e6709 100644 --- a/bitbake/lib/bs4/tests/test_htmlparser.py +++ b/bitbake/lib/bs4/tests/test_htmlparser.py | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | """Tests to ensure that the html.parser tree builder generates good | 1 | """Tests to ensure that the html.parser tree builder generates good |
| 2 | trees.""" | 2 | trees.""" |
| 3 | 3 | ||
| 4 | from pdb import set_trace | ||
| 5 | import pickle | 4 | import pickle |
| 6 | from bs4.testing import SoupTest, HTMLTreeBuilderSmokeTest | 5 | from bs4.testing import SoupTest, HTMLTreeBuilderSmokeTest |
| 7 | from bs4.builder import HTMLParserTreeBuilder | 6 | from bs4.builder import HTMLParserTreeBuilder |
diff --git a/bitbake/lib/bs4/tests/test_lxml.py b/bitbake/lib/bs4/tests/test_lxml.py index 6c2a1d73eb..6b6cdd07cb 100644 --- a/bitbake/lib/bs4/tests/test_lxml.py +++ b/bitbake/lib/bs4/tests/test_lxml.py | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | """Tests to ensure that the lxml tree builder generates good trees.""" | 1 | """Tests to ensure that the lxml tree builder generates good trees.""" |
| 2 | 2 | ||
| 3 | import re | ||
| 4 | import warnings | 3 | import warnings |
| 5 | 4 | ||
| 6 | try: | 5 | try: |
| @@ -14,13 +13,8 @@ except ImportError as e: | |||
| 14 | if LXML_PRESENT: | 13 | if LXML_PRESENT: |
| 15 | from bs4.builder import LXMLTreeBuilder, LXMLTreeBuilderForXML | 14 | from bs4.builder import LXMLTreeBuilder, LXMLTreeBuilderForXML |
| 16 | 15 | ||
| 17 | from bs4 import ( | 16 | from bs4 import BeautifulStoneSoup |
| 18 | BeautifulSoup, | ||
| 19 | BeautifulStoneSoup, | ||
| 20 | ) | ||
| 21 | from bs4.element import Comment, Doctype, SoupStrainer | ||
| 22 | from bs4.testing import skipIf | 17 | from bs4.testing import skipIf |
| 23 | from bs4.tests import test_htmlparser | ||
| 24 | from bs4.testing import ( | 18 | from bs4.testing import ( |
| 25 | HTMLTreeBuilderSmokeTest, | 19 | HTMLTreeBuilderSmokeTest, |
| 26 | XMLTreeBuilderSmokeTest, | 20 | XMLTreeBuilderSmokeTest, |
diff --git a/bitbake/lib/bs4/tests/test_soup.py b/bitbake/lib/bs4/tests/test_soup.py index f87949e3d3..6ad3cb3765 100644 --- a/bitbake/lib/bs4/tests/test_soup.py +++ b/bitbake/lib/bs4/tests/test_soup.py | |||
| @@ -1,16 +1,12 @@ | |||
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | """Tests of Beautiful Soup as a whole.""" | 2 | """Tests of Beautiful Soup as a whole.""" |
| 3 | 3 | ||
| 4 | from pdb import set_trace | ||
| 5 | import logging | 4 | import logging |
| 6 | import unittest | 5 | import unittest |
| 7 | import sys | 6 | import sys |
| 8 | import tempfile | 7 | import tempfile |
| 9 | 8 | ||
| 10 | from bs4 import ( | 9 | from bs4 import BeautifulSoup |
| 11 | BeautifulSoup, | ||
| 12 | BeautifulStoneSoup, | ||
| 13 | ) | ||
| 14 | from bs4.element import ( | 10 | from bs4.element import ( |
| 15 | CharsetMetaAttributeValue, | 11 | CharsetMetaAttributeValue, |
| 16 | ContentMetaAttributeValue, | 12 | ContentMetaAttributeValue, |
diff --git a/bitbake/lib/bs4/tests/test_tree.py b/bitbake/lib/bs4/tests/test_tree.py index 6d3e67f311..8e5c66426e 100644 --- a/bitbake/lib/bs4/tests/test_tree.py +++ b/bitbake/lib/bs4/tests/test_tree.py | |||
| @@ -9,16 +9,12 @@ same markup, but all Beautiful Soup trees can be traversed with the | |||
| 9 | methods tested here. | 9 | methods tested here. |
| 10 | """ | 10 | """ |
| 11 | 11 | ||
| 12 | from pdb import set_trace | ||
| 13 | import copy | 12 | import copy |
| 14 | import pickle | 13 | import pickle |
| 15 | import re | 14 | import re |
| 16 | import warnings | 15 | import warnings |
| 17 | from bs4 import BeautifulSoup | 16 | from bs4 import BeautifulSoup |
| 18 | from bs4.builder import ( | 17 | from bs4.builder import builder_registry |
| 19 | builder_registry, | ||
| 20 | HTMLParserTreeBuilder, | ||
| 21 | ) | ||
| 22 | from bs4.element import ( | 18 | from bs4.element import ( |
| 23 | PY3K, | 19 | PY3K, |
| 24 | CData, | 20 | CData, |
| @@ -29,10 +25,7 @@ from bs4.element import ( | |||
| 29 | SoupStrainer, | 25 | SoupStrainer, |
| 30 | Tag, | 26 | Tag, |
| 31 | ) | 27 | ) |
| 32 | from bs4.testing import ( | 28 | from bs4.testing import SoupTest |
| 33 | SoupTest, | ||
| 34 | skipIf, | ||
| 35 | ) | ||
| 36 | 29 | ||
| 37 | XML_BUILDER_PRESENT = (builder_registry.lookup("xml") is not None) | 30 | XML_BUILDER_PRESENT = (builder_registry.lookup("xml") is not None) |
| 38 | LXML_PRESENT = (builder_registry.lookup("lxml") is not None) | 31 | LXML_PRESENT = (builder_registry.lookup("lxml") is not None) |
