Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1803e4d

Browse files
committed
Move a whole bunch of private modules to be underscore prefixed
1 parent83b98c7 commit1803e4d

File tree

14 files changed

+23
-23
lines changed

14 files changed

+23
-23
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 .constantsimporttokenTypes,tagTokenTypes
1212
from .constantsimportreplacementCharacters
1313

14-
from .inputstreamimportHTMLInputStream
14+
from ._inputstreamimportHTMLInputStream
1515

16-
from .trieimportTrie
16+
from ._trieimportTrie
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
exceptImportError:
99
fromordereddictimportOrderedDict
1010

11-
from .importinputstream
12-
from .importtokenizer
11+
from .import_inputstream
12+
from .import_tokenizer
1313

1414
from .importtreebuilders
1515
from .treebuilders.baseimportMarker
@@ -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
importpytest
66

77
from .supportimportget_data_files,test_dir,errorMessage,TestDataas_TestData
8-
fromhtml5libimportHTMLParser,inputstream
8+
fromhtml5libimportHTMLParser,_inputstream
99

1010

1111
deftest_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
assertlen(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
assertlen(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
deftest_parser_args(expected,data,kwargs):
50-
stream=inputstream.HTMLBinaryInputStream(data,useChardet=False,**kwargs)
50+
stream=_inputstream.HTMLBinaryInputStream(data,useChardet=False,**kwargs)
5151
assertexpected==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
defrunPreScanEncodingTest(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
deftest_chardet():
113113
withopen(os.path.join(test_dir,"encoding","chardet","test_big5.txt"),"rb")asfp:
114-
encoding=inputstream.HTMLInputStream(fp.read()).charEncoding
114+
encoding=_inputstream.HTMLInputStream(fp.read()).charEncoding
115115
assertencoding[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
importsix
1212
fromsix.movesimporthttp_client,urllib
1313

14-
fromhtml5lib.inputstreamimport (BufferedStream,HTMLInputStream,
15-
HTMLUnicodeInputStream,HTMLBinaryInputStream)
14+
fromhtml5lib._inputstreamimport (BufferedStream,HTMLInputStream,
15+
HTMLUnicodeInputStream,HTMLBinaryInputStream)
1616
fromhtml5lib.utilsimportsupports_lone_surrogates
1717

1818

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp