MCPcopy Create free account
hub / github.com/PyTables/PyTables / _pack

Method _pack

tables/filters.py:288–317  ·  view source on GitHub ↗

Pack the `Filters` object into a 64-bit NumPy integer.

(self)

Source from the content-addressed store, hash-verified

286 return cls(**kwargs)
287
288 def _pack(self) -> np.int64:
289 """Pack the `Filters` object into a 64-bit NumPy integer."""
290 packed = np.int64(0)
291
292 # Byte 3: least significant digit.
293 if self.least_significant_digit is not None:
294 # assert isinstance(self.least_significant_digit, np.int8)
295 packed |= self.least_significant_digit
296 packed <<= 8
297
298 # Byte 2: parameterless filters.
299 if self.shuffle:
300 packed |= _shuffle_flag
301 if self.bitshuffle:
302 packed |= _bitshuffle_flag
303 if self.fletcher32:
304 packed |= _fletcher32_flag
305 if self.least_significant_digit:
306 packed |= _rounding_flag
307 packed <<= 8
308
309 # Byte 1: compression library id (0 for none).
310 if self.complevel > 0:
311 packed |= all_complibs.index(self.complib) + 1
312 packed <<= 8
313
314 # Byte 0: compression level.
315 packed |= self.complevel
316
317 return packed
318
319 def __init__(
320 self,

Callers 6

test_filter_pack_01Method · 0.95
test_filter_pack_02Method · 0.95
test_filter_pack_03Method · 0.95
test_filter_pack_04Method · 0.95
_g__setattrMethod · 0.80
test_filter_pack_typeMethod · 0.80

Calls 1

indexMethod · 0.80

Tested by 5

test_filter_pack_01Method · 0.76
test_filter_pack_02Method · 0.76
test_filter_pack_03Method · 0.76
test_filter_pack_04Method · 0.76
test_filter_pack_typeMethod · 0.64