|
12 | 12 |
|
13 | 13 |
|
14 | 14 | from zarr.compat import text_type, binary_type
|
15 |
| -from zarr.meta import encode_dtype, decode_dtype |
16 | 15 |
|
17 | 16 |
|
18 | 17 | codec_registry = dict()
|
@@ -471,16 +470,10 @@ def decode(self, buf, out=None):
|
471 | 470 | def get_config(self):
|
472 | 471 | config = dict()
|
473 | 472 | config['id'] = self.codec_id
|
474 |
| - config['dtype'] = encode_dtype(self.dtype) |
475 |
| - config['astype'] = encode_dtype(self.astype) |
| 473 | + config['dtype'] = self.dtype.str |
| 474 | + config['astype'] = self.astype.str |
476 | 475 | return config
|
477 | 476 |
|
478 |
| - @classmethod |
479 |
| - def from_config(cls, config): |
480 |
| - dtype = decode_dtype(config['dtype']) |
481 |
| - astype = decode_dtype(config['astype']) |
482 |
| - return cls(dtype=dtype, astype=astype) |
483 |
| - |
484 | 477 | def __repr__(self):
|
485 | 478 | r = '%s(dtype=%s' % (type(self).__name__, self.dtype)
|
486 | 479 | if self.astype != self.dtype:
|
@@ -595,21 +588,12 @@ def decode(self, buf, out=None):
|
595 | 588 | def get_config(self):
|
596 | 589 | config = dict()
|
597 | 590 | config['id'] = self.codec_id
|
598 |
| - config['astype'] = encode_dtype(self.astype) |
599 |
| - config['dtype'] = encode_dtype(self.dtype) |
| 591 | + config['astype'] = self.astype.str |
| 592 | + config['dtype'] = self.dtype.str |
600 | 593 | config['scale'] = self.scale
|
601 | 594 | config['offset'] = self.offset
|
602 | 595 | return config
|
603 | 596 |
|
604 |
| - @classmethod |
605 |
| - def from_config(cls, config): |
606 |
| - astype = decode_dtype(config['astype']) |
607 |
| - dtype = decode_dtype(config['dtype']) |
608 |
| - scale = config['scale'] |
609 |
| - offset = config['offset'] |
610 |
| - return cls(astype=astype, dtype=dtype, scale=scale, |
611 |
| - offset=offset) |
612 |
| - |
613 | 597 | def __repr__(self):
|
614 | 598 | r = '%s(scale=%s, offset=%s, dtype=%s' % \
|
615 | 599 | (type(self).__name__, self.scale, self.offset, self.dtype)
|
@@ -702,17 +686,10 @@ def get_config(self):
|
702 | 686 | config = dict()
|
703 | 687 | config['id'] = self.codec_id
|
704 | 688 | config['digits'] = self.digits
|
705 |
| - config['dtype'] = encode_dtype(self.dtype) |
706 |
| - config['astype'] = encode_dtype(self.astype) |
| 689 | + config['dtype'] = self.dtype.str |
| 690 | + config['astype'] = self.astype.str |
707 | 691 | return config
|
708 | 692 |
|
709 |
| - @classmethod |
710 |
| - def from_config(cls, config): |
711 |
| - dtype = decode_dtype(config['dtype']) |
712 |
| - astype = decode_dtype(config['astype']) |
713 |
| - digits = config['digits'] |
714 |
| - return cls(digits=digits, dtype=dtype, astype=astype) |
715 |
| - |
716 | 693 | def __repr__(self):
|
717 | 694 | r = '%s(digits=%s, dtype=%s' % \
|
718 | 695 | (type(self).__name__, self.digits, self.dtype)
|
@@ -806,10 +783,6 @@ def get_config(self):
|
806 | 783 | config['id'] = self.codec_id
|
807 | 784 | return config
|
808 | 785 |
|
809 |
| - @classmethod |
810 |
| - def from_config(cls, config): |
811 |
| - return cls() |
812 |
| - |
813 | 786 | def __repr__(self):
|
814 | 787 | r = '%s()' % type(self).__name__
|
815 | 788 | return r
|
@@ -921,17 +894,10 @@ def get_config(self):
|
921 | 894 | config = dict()
|
922 | 895 | config['id'] = self.codec_id
|
923 | 896 | config['labels'] = [_ensure_text(l) for l in self.labels]
|
924 |
| - config['dtype'] = encode_dtype(self.dtype) |
925 |
| - config['astype'] = encode_dtype(self.astype) |
| 897 | + config['dtype'] = self.dtype.str |
| 898 | + config['astype'] = self.astype.str |
926 | 899 | return config
|
927 | 900 |
|
928 |
| - @classmethod |
929 |
| - def from_config(cls, config): |
930 |
| - dtype = decode_dtype(config['dtype']) |
931 |
| - astype = decode_dtype(config['astype']) |
932 |
| - labels = config['labels'] |
933 |
| - return cls(labels=labels, dtype=dtype, astype=astype) |
934 |
| - |
935 | 901 | def __repr__(self):
|
936 | 902 | # make sure labels part is not too long
|
937 | 903 | labels = repr(self.labels[:3])
|
|
0 commit comments