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.pyrenamed 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

‎html5lib/tests/tokenizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
importpytest
99
fromsiximportunichr
1010

11-
fromhtml5lib.tokenizerimportHTMLTokenizer
11+
fromhtml5lib._tokenizerimportHTMLTokenizer
1212
fromhtml5libimportconstants,utils
1313

1414

‎html5lib/treebuilders/etree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
importre
77

88
from .importbase
9-
from ..importihatexml
9+
from ..import_ihatexml
1010
from ..importconstants
1111
from ..constantsimportnamespaces
1212
from ..utilsimportmoduleFactoryFactory
@@ -259,7 +259,7 @@ def serializeElement(element, indent=0):
259259
deftostring(element):# pylint:disable=unused-variable
260260
"""Serialize an element and its child nodes to a string"""
261261
rv= []
262-
filter=ihatexml.InfosetFilter()
262+
filter=_ihatexml.InfosetFilter()
263263

264264
defserializeElement(element):
265265
ifisinstance(element,ElementTree.ElementTree):

‎html5lib/treebuilders/etree_lxml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from ..constantsimportDataLossWarning
2121
from ..importconstants
2222
from .importetreeasetree_builders
23-
from ..importihatexml
23+
from ..import_ihatexml
2424

2525
importlxml.etreeasetree
2626

@@ -54,7 +54,7 @@ def _getChildNodes(self):
5454

5555
deftestSerializer(element):
5656
rv= []
57-
infosetFilter=ihatexml.InfosetFilter(preventDoubleDashComments=True)
57+
infosetFilter=_ihatexml.InfosetFilter(preventDoubleDashComments=True)
5858

5959
defserializeElement(element,indent=0):
6060
ifnothasattr(element,"tag"):
@@ -182,7 +182,7 @@ class TreeBuilder(base.TreeBuilder):
182182

183183
def__init__(self,namespaceHTMLElements,fullTree=False):
184184
builder=etree_builders.getETreeModule(etree,fullTree=fullTree)
185-
infosetFilter=self.infosetFilter=ihatexml.InfosetFilter(preventDoubleDashComments=True)
185+
infosetFilter=self.infosetFilter=_ihatexml.InfosetFilter(preventDoubleDashComments=True)
186186
self.namespaceHTMLElements=namespaceHTMLElements
187187

188188
classAttributes(dict):

‎html5lib/treewalkers/etree_lxml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from .importbase
88

9-
from ..importihatexml
9+
from ..import_ihatexml
1010

1111

1212
defensure_str(s):
@@ -132,7 +132,7 @@ def __init__(self, tree):
132132
self.fragmentChildren=set()
133133
tree=Root(tree)
134134
base.NonRecursiveTreeWalker.__init__(self,tree)
135-
self.filter=ihatexml.InfosetFilter()
135+
self.filter=_ihatexml.InfosetFilter()
136136

137137
defgetNodeDetails(self,node):
138138
ifisinstance(node,tuple):# Text node

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp