8000 Add six for integer types compatibility · netzulo/python-io-chunks@58b2dca · GitHub
[go: up one dir, main page]

Skip to content

Commit 58b2dca

Browse files
committed
Add six for integer types compatibility
1 parent 68fb460 commit 58b2dca

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

io_chunks/chunks.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from io import (
55
RawIOBase, IOBase, SEEK_SET, SEEK_CUR, SEEK_END, UnsupportedOperation
66
)
7+
from six import integer_types
78

89

910
class RawIOChunk(RawIOBase):
@@ -38,12 +39,12 @@ def __init__(self, stream, size, start=None):
3839
raise ValueError("Buffer is not seekable")
3940
if stream.closed:
4041
raise ValueError("Buffer is closed")
41-
if not isinstance(size, int):
42+
if not isinstance(size, integer_types):
4243
raise TypeError("size: expected int, got {0!s}"
4344
.format(type(size)))
4445
if start is None:
4546
start = stream.tell()
46-
elif not isinstance(start, int):
47+
elif not isinstance(start, integer_types):
4748
raise TypeError("start: expected int, got {0!s}"
4849
.format(type(start)))
4950
self._start = start
@@ -84,9 +85,9 @@ def readinto(self, array):
8485
return read_size
8586

8687
def seek(self, pos, whence=0):
87-
if not isinstance(pos, int):
88+
if not isinstance(pos, integer_types):
8889
raise TypeError("pos: expected int, got {0!s}".format(type(pos)))
89-
if not isinstance(whence, int):
90+
if not isinstance(whence, integer_types):
9091
raise TypeError("whence: expected int, got {0!s}"
9192
.format(type(whence)))
9293
if whence == SEEK_SET:

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def get_long_description():
3030
keywords=app_meta.KEYWORDS,
3131
packages=find_packages(exclude=['docs', 'tests', 'venv']),
3232
url=app_meta.URL,
33+
install_requires=[
34+
'six'
35+
],
3336
extras_require={
3437
'test': 'nose',
3538
},

0 commit comments

Comments
 (0)
0