Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:dgarcia:python312:numeric
python-bloscpack
drop-python2-support.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File drop-python2-support.patch of Package python-bloscpack
Index: bloscpack-0.16.0/bloscpack/args.py =================================================================== --- bloscpack-0.16.0.orig/bloscpack/args.py +++ bloscpack-0.16.0/bloscpack/args.py @@ -3,7 +3,6 @@ import blosc -from six import integer_types, string_types from .abstract_objects import (MutableMappingObject, @@ -181,7 +180,7 @@ def calculate_nchunks(in_file_size, chun return (1, 0, 0) log.verbose("Input was length zero, ignoring 'chunk_size'") # convert a human readable description to an int - if isinstance(chunk_size, string_types): + if isinstance(chunk_size, str): chunk_size = reverse_pretty(chunk_size) check_range('chunk_size', chunk_size, 1, blosc.BLOSC_MAX_BUFFERSIZE) # downcast @@ -264,7 +263,7 @@ def _handle_max_apps(offsets, nchunks, m # it's a callable all right log.debug("max_app_chunks is a callable") max_app_chunks = max_app_chunks(nchunks) - if not isinstance(max_app_chunks, integer_types): + if not isinstance(max_app_chunks, int): raise ValueError( "max_app_chunks callable returned a non integer " "of type '%s'" % type(max_app_chunks)) @@ -272,7 +271,7 @@ def _handle_max_apps(offsets, nchunks, m if max_app_chunks < 0: raise ValueError( 'max_app_chunks callable returned a negative integer') - elif isinstance(max_app_chunks, integer_types): + elif isinstance(max_app_chunks, int): # it's a plain int, check its range log.debug("max_app_chunks is an int") check_range('max_app_chunks', max_app_chunks, 0, MAX_CHUNKS) @@ -425,7 +424,7 @@ class MetadataArgs(MutableMappingObject) def effective_max_meta_size(self, meta_size): if hasattr(self.max_meta_size, '__call__'): max_meta_size = self.max_meta_size(meta_size) - elif isinstance(self.max_meta_size, integer_types): + elif isinstance(self.max_meta_size, int): max_meta_size = self.max_meta_size log.debug('max meta size is deemed to be: %d' % max_meta_size) return max_meta_size Index: bloscpack-0.16.0/bloscpack/file_io.py =================================================================== --- bloscpack-0.16.0.orig/bloscpack/file_io.py +++ bloscpack-0.16.0/bloscpack/file_io.py @@ -8,8 +8,6 @@ import itertools import os.path as path import blosc -import six -from six.moves import xrange from deprecated import deprecated @@ -86,7 +84,7 @@ def _write_metadata(output_fp, metadata, serializer_impl = SERIALIZERS_LOOKUP[metadata_args.magic_format] metadata = serializer_impl.dumps(metadata) meta_size = len(metadata) - if six.PY3 and isinstance(metadata, str): + if isinstance(metadata, str): metadata = metadata.encode() if metadata_args.should_compress: codec_impl = metadata_args.meta_codec_impl @@ -128,7 +126,7 @@ def _write_metadata(output_fp, metadata, output_fp.write(raw_metadata_header) output_fp.write(metadata) prealloc = max_meta_size - meta_comp_size - for i in xrange(prealloc): + for i in range(prealloc): output_fp.write(b'\x00') metadata_total += prealloc log.debug("metadata has %d preallocated empty bytes" % prealloc) @@ -227,7 +225,7 @@ def _read_metadata(input_fp): ('compressed' if metadata_header.meta_codec != 'None' else 'uncompressed', metadata_header.meta_comp_size)) serializer_impl = SERIALIZERS_LOOKUP[metadata_header.magic_format] - if six.PY3 and isinstance(metadata, bytes): + if isinstance(metadata, bytes): metadata = metadata.decode() metadata = serializer_impl.loads(metadata) return metadata, metadata_header @@ -257,7 +255,7 @@ def _read_offsets(input_fp, bloscpack_he offsets_raw = input_fp.read(8 * total_entries) log.debug('Read raw offsets: %s' % repr(offsets_raw)) offsets = [decode_int64(offsets_raw[j - 8:j]) for j in - xrange(8, bloscpack_header.nchunks * 8 + 1, 8)] + range(8, bloscpack_header.nchunks * 8 + 1, 8)] log.debug('Offsets: %s' % offsets) return offsets else: @@ -363,7 +361,7 @@ class CompressedFPSource(CompressedSourc self.nchunks = self.bloscpack_header.nchunks def __iter__(self): - for i in xrange(self.nchunks): + for i in range(self.nchunks): compressed, header, digest = _read_compressed_chunk_fp(self.input_fp, self.checksum_impl) compressed(digest) Index: bloscpack-0.16.0/bloscpack/headers.py =================================================================== --- bloscpack-0.16.0.orig/bloscpack/headers.py +++ bloscpack-0.16.0/bloscpack/headers.py @@ -11,7 +11,6 @@ except ImportError: import blosc -from six import PY3, integer_types, binary_type from .abstract_objects import (MutableMappingObject, ) @@ -40,7 +39,7 @@ from . import log def check_range(name, value, min_, max_): """ Check that a variable is in range. """ - if not isinstance(value, integer_types): + if not isinstance(value, int): raise TypeError("'%s' must be of type 'int'" % name) elif not min_ <= value <= max_: raise ValueError( @@ -49,7 +48,7 @@ def check_range(name, value, min_, max_) def _check_str(name, value, max_len): - if not isinstance(value, binary_type): + if not isinstance(value, bytes): raise TypeError("'%s' must be of type 'str'/'bytes'" % name) elif len(value) > max_len: raise ValueError("'%s' can be of max length '%i' but is: '%s'" % @@ -103,10 +102,7 @@ def check_options_zero(options, indices) def decode_uint8(byte): - if PY3: - return byte - else: - return struct.unpack('<B', byte)[0] + return byte def decode_uint32(fourbyte): @@ -126,10 +122,7 @@ def decode_bitfield(byte): def decode_magic_string(str_): - if PY3: - return str_.strip(b'\x00') - else: - return str_.strip('\x00') + return str_.strip(b'\x00') def encode_uint8(byte): Index: bloscpack-0.16.0/bloscpack/memory_io.py =================================================================== --- bloscpack-0.16.0.orig/bloscpack/memory_io.py +++ bloscpack-0.16.0/bloscpack/memory_io.py @@ -2,7 +2,6 @@ # vim :set ft=py: import blosc -from six.moves import xrange from .abstract_io import (PlainSource, CompressedSource, @@ -38,7 +37,7 @@ class CompressedMemorySource(CompressedS self.checksums = compressed_memory_sink.checksums def __iter__(self): - for i in xrange(self.nchunks): + for i in range(self.nchunks): compressed = self.chunks[i] digest = self.checksums[i] if self.checksum else None compressed(digest) Index: bloscpack-0.16.0/bloscpack/numpy_io.py =================================================================== --- bloscpack-0.16.0.orig/bloscpack/numpy_io.py +++ bloscpack-0.16.0/bloscpack/numpy_io.py @@ -6,8 +6,6 @@ import ast import blosc import numpy -import six -from six.moves import xrange from deprecated import deprecated @@ -88,7 +86,7 @@ class PlainNumpySource(PlainSource): ) self.nitems = int(self.chunk_size / self.ndarray.itemsize) offset = self.ptr - for i in xrange(self.nchunks - 1): + for i in range(self.nchunks - 1): offset(self.nitems) offset += self.chunk_size offset(int(self.last_chunk / self.ndarray.itemsize)) @@ -111,8 +109,6 @@ def _conv(descr): descr = [_conv(d) for d in descr] else: descr = tuple([_conv(d) for d in descr]) - elif six.PY2 and isinstance(descr, unicode): # pragma: no cover - descr = str(descr) return descr
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor