| 1159 | """ |
| 1160 | |
| 1161 | def __init__( |
| 1162 | self, |
| 1163 | fields: Sequence[str], |
| 1164 | aliases: Optional[Sequence[str]] = None, |
| 1165 | labels: bool = True, |
| 1166 | localize: bool = False, |
| 1167 | style: Optional[str] = None, |
| 1168 | class_name: str = "geojsondetail", |
| 1169 | ): |
| 1170 | super().__init__() |
| 1171 | assert isinstance( |
| 1172 | fields, (list, tuple) |
| 1173 | ), "Please pass a list or tuple to fields." |
| 1174 | if aliases is not None: |
| 1175 | assert isinstance(aliases, (list, tuple)) |
| 1176 | assert len(fields) == len( |
| 1177 | aliases |
| 1178 | ), "fields and aliases must have the same length." |
| 1179 | assert isinstance(labels, bool), "labels requires a boolean value." |
| 1180 | assert isinstance(localize, bool), "localize must be bool." |
| 1181 | self._name = "GeoJsonDetail" |
| 1182 | self.fields = fields |
| 1183 | self.aliases = aliases if aliases is not None else fields |
| 1184 | self.labels = labels |
| 1185 | self.localize = localize |
| 1186 | self.class_name = class_name |
| 1187 | if style: |
| 1188 | assert isinstance( |
| 1189 | style, str |
| 1190 | ), "Pass a valid inline HTML style property string to style." |
| 1191 | # noqa outside of type checking. |
| 1192 | self.style = style |
| 1193 | |
| 1194 | def warn_for_geometry_collections(self) -> None: |
| 1195 | """Checks for GeoJson GeometryCollection features to warn user about incompatibility.""" |