Skip to content

Commit

Permalink
add deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Oct 14, 2023
1 parent 0023501 commit 7901627
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions fastkml/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import contextlib
import logging
import re
import warnings
from functools import partial
from typing import Any
from typing import Dict
Expand Down Expand Up @@ -112,6 +113,10 @@ def __init__(
https://developers.google.com/kml/documentation/kmlreference#geometry
"""
warnings.warn(
"Geometry is deprecated. Use the subclasses of _Geometry instead.",
DeprecationWarning,
)
super().__init__(ns=ns, id=id, target_id=target_id)
self.extrude = extrude
self.tessellate = tessellate
Expand Down Expand Up @@ -302,6 +307,11 @@ def etree_element(
precision: Optional[int] = None,
verbosity: Verbosity = Verbosity.normal,
) -> Element:
warnings.warn(
"Geometry.etree_element is deprecated. "
"Use the subclasses of _Geometry instead.",
DeprecationWarning,
)
if isinstance(self.geometry, geo.Point):
return self._etree_point(self.geometry)
elif isinstance(self.geometry, geo.LinearRing):
Expand Down Expand Up @@ -471,6 +481,11 @@ def _get_multigeometry(self, element: Element) -> Optional[MultiGeometryType]:
return None

def from_element(self, element: Element) -> None:
warnings.warn(
"Geometry.from_element is deprecated. "
"Use the subclasses of _Geometry instead.",
DeprecationWarning,
)
geom = self._get_geometry(element)
if geom is not None:
self.geometry = geom
Expand Down

0 comments on commit 7901627

Please sign in to comment.