Skip to content

Commit

Permalink
document what is t be deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Apr 14, 2023
1 parent 33d821a commit 69f8c17
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions fastkml/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,24 @@ def etree_element(
return element

def from_element(self, element: Element) -> None:
"""Load the KML Object from an Element."""
"""
Load the KML Object from an Element.
This implementation is deprecated and will be replaced by class_from_element
making it a classmethod.
"""
if f"{self.ns}{self.__name__}" != element.tag:
raise TypeError("Call of abstract base class, subclasses implement this!")
for mapping in self.kml_object_mapping:
mapping["from_kml"](self, element, **mapping)

def from_string(self, xml_string: str) -> None:
"""Load the KML Object from serialized xml."""
"""
Load the KML Object from serialized xml.
This implementation is deprecated and will be replaced by class_from_string
making it a classmethod.
"""
self.from_element(
cast(Element, config.etree.XML(xml_string)) # type: ignore[attr-defined]
)
Expand Down Expand Up @@ -266,6 +276,7 @@ def _get_kwargs(
element: Element,
strict: bool,
) -> Dict[str, Any]:
"""Get the keyword arguments to build the object from an element."""
return {
"id": cls._get_id(element=element, strict=strict),
"target_id": cls._get_target_id(element=element, strict=strict),
Expand Down
2 changes: 1 addition & 1 deletion fastkml/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@


class Geometry(_BaseObject):
""" """
"""Deprecated: to be replaced by the subclasses of _Geometry."""

geometry = None
extrude = False
Expand Down
2 changes: 1 addition & 1 deletion tests/geometries/polygon_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021 Christian Ledermann
# Copyright (C) 2023 Christian Ledermann
#
# This library is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
Expand Down

0 comments on commit 69f8c17

Please sign in to comment.