Skip to content

Commit 358cdf2

Browse files
committed
Move a whole bunch of private modules to be underscore prefixed
1 parent 0cbf8a4 commit 358cdf2

File tree

15 files changed

+24
-24
lines changed

15 files changed

+24
-24
lines changed
File renamed without changes.
File renamed without changes.

html5lib/tokenizer.py renamed to html5lib/_tokenizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from .constants import tokenTypes, tagTokenTypes
1212
from .constants import replacementCharacters
1313

14-
from .inputstream import HTMLInputStream
14+
from ._inputstream import HTMLInputStream
1515

16-
from .trie import Trie
16+
from ._trie import Trie
1717

1818
entitiesTrie = Trie(entities)
1919

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

html5lib/html5parser.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
except ImportError:
99
from ordereddict import OrderedDict
1010

11-
from . import inputstream
12-
from . import tokenizer
11+
from . import _inputstream
12+
from . import _tokenizer
1313

1414
from . import treebuilders
1515
from .treebuilders.base import Marker
@@ -82,7 +82,7 @@ def _parse(self, stream, innerHTML=False, container="div", scripting=False, **kw
8282
self.innerHTMLMode = innerHTML
8383
self.container = container
8484
self.scripting = scripting
85-
self.tokenizer = tokenizer.HTMLTokenizer(stream, parser=self, **kwargs)
85+
self.tokenizer = _tokenizer.HTMLTokenizer(stream, parser=self, **kwargs)
8686
self.reset()
8787

8888
try:
@@ -687,8 +687,8 @@ def startTagMeta(self, token):
687687
# the abstract Unicode string, and just use the
688688
# ContentAttrParser on that, but using UTF-8 allows all chars
689689
# to be encoded and as a ASCII-superset works.
690-
data = inputstream.EncodingBytes(attributes["content"].encode("utf-8"))
691-
parser = inputstream.ContentAttrParser(data)
690+
data = _inputstream.EncodingBytes(attributes["content"].encode("utf-8"))
691+
parser = _inputstream.ContentAttrParser(data)
692692
codec = parser.parse()
693693
self.parser.tokenizer.stream.changeEncoding(codec)
694694

html5lib/tests/test_encoding.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
import pytest
66

77
from .support import get_data_files, test_dir, errorMessage, TestData as _TestData
8-
from html5lib import HTMLParser, inputstream
8+
from html5lib import HTMLParser, _inputstream
99

1010

1111
def test_basic_prescan_length():
1212
data = "<title>Caf\u00E9</title><!--a--><meta charset='utf-8'>".encode('utf-8')
1313
pad = 1024 - len(data) + 1
1414
data = data.replace(b"-a-", b"-" + (b"a" * pad) + b"-")
1515
assert len(data) == 1024 # Sanity
16-
stream = inputstream.HTMLBinaryInputStream(data, useChardet=False)
16+
stream = _inputstream.HTMLBinaryInputStream(data, useChardet=False)
1717
assert 'utf-8' == stream.charEncoding[0].name
1818

1919

@@ -22,7 +22,7 @@ def test_parser_reparse():
2222
pad = 10240 - len(data) + 1
2323
data = data.replace(b"-a-", b"-" + (b"a" * pad) + b"-")
2424
assert len(data) == 10240 # Sanity
25-
stream = inputstream.HTMLBinaryInputStream(data, useChardet=False)
25+
stream = _inputstream.HTMLBinaryInputStream(data, useChardet=False)
2626
assert 'windows-1252' == stream.charEncoding[0].name
2727
p = HTMLParser(namespaceHTMLElements=False)
2828
doc = p.parse(data, useChardet=False)
@@ -47,7 +47,7 @@ def test_parser_reparse():
4747
("windows-1252", b"", {}),
4848
])
4949
def test_parser_args(expected, data, kwargs):
50-
stream = inputstream.HTMLBinaryInputStream(data, useChardet=False, **kwargs)
50+
stream = _inputstream.HTMLBinaryInputStream(data, useChardet=False, **kwargs)
5151
assert expected == stream.charEncoding[0].name
5252
p = HTMLParser()
5353
p.parse(data, useChardet=False, **kwargs)
@@ -85,7 +85,7 @@ def runParserEncodingTest(data, encoding):
8585

8686

8787
def runPreScanEncodingTest(data, encoding):
88-
stream = inputstream.HTMLBinaryInputStream(data, useChardet=False)
88+
stream = _inputstream.HTMLBinaryInputStream(data, useChardet=False)
8989
encoding = encoding.lower().decode("ascii")
9090

9191
# Very crude way to ignore irrelevant tests
@@ -111,6 +111,6 @@ def test_encoding():
111111
else:
112112
def test_chardet():
113113
with open(os.path.join(test_dir, "encoding", "chardet", "test_big5.txt"), "rb") as fp:
114-
encoding = inputstream.HTMLInputStream(fp.read()).charEncoding
114+
encoding = _inputstream.HTMLInputStream(fp.read()).charEncoding
115115
assert encoding[0].name == "big5"
116116
# pylint:enable=wrong-import-position

html5lib/tests/test_stream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import six
1212
from six.moves import http_client, urllib
1313

14-
from html5lib.inputstream import (BufferedStream, HTMLInputStream,
15-
HTMLUnicodeInputStream, HTMLBinaryInputStream)
14+
from html5lib._inputstream import (BufferedStream, HTMLInputStream,
15+
HTMLUnicodeInputStream, HTMLBinaryInputStream)
1616
from html5lib.utils import supports_lone_surrogates
1717

1818

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy