From 568b643369912b6389c5b5f4775fba4b7b3781ca Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Mon, 20 Nov 2023 22:31:49 +0000 Subject: [PATCH 01/25] Refactor code --- fastkml/kml.py | 74 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/fastkml/kml.py b/fastkml/kml.py index 2d3b02b9..d01e1ba7 100644 --- a/fastkml/kml.py +++ b/fastkml/kml.py @@ -29,6 +29,7 @@ from datetime import datetime from typing import Any from typing import Dict +from typing import Iterable from typing import Iterator from typing import List from typing import Optional @@ -86,41 +87,41 @@ class _Feature(TimeMixin, _BaseObject): * NetworkLink. """ - name = None + name: Optional[str] # User-defined text displayed in the 3D viewer as the label for the # object (for example, for a Placemark, Folder, or NetworkLink). - visibility = 1 + visibility: bool # Boolean value. Specifies whether the feature is drawn in the 3D # viewer when it is initially loaded. In order for a feature to be # visible, the tag of all its ancestors must also be # set to 1. - isopen = 0 + isopen: bool # Boolean value. Specifies whether a Document or Folder appears # closed or open when first loaded into the Places panel. # 0=collapsed (the default), 1=expanded. - _atom_author = None + _atom_author: Optional[atom.Author] # KML 2.2 supports new elements for including data about the author # and related website in your KML file. This information is displayed # in geo search results, both in Earth browsers such as Google Earth, # and in other applications such as Google Maps. - _atom_link = None + _atom_link: Optional[atom.Link] # Specifies the URL of the website containing this KML or KMZ file. - _address = None + _address: Optional[str] # A string value representing an unstructured address written as a # standard street, city, state address, and/or as a postal code. # You can use the
tag to specify the location of a point # instead of using latitude and longitude coordinates. - _phone_number = None + _phone_number: Optional[str] # A string value representing a telephone number. # This element is used by Google Maps Mobile only. - _snippet = None # XXX + _snippet: Optional[Union[str, Dict[str, Any]]] # _snippet is either a tuple of a string Snippet.text and an integer # Snippet.maxLines or a string # @@ -134,16 +135,16 @@ class _Feature(TimeMixin, _BaseObject): # support HTML markup. has a maxLines attribute, an integer # that specifies the maximum number of lines to display. - description = None + description: Optional[str] # User-supplied content that appears in the description balloon. - _style_url = None + _style_url: Optional[Union[Style, StyleMap]] # URL of a