| 98 | self._attributed = self._parse_attributes() |
| 99 | |
| 100 | def _parse_attributes(self): |
| 101 | if not self._attr_types: |
| 102 | return False |
| 103 | if not isinstance(self._attr_types, list): |
| 104 | raise ValueError("attr_types for Decoder must be a list, got {}." |
| 105 | .format(type(self._attr_types))) |
| 106 | for i in range(len(self._attr_types)): |
| 107 | type_name, bucket_size, is_multival = self.parse(self._attr_types[i]) |
| 108 | self._int_attr_num += int(type_name == "int") |
| 109 | self._float_attr_num += int(type_name == "float") |
| 110 | if is_multival: |
| 111 | self._string_attr_num += 1 |
| 112 | else: |
| 113 | self._int_attr_num += int(type_name == "string" and bucket_size is not None) |
| 114 | self._string_attr_num += int(type_name == "string" and bucket_size is None) |
| 115 | return True |
| 116 | |
| 117 | def _build_feature_spec(self): |
| 118 | num_attrs = len(self._attr_types) |