Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
apurvabanka committed Dec 1, 2024
1 parent 471384c commit 10ebe81
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions fastkml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from fastkml.atom import Link as AtomLink
from fastkml.containers import Document
from fastkml.containers import Folder
from fastkml.network_link_control import NetworkLinkControl
from fastkml.data import Data
from fastkml.data import ExtendedData
from fastkml.data import Schema
Expand Down Expand Up @@ -59,6 +58,7 @@
from fastkml.model import Orientation
from fastkml.model import ResourceMap
from fastkml.model import Scale
from fastkml.network_link_control import NetworkLinkControl
from fastkml.overlays import GroundOverlay
from fastkml.overlays import ImagePyramid
from fastkml.overlays import LatLonBox
Expand Down Expand Up @@ -91,7 +91,6 @@

__all__ = [
"KML",
"NetworkLinkControl",
"Alias",
"AtomAuthor",
"AtomContributor",
Expand Down Expand Up @@ -121,6 +120,7 @@
"Model",
"MultiGeometry",
"NetworkLink",
"NetworkLinkControl",
"Orientation",
"OuterBoundaryIs",
"OverlayXY",
Expand Down
2 changes: 1 addition & 1 deletion fastkml/kml.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
Placemark,
GroundOverlay,
PhotoOverlay,
NetworkLinkControl
NetworkLinkControl,
]


Expand Down
22 changes: 12 additions & 10 deletions fastkml/network_link_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import logging

from typing import Any
from typing import Dict
from typing import Optional
from typing import Union

from fastkml import config
from fastkml.base import _XMLObject
from fastkml.helpers import datetime_subelement
from fastkml.helpers import datetime_subelement_kwarg
from fastkml.helpers import float_subelement
from fastkml.helpers import subelement_float_kwarg
from fastkml.helpers import datetime_subelement_kwarg
from fastkml.helpers import subelement_text_kwarg
from fastkml.helpers import text_subelement
from fastkml.helpers import xml_subelement_list
from fastkml.helpers import xml_subelement_list_kwarg
from fastkml.helpers import xml_subelement
from fastkml.helpers import xml_subelement_kwarg
from fastkml.registry import RegistryItem
from fastkml.registry import registry
from fastkml.times import KmlDateTime
from fastkml.views import Camera, LookAt

from fastkml.views import Camera
from fastkml.views import LookAt

__all__ = [
"NetworkLinkControl",
Expand Down Expand Up @@ -69,7 +69,7 @@ def __init__(
link_snippet: Optional[str] = None,
expires: Optional[KmlDateTime] = None,
view: Optional[Union[Camera, LookAt]] = None,
**kwargs: Any
**kwargs: Any,
) -> None:
super().__init__(
ns=ns,
Expand All @@ -83,7 +83,7 @@ def __init__(
link_snippet=link_snippet,
expires=expires,
view=view,
**kwargs
**kwargs,
)

def __repr__(self) -> str:
Expand Down Expand Up @@ -122,6 +122,7 @@ def __repr__(self) -> str:
classes=(float,),
get_kwarg=subelement_float_kwarg,
set_element=float_subelement,
default=0,
),
)
registry.register(
Expand All @@ -133,6 +134,7 @@ def __repr__(self) -> str:
classes=(float,),
get_kwarg=subelement_float_kwarg,
set_element=float_subelement,
default=-1,
),
)
registry.register(
Expand Down Expand Up @@ -211,7 +213,7 @@ def __repr__(self) -> str:
Camera,
LookAt,
),
get_kwarg=xml_subelement_list_kwarg,
set_element=xml_subelement_list,
get_kwarg=xml_subelement_kwarg,
set_element=xml_subelement,
),
)
10 changes: 3 additions & 7 deletions tests/network_link_control_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ def test_network_link_control_obj(self) -> None:
assert network_control_obj.link_name == "link_name"
assert network_control_obj.link_description == "link_description"
assert network_control_obj.link_snippet == "link_snippet"
assert network_control_obj.expires == kml_datetime

assert network_control_obj.view == view
assert str(network_control_obj.expires) == str(kml_datetime)
assert str(network_control_obj.view) == str(view)

def test_network_link_control_kml(self) -> None:
doc = (
Expand All @@ -77,7 +76,4 @@ def test_network_link_control_kml(self) -> None:
expires=kml_datetime,
)

assert nc.min_refresh_period == nc_obj.min_refresh_period
assert nc.max_session_length == nc_obj.max_session_length
assert nc.link_snippet == nc_obj.link_snippet
assert nc.expires == nc_obj.expires
assert nc == nc_obj

0 comments on commit 10ebe81

Please sign in to comment.