|
| 1 | +Index: bloscpack-0.16.0/bloscpack/args.py |
| 2 | +=================================================================== |
| 3 | +--- bloscpack-0.16.0.orig/bloscpack/args.py |
| 4 | ++++ bloscpack-0.16.0/bloscpack/args.py |
| 5 | +@@ -3,7 +3,6 @@ |
| 6 | + |
| 7 | + |
| 8 | + import blosc |
| 9 | +-from six import integer_types, string_types |
| 10 | + |
| 11 | + |
| 12 | + from .abstract_objects import (MutableMappingObject, |
| 13 | +@@ -181,7 +180,7 @@ def calculate_nchunks(in_file_size, chun |
| 14 | + return (1, 0, 0) |
| 15 | + log.verbose("Input was length zero, ignoring 'chunk_size'") |
| 16 | + # convert a human readable description to an int |
| 17 | +- if isinstance(chunk_size, string_types): |
| 18 | ++ if isinstance(chunk_size, str): |
| 19 | + chunk_size = reverse_pretty(chunk_size) |
| 20 | + check_range('chunk_size', chunk_size, 1, blosc.BLOSC_MAX_BUFFERSIZE) |
| 21 | + # downcast |
| 22 | +@@ -264,7 +263,7 @@ def _handle_max_apps(offsets, nchunks, m |
| 23 | + # it's a callable all right |
| 24 | + log.debug("max_app_chunks is a callable") |
| 25 | + max_app_chunks = max_app_chunks(nchunks) |
| 26 | +- if not isinstance(max_app_chunks, integer_types): |
| 27 | ++ if not isinstance(max_app_chunks, int): |
| 28 | + raise ValueError( |
| 29 | + "max_app_chunks callable returned a non integer " |
| 30 | + "of type '%s'" % type(max_app_chunks)) |
| 31 | +@@ -272,7 +271,7 @@ def _handle_max_apps(offsets, nchunks, m |
| 32 | + if max_app_chunks < 0: |
| 33 | + raise ValueError( |
| 34 | + 'max_app_chunks callable returned a negative integer') |
| 35 | +- elif isinstance(max_app_chunks, integer_types): |
| 36 | ++ elif isinstance(max_app_chunks, int): |
| 37 | + # it's a plain int, check its range |
| 38 | + log.debug("max_app_chunks is an int") |
| 39 | + check_range('max_app_chunks', max_app_chunks, 0, MAX_CHUNKS) |
| 40 | +@@ -425,7 +424,7 @@ class MetadataArgs(MutableMappingObject) |
| 41 | + def effective_max_meta_size(self, meta_size): |
| 42 | + if hasattr(self.max_meta_size, '__call__'): |
| 43 | + max_meta_size = self.max_meta_size(meta_size) |
| 44 | +- elif isinstance(self.max_meta_size, integer_types): |
| 45 | ++ elif isinstance(self.max_meta_size, int): |
| 46 | + max_meta_size = self.max_meta_size |
| 47 | + log.debug('max meta size is deemed to be: %d' % max_meta_size) |
| 48 | + return max_meta_size |
| 49 | +Index: bloscpack-0.16.0/bloscpack/file_io.py |
| 50 | +=================================================================== |
| 51 | +--- bloscpack-0.16.0.orig/bloscpack/file_io.py |
| 52 | ++++ bloscpack-0.16.0/bloscpack/file_io.py |
| 53 | +@@ -8,8 +8,6 @@ import itertools |
| 54 | + import os.path as path |
| 55 | + |
| 56 | + import blosc |
| 57 | +-import six |
| 58 | +-from six.moves import xrange |
| 59 | + from deprecated import deprecated |
| 60 | + |
| 61 | + |
| 62 | +@@ -86,7 +84,7 @@ def _write_metadata(output_fp, metadata, |
| 63 | + serializer_impl = SERIALIZERS_LOOKUP[metadata_args.magic_format] |
| 64 | + metadata = serializer_impl.dumps(metadata) |
| 65 | + meta_size = len(metadata) |
| 66 | +- if six.PY3 and isinstance(metadata, str): |
| 67 | ++ if isinstance(metadata, str): |
| 68 | + metadata = metadata.encode() |
| 69 | + if metadata_args.should_compress: |
| 70 | + codec_impl = metadata_args.meta_codec_impl |
| 71 | +@@ -128,7 +126,7 @@ def _write_metadata(output_fp, metadata, |
| 72 | + output_fp.write(raw_metadata_header) |
| 73 | + output_fp.write(metadata) |
| 74 | + prealloc = max_meta_size - meta_comp_size |
| 75 | +- for i in xrange(prealloc): |
| 76 | ++ for i in range(prealloc): |
| 77 | + output_fp.write(b'\x00') |
| 78 | + metadata_total += prealloc |
| 79 | + log.debug("metadata has %d preallocated empty bytes" % prealloc) |
| 80 | +@@ -227,7 +225,7 @@ def _read_metadata(input_fp): |
| 81 | + ('compressed' if metadata_header.meta_codec != 'None' else |
| 82 | + 'uncompressed', metadata_header.meta_comp_size)) |
| 83 | + serializer_impl = SERIALIZERS_LOOKUP[metadata_header.magic_format] |
| 84 | +- if six.PY3 and isinstance(metadata, bytes): |
| 85 | ++ if isinstance(metadata, bytes): |
| 86 | + metadata = metadata.decode() |
| 87 | + metadata = serializer_impl.loads(metadata) |
| 88 | + return metadata, metadata_header |
| 89 | +@@ -257,7 +255,7 @@ def _read_offsets(input_fp, bloscpack_he |
| 90 | + offsets_raw = input_fp.read(8 * total_entries) |
| 91 | + log.debug('Read raw offsets: %s' % repr(offsets_raw)) |
| 92 | + offsets = [decode_int64(offsets_raw[j - 8:j]) for j in |
| 93 | +- xrange(8, bloscpack_header.nchunks * 8 + 1, 8)] |
| 94 | ++ range(8, bloscpack_header.nchunks * 8 + 1, 8)] |
| 95 | + log.debug('Offsets: %s' % offsets) |
| 96 | + return offsets |
| 97 | + else: |
| 98 | +@@ -363,7 +361,7 @@ class CompressedFPSource(CompressedSourc |
| 99 | + self.nchunks = self.bloscpack_header.nchunks |
| 100 | + |
| 101 | + def __iter__(self): |
| 102 | +- for i in xrange(self.nchunks): |
| 103 | ++ for i in range(self.nchunks): |
| 104 | + compressed, header, digest = _read_compressed_chunk_fp(self.input_fp, self.checksum_impl) |
| 105 | + compressed(digest) |
| 106 | + |
| 107 | +Index: bloscpack-0.16.0/bloscpack/headers.py |
| 108 | +=================================================================== |
| 109 | +--- bloscpack-0.16.0.orig/bloscpack/headers.py |
| 110 | ++++ bloscpack-0.16.0/bloscpack/headers.py |
| 111 | +@@ -11,7 +11,6 @@ except ImportError: |
| 112 | + |
| 113 | + |
| 114 | + import blosc |
| 115 | +-from six import PY3, integer_types, binary_type |
| 116 | + |
| 117 | + from .abstract_objects import (MutableMappingObject, |
| 118 | + ) |
| 119 | +@@ -40,7 +39,7 @@ from . import log |
| 120 | + |
| 121 | + def check_range(name, value, min_, max_): |
| 122 | + """ Check that a variable is in range. """ |
| 123 | +- if not isinstance(value, integer_types): |
| 124 | ++ if not isinstance(value, int): |
| 125 | + raise TypeError("'%s' must be of type 'int'" % name) |
| 126 | + elif not min_ <= value <= max_: |
| 127 | + raise ValueError( |
| 128 | +@@ -49,7 +48,7 @@ def check_range(name, value, min_, max_) |
| 129 | + |
| 130 | + |
| 131 | + def _check_str(name, value, max_len): |
| 132 | +- if not isinstance(value, binary_type): |
| 133 | ++ if not isinstance(value, bytes): |
| 134 | + raise TypeError("'%s' must be of type 'str'/'bytes'" % name) |
| 135 | + elif len(value) > max_len: |
| 136 | + raise ValueError("'%s' can be of max length '%i' but is: '%s'" % |
| 137 | +@@ -103,10 +102,7 @@ def check_options_zero(options, indices) |
| 138 | + |
| 139 | + |
| 140 | + def decode_uint8(byte): |
| 141 | +- if PY3: |
| 142 | +- return byte |
| 143 | +- else: |
| 144 | +- return struct.unpack('<B', byte)[0] |
| 145 | ++ return byte |
| 146 | + |
| 147 | + |
| 148 | + def decode_uint32(fourbyte): |
| 149 | +@@ -126,10 +122,7 @@ def decode_bitfield(byte): |
| 150 | + |
| 151 | + |
| 152 | + def decode_magic_string(str_): |
| 153 | +- if PY3: |
| 154 | +- return str_.strip(b'\x00') |
| 155 | +- else: |
| 156 | +- return str_.strip('\x00') |
| 157 | ++ return str_.strip(b'\x00') |
| 158 | + |
| 159 | + |
| 160 | + def encode_uint8(byte): |
| 161 | +Index: bloscpack-0.16.0/bloscpack/memory_io.py |
| 162 | +=================================================================== |
| 163 | +--- bloscpack-0.16.0.orig/bloscpack/memory_io.py |
| 164 | ++++ bloscpack-0.16.0/bloscpack/memory_io.py |
| 165 | +@@ -2,7 +2,6 @@ |
| 166 | + # vim :set ft=py: |
| 167 | + |
| 168 | + import blosc |
| 169 | +-from six.moves import xrange |
| 170 | + |
| 171 | + from .abstract_io import (PlainSource, |
| 172 | + CompressedSource, |
| 173 | +@@ -38,7 +37,7 @@ class CompressedMemorySource(CompressedS |
| 174 | + self.checksums = compressed_memory_sink.checksums |
| 175 | + |
| 176 | + def __iter__(self): |
| 177 | +- for i in xrange(self.nchunks): |
| 178 | ++ for i in range(self.nchunks): |
| 179 | + compressed = self.chunks[i] |
| 180 | + digest = self.checksums[i] if self.checksum else None |
| 181 | + compressed(digest) |
| 182 | +Index: bloscpack-0.16.0/bloscpack/numpy_io.py |
| 183 | +=================================================================== |
| 184 | +--- bloscpack-0.16.0.orig/bloscpack/numpy_io.py |
| 185 | ++++ bloscpack-0.16.0/bloscpack/numpy_io.py |
| 186 | +@@ -6,8 +6,6 @@ import ast |
| 187 | + |
| 188 | + import blosc |
| 189 | + import numpy |
| 190 | +-import six |
| 191 | +-from six.moves import xrange |
| 192 | + from deprecated import deprecated |
| 193 | + |
| 194 | + |
| 195 | +@@ -88,7 +86,7 @@ class PlainNumpySource(PlainSource): |
| 196 | + ) |
| 197 | + self.nitems = int(self.chunk_size / self.ndarray.itemsize) |
| 198 | + offset = self.ptr |
| 199 | +- for i in xrange(self.nchunks - 1): |
| 200 | ++ for i in range(self.nchunks - 1): |
| 201 | + offset(self.nitems) |
| 202 | + offset += self.chunk_size |
| 203 | + offset(int(self.last_chunk / self.ndarray.itemsize)) |
| 204 | +@@ -111,8 +109,6 @@ def _conv(descr): |
| 205 | + descr = [_conv(d) for d in descr] |
| 206 | + else: |
| 207 | + descr = tuple([_conv(d) for d in descr]) |
| 208 | +- elif six.PY2 and isinstance(descr, unicode): # pragma: no cover |
| 209 | +- descr = str(descr) |
| 210 | + return descr |
| 211 | + |
| 212 | + |
0 commit comments