8000 Eliminate interfaces which lead one to believe that streams are rando… · html5lib/html5lib-python@b1bf2eb · GitHub
[go: up one dir, main page]

Skip to content

Commit b1bf2eb

Browse files
committed
Eliminate interfaces which lead one to believe that streams are random access
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40678
1 parent 202f004 commit b1bf2eb

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

src/inputstream.py

< 8000 span class="prc-TooltipV2-Tooltip-cYMVY" data-direction="s" role="tooltip" aria-hidden="true" id=":Rhmtlab:">Expand all lines: src/inputstream.py
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, source, encoding=None, parseMeta=True, chardet=True):
6464
self.queue = []
6565

6666
# Reset position in the list to read from
67-
self.reset()
67+
self.tell = 0
6868

6969
def openStream(self, source):
7070
"""Produces a file object from source.
@@ -122,7 +122,6 @@ def detectBOM(self):
122122
}
123123

124124
# Go to beginning of file and read in 4 bytes
125-
self.rawStream.seek(0)
126125
string = self.rawStream.read(4)
127126

128127
# Try detecting the BOM using bytes from the string
@@ -163,10 +162,6 @@ def position(self):
163162
col = tell - self.newLines[line-1] - 1
164163
return (line, col)
165164

166-
def reset(self):
167-
"""Resets the position in the stream back to the start."""
168-
self.tell = 0
169-
170165
def char(self):
171166
""" Read one character from the stream or queue if available. Return
172167
EOF when EOF is reached.

src/tokenizer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def __iter__(self):
7777
to return we yield the token which pauses processing until the next token
7878
is requested.
7979
"""
80-
self.stream.reset()
8180
self.tokenQueue = []
8281
# Start processing. When EOF is reached self.state will return False
8382
# instead of True and the loop will terminate.

0 commit comments

Comments
 (0)
0