Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0 alpha 8 (Sourcery refactored) #282

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions fastkml/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,7 @@ def style_url(self) -> Optional[str]:
Returns the url only, not a full StyleUrl object.
if you need the full StyleUrl object use _style_url.
"""
if isinstance(self._style_url, StyleUrl):
return self._style_url.url
return None
return self._style_url.url if isinstance(self._style_url, StyleUrl) else None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _Feature.style_url refactored with the following changes:


@style_url.setter
def style_url(self, styleurl: Union[str, StyleUrl, None]) -> None:
Expand Down Expand Up @@ -537,9 +535,7 @@ def __init__(

@property
def geometry(self) -> Optional[AnyGeometryType]:
if self._geometry is not None:
return self._geometry.geometry
return None
return self._geometry.geometry if self._geometry is not None else None
Comment on lines -540 to +538
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Placemark.geometry refactored with the following changes:


def etree_element(
self,
Expand Down
6 changes: 3 additions & 3 deletions tests/oldunit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,14 @@ def test_from_wrong_string(self) -> None:
pytest.raises(TypeError, kml.KML.class_from_string, "<xml></xml>")

def test_from_string_with_unbound_prefix(self) -> None:
doc = """<kml xmlns="http://www.opengis.net/kml/2.2">
if LXML:
config.set_etree_implementation(lxml.etree)
doc = """<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<ExtendedData>
<lc:attachment>image.png</lc:attachment>
</ExtendedData>
</Placemark> </kml>"""
if LXML:
config.set_etree_implementation(lxml.etree)
Comment on lines -525 to -532
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TestKmlFromString.test_from_string_with_unbound_prefix refactored with the following changes:

k = kml.KML.class_from_string(doc)
assert len(list(k.features())) == 1

Expand Down
Loading