diff --git a/fastkml/features.py b/fastkml/features.py index e32be911..2cc1b4a3 100644 --- a/fastkml/features.py +++ b/fastkml/features.py @@ -462,10 +462,10 @@ def _get_kwargs( kwargs["description"] = description.text visibility = element.find(f"{ns}visibility") if visibility is not None and visibility.text: - kwargs["visibility"] = visibility.text in ["1", "true"] + kwargs["visibility"] = visibility.text in {"1", "true"} isopen = element.find(f"{ns}open") if isopen is not None: - kwargs["isopen"] = isopen.text in ["1", "true"] + kwargs["isopen"] = isopen.text in {"1", "true"} address = element.find(f"{ns}address") if address is not None: kwargs["address"] = address.text @@ -541,7 +541,8 @@ def __init__( extended_data=extended_data, ) if kml_geometry and geometry: - raise ValueError("You can only specify one of kml_geometry or geometry") + msg = "You can only specify one of kml_geometry or geometry" + raise ValueError(msg) if geometry: kml_geometry = create_kml_geometry( # type: ignore[assignment] geometry=geometry, diff --git a/fastkml/geometry.py b/fastkml/geometry.py index 884a03f7..e97c7641 100644 --- a/fastkml/geometry.py +++ b/fastkml/geometry.py @@ -771,4 +771,5 @@ def create_kml_geometry( geometry=geom, ), ) - raise KMLWriteError(f"Unsupported geometry type {type(geometry)}") + msg = f"Unsupported geometry type {type(geometry)}" + raise KMLWriteError(msg) diff --git a/fastkml/styles.py b/fastkml/styles.py index 2c41d70f..17ae6100 100644 --- a/fastkml/styles.py +++ b/fastkml/styles.py @@ -871,7 +871,7 @@ def _get_kwargs( key = pair.find(f"{ns}key") style = pair.find(f"{ns}Style") style_url = pair.find(f"{ns}styleUrl") - if key is None or key.text not in ["highlight", "normal"]: + if key is None or key.text not in {"highlight", "normal"}: raise ValueError elif key.text == "highlight": if style is not None: diff --git a/fastkml/views.py b/fastkml/views.py index 4a488eb9..e94e80ab 100644 --- a/fastkml/views.py +++ b/fastkml/views.py @@ -198,19 +198,19 @@ def etree_element( ) tilt.text = str(self.tilt) if self.altitude_mode: - if self.altitude_mode in ( + if self.altitude_mode in { AltitudeMode.clamp_to_ground, AltitudeMode.relative_to_ground, AltitudeMode.absolute, - ): + }: altitude_mode = config.etree.SubElement( # type: ignore[attr-defined] element, f"{self.ns}altitudeMode", ) - elif self.altitude_mode in ( + elif self.altitude_mode in { AltitudeMode.clamp_to_sea_floor, AltitudeMode.relative_to_sea_floor, - ): + }: altitude_mode = config.etree.SubElement( # type: ignore[attr-defined] element, f"{self.name_spaces['gx']}altitudeMode",