summaryrefslogtreecommitdiff
path: root/pip/_vendor/html5lib/inputstream.py
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2014-05-03 01:13:28 -0400
committerDonald Stufft <donald@stufft.io>2014-05-03 01:13:28 -0400
commit0e72f65bf4e5ea6b8fd17d02fe4cae0ba7da5113 (patch)
tree5c04afcabe3c7087e38b8114b19de437f2cf4ab3 /pip/_vendor/html5lib/inputstream.py
parentbdef6cebfb4e92a388cf84ed55cbd4ead8ef269c (diff)
parent93098d0c6781dd7019dfa43d9030f14b28f1bf2d (diff)
downloadpip-1.5.5.tar.gz
Merge branch '1.5.X'1.5.5
Conflicts: .travis/py34.sh CHANGES.txt PROJECT.txt
Diffstat (limited to 'pip/_vendor/html5lib/inputstream.py')
-rw-r--r--pip/_vendor/html5lib/inputstream.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/pip/_vendor/html5lib/inputstream.py b/pip/_vendor/html5lib/inputstream.py
index 0ac70bb3a..f3dfd7f3d 100644
--- a/pip/_vendor/html5lib/inputstream.py
+++ b/pip/_vendor/html5lib/inputstream.py
@@ -43,7 +43,7 @@ ascii_punctuation_re = re.compile("[\u0009-\u000D\u0020-\u002F\u003A-\u0040\u005
charsUntilRegEx = {}
-class BufferedStream:
+class BufferedStream(object):
"""Buffering for streams that do not have buffering of their own
The buffer is implemented as a list of chunks on the assumption that
@@ -63,11 +63,11 @@ class BufferedStream:
return pos
def seek(self, pos):
- assert pos < self._bufferedBytes()
+ assert pos <= self._bufferedBytes()
offset = pos
i = 0
while len(self.buffer[i]) < offset:
- offset -= pos
+ offset -= len(self.buffer[i])
i += 1
self.position = [i, offset]
@@ -114,7 +114,7 @@ class BufferedStream:
if remainingBytes:
rv.append(self._readStream(remainingBytes))
- return "".join(rv)
+ return b"".join(rv)
def HTMLInputStream(source, encoding=None, parseMeta=True, chardet=True):
@@ -132,7 +132,7 @@ def HTMLInputStream(source, encoding=None, parseMeta=True, chardet=True):
return HTMLBinaryInputStream(source, encoding, parseMeta, chardet)
-class HTMLUnicodeInputStream:
+class HTMLUnicodeInputStream(object):
"""Provides a unicode stream of characters to the HTMLTokenizer.
This class takes care of character encoding and removing or replacing